hti/HtiFramework/src/HtiDispatcher.cpp
branchRCL_3
changeset 12 d27dfa8884ad
parent 7 8a14024f954a
child 14 a9c038d69df8
equal deleted inserted replaced
10:381827f66490 12:d27dfa8884ad
   121     iRfsMode( ERfsUnknown ),
   121     iRfsMode( ERfsUnknown ),
   122     iConsole( NULL ),
   122     iConsole( NULL ),
   123     iIdleOverCommAdapter( EFalse ),
   123     iIdleOverCommAdapter( EFalse ),
   124     iHtiInstanceId( 0 ),
   124     iHtiInstanceId( 0 ),
   125     iShowErrorDialogs( aShowErrorDialogs ),
   125     iShowErrorDialogs( aShowErrorDialogs ),
   126     iReconnectDelay (aReconnectDelay)
   126     iReconnectDelay(aReconnectDelay),
       
   127     iRebootReason(0)
   127     {
   128     {
   128     HTI_LOG_FORMAT( "MaxQueueMemorySize %d", iMaxQueueMemorySize );
   129     HTI_LOG_FORMAT( "MaxQueueMemorySize %d", iMaxQueueMemorySize );
   129     iQueueSizeLowThresold = ( iMaxQueueMemorySize / 2 ) / 2;
   130     iQueueSizeLowThresold = ( iMaxQueueMemorySize / 2 ) / 2;
   130     iQueueSizeHighThresold = ( iMaxQueueMemorySize / 2 ) * 4 / 5;
   131     iQueueSizeHighThresold = ( iMaxQueueMemorySize / 2 ) * 4 / 5;
   131     HTI_LOG_FORMAT( "QueueSizeThresholds low : %d", iQueueSizeLowThresold );
   132     HTI_LOG_FORMAT( "QueueSizeThresholds low : %d", iQueueSizeLowThresold );
   859                         }
   860                         }
   860                     }
   861                     }
   861                     break;
   862                     break;
   862 
   863 
   863                 case EHtiReboot:
   864                 case EHtiReboot:
       
   865                     {
       
   866                     if(aMessage.Length() == 2)
       
   867                         {
       
   868                         iRebootReason = aMessage[1];
       
   869                         }
       
   870                     else if(aMessage.Length() == 1)
       
   871                         {
       
   872                         iRebootReason = 0;
       
   873                         }
       
   874                     else
       
   875                         {
       
   876                         User::LeaveIfError(DispatchOutgoingErrorMessage( KErrArgument,
       
   877                                       KErrDescrInvalidParameter,
       
   878                                       KHtiSystemServiceUid ) );
       
   879                         }
   864                     ShutdownAndRebootDeviceL();
   880                     ShutdownAndRebootDeviceL();
       
   881                     }
   865                     break;
   882                     break;
   866 
   883 
   867                 case EHtiStop:
   884                 case EHtiStop:
   868                     {
   885                     {
   869                     HTI_LOG_TEXT( "STOP" );
   886                     HTI_LOG_TEXT( "STOP" );
  1020         iConsole->Printf( _L( "Reboot requested.\n" ) );
  1037         iConsole->Printf( _L( "Reboot requested.\n" ) );
  1021         }
  1038         }
  1022     TInt err = KErrNone;
  1039     TInt err = KErrNone;
  1023     RProcess rebootProcess;
  1040     RProcess rebootProcess;
  1024     // First try the UI layer rebooter
  1041     // First try the UI layer rebooter
  1025     err = rebootProcess.Create( KHtiDeviceRebootExeUI, KNullDesC );
  1042     if(iRebootReason == 0)
       
  1043         {
       
  1044         err = rebootProcess.Create( KHtiDeviceRebootExeUI, KNullDesC );
       
  1045         }
       
  1046     else
       
  1047         {
       
  1048         TBuf<8> reasonNumber;
       
  1049         reasonNumber.Num(iRebootReason);
       
  1050         err = rebootProcess.Create( KHtiDeviceRebootExeUI, reasonNumber );
       
  1051         }
  1026     if ( err != KErrNone )
  1052     if ( err != KErrNone )
  1027         {
  1053         {
  1028         HTI_LOG_FORMAT( "UI layer rebooter failed with %d", err );
  1054         HTI_LOG_FORMAT( "UI layer rebooter failed with %d", err );
  1029         // Try if there is OS layer rebooter present
  1055         // Try if there is OS layer rebooter present
  1030         err = rebootProcess.Create( KHtiDeviceRebootExeOS, KNullDesC );
  1056         err = rebootProcess.Create( KHtiDeviceRebootExeOS, KNullDesC );