hti/HtiFramework/src/HtiDispatcher.cpp
branchRCL_3
changeset 18 3406c99bc375
parent 14 a9c038d69df8
equal deleted inserted replaced
16:8f8df8006c40 18:3406c99bc375
    46     EHtiReset          = 0x07,
    46     EHtiReset          = 0x07,
    47     EHtiShowConsole    = 0x08,
    47     EHtiShowConsole    = 0x08,
    48     EHtiHideConsole    = 0x09,
    48     EHtiHideConsole    = 0x09,
    49     EHtiInstanceId     = 0x0A,
    49     EHtiInstanceId     = 0x0A,
    50     EHtiDebugPrint     = 0x0B,
    50     EHtiDebugPrint     = 0x0B,
       
    51     EHtiRestartServices= 0x0C,
    51     EHtiError          = 0xFF
    52     EHtiError          = 0xFF
    52     };
    53     };
    53 
    54 
    54 //HTI error messages
    55 //HTI error messages
    55 const static TInt KMaxErrMessageLength = KErrorDescriptionMaxLength + 10;
    56 const static TInt KMaxErrMessageLength = KErrorDescriptionMaxLength + 10;
    68 const static TInt KHtiServiceListRecordLength = KHtiServiceNameLength + 4;
    69 const static TInt KHtiServiceListRecordLength = KHtiServiceNameLength + 4;
    69 
    70 
    70 _LIT( KHtiWatchDogMatchPattern, "HtiWatchDog*" );
    71 _LIT( KHtiWatchDogMatchPattern, "HtiWatchDog*" );
    71 _LIT( KHtiDeviceRebootExeOS,    "HtiDeviceRebootOS.exe" );
    72 _LIT( KHtiDeviceRebootExeOS,    "HtiDeviceRebootOS.exe" );
    72 _LIT( KHtiDeviceRebootExeUI,    "HtiDeviceRebootUI.exe" );
    73 _LIT( KHtiDeviceRebootExeUI,    "HtiDeviceRebootUI.exe" );
       
    74 _LIT( KHtiRestartExeName,       "HtiRestart.exe");
       
    75 
    73 _LIT( KParamNormalRfs, "rfsnormal" );
    76 _LIT( KParamNormalRfs, "rfsnormal" );
    74 _LIT( KParamDeepRfs,   "rfsdeep" );
    77 _LIT( KParamDeepRfs,   "rfsdeep" );
    75 
    78 
    76 TDesC8* THtiSystemProtocolHelper::ErrorMessageL( TInt aHtiErrorCode,
    79 TDesC8* THtiSystemProtocolHelper::ErrorMessageL( TInt aHtiErrorCode,
    77                                   const TUid aTargetServiceUid )
    80                                   const TUid aTargetServiceUid )
   874                     else
   877                     else
   875                         {
   878                         {
   876                         User::LeaveIfError(DispatchOutgoingErrorMessage( KErrArgument,
   879                         User::LeaveIfError(DispatchOutgoingErrorMessage( KErrArgument,
   877                                       KErrDescrInvalidParameter,
   880                                       KErrDescrInvalidParameter,
   878                                       KHtiSystemServiceUid ) );
   881                                       KHtiSystemServiceUid ) );
       
   882                         break;
   879                         }
   883                         }
   880                     ShutdownAndRebootDeviceL();
   884                     ShutdownAndRebootDeviceL();
   881                     }
   885                     }
   882                     break;
   886                     break;
   883 
   887 
   892                     // kill the watchdog, so HTI stays stopped
   896                     // kill the watchdog, so HTI stays stopped
   893                     KillHtiWatchDogL();
   897                     KillHtiWatchDogL();
   894                     }
   898                     }
   895                     break;
   899                     break;
   896 
   900 
       
   901                 case EHtiRestartServices:
       
   902                     {
       
   903                     HTI_LOG_TEXT("RESTARTSERVISE");
       
   904                     if(aMessage.Length() != 1 && aMessage.Length() != 5)
       
   905                         {
       
   906                         User::LeaveIfError(DispatchOutgoingErrorMessage( KErrArgument,
       
   907                                                     KErrDescrInvalidParameter,
       
   908                                                     KHtiSystemServiceUid ) );
       
   909                         break;
       
   910                         }
       
   911                     
       
   912                     //stop all requests
       
   913                     //cancel just incoming request
       
   914                     //after all outgoing messages sent system will go down
       
   915                     iListener->Cancel();
       
   916 
       
   917                     // kill the watchdog, so HTI stays stopped
       
   918                     KillHtiWatchDogL();
       
   919                     
       
   920                     TUint milliseconds = 0;
       
   921                     if(aMessage.Length() == 5)
       
   922                         {
       
   923                         milliseconds = aMessage[1] + ( aMessage[2] << 8 )
       
   924                                 + ( aMessage[3] << 16 )
       
   925                                 + ( aMessage[4] << 24 );
       
   926                         }
       
   927                     
       
   928                     TBuf<20> buf;
       
   929                     buf.Format(_L("%d"), milliseconds * 1000);
       
   930                     
       
   931                     RProcess htiProcess;
       
   932                     User::LeaveIfError( htiProcess.Create(
       
   933                             KHtiRestartExeName, buf ) );
       
   934                     htiProcess.Resume();
       
   935                     htiProcess.Close();
       
   936                     break;
       
   937                     }
   897                 case EHtiReset:
   938                 case EHtiReset:
   898                     {
   939                     {
   899                     HTI_LOG_TEXT( "RESET" );
   940                     HTI_LOG_TEXT( "RESET" );
   900                     Reset();
   941                     Reset();
   901                     }
   942                     }