Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/qtestlib/wince/cetest/main.cpp

    r651 r769  
    4545#   include "activesyncconnection.h"
    4646#endif
     47
     48const int SLEEP_AFTER_RESET = 60000; // sleep for 1 minute
     49const int SLEEP_RECONNECT   = 2000;  // sleep for 2 seconds before trying another reconnect
    4750
    4851#include "deployment.h"
     
    124127        " -release          : Test release version\n"
    125128        " -libpath <path>   : Remote path to deploy Qt libraries to\n"
     129        " -reset            : Reset device before starting a test\n"
     130        " -awake            : Device does not go sleep mode\n"
    126131        " -qt-delete        : Delete the Qt libraries after execution\n"
    127132        " -project-delete   : Delete the project file(s) after execution\n"
     
    153158    bool cleanupQt = false;
    154159    bool cleanupProject = false;
     160    bool deviceReset = false;
     161    bool keepAwake = false;
    155162
    156163    for (int i=1; i<arguments.size(); ++i) {
     
    197204            cleanupQt = true;
    198205            cleanupProject = true;
     206        } else if (arguments.at(i).toLower() == QLatin1String("-reset")) {
     207            deviceReset = true;
     208        } else if (arguments.at(i).toLower() == QLatin1String("-awake")) {
     209            keepAwake = true;
    199210        } else if (arguments.at(i).toLower() == QLatin1String("-conf")) {
    200211            if (++i == arguments.size()) {
     
    353364        cout << "Error: Could not copy file(s) to device" << endl;
    354365        return -1;
     366    }
     367    // device power mode
     368    if (keepAwake)
     369    {
     370        int retVal = 0;
     371        if (!connection.setDeviceAwake(true, &retVal)) {
     372            cout << "Error: Could not set unattended mode on device" << endl;
     373            return -1;
     374        }
     375    }
     376
     377    // reset device
     378    if (deviceReset)
     379    {
     380        if (!connection.resetDevice()) {
     381        //if (!connection.toggleDevicePower( &retVal)) {
     382            cout << "Error: Could not reset the device" << endl;
     383            return -1;
     384        }
     385        cout << " Entering sleep after reset for " << SLEEP_AFTER_RESET / 1000 << " seconds ... " << endl;
     386        Sleep(SLEEP_AFTER_RESET);
     387        cout << " ... woke up. " << endl;
     388        connection.disconnect();
     389        // reconnect after reset
     390        int retryCount = 21;
     391        while (--retryCount)
     392        {
     393            if (!connection.connect())
     394                Sleep(SLEEP_RECONNECT);
     395            else
     396                break;
     397        }
     398        if (!connection.isConnected())
     399        {
     400            cout << "Error: Could not connect to device!" << endl;
     401            return -1;
     402        }
    355403    }
    356404
Note: See TracChangeset for help on using the changeset viewer.