hti/HtiFramework/src/HtiDispatcher.cpp
changeset 21 f5d4820de50d
parent 13 33016869e0dd
child 30 86a2e675b80a
--- a/hti/HtiFramework/src/HtiDispatcher.cpp	Thu May 13 23:59:27 2010 +0300
+++ b/hti/HtiFramework/src/HtiDispatcher.cpp	Tue May 25 18:01:01 2010 +0300
@@ -123,7 +123,8 @@
     iIdleOverCommAdapter( EFalse ),
     iHtiInstanceId( 0 ),
     iShowErrorDialogs( aShowErrorDialogs ),
-    iReconnectDelay (aReconnectDelay)
+    iReconnectDelay(aReconnectDelay),
+    iRebootReason(-1)
     {
     HTI_LOG_FORMAT( "MaxQueueMemorySize %d", iMaxQueueMemorySize );
     iQueueSizeLowThresold = ( iMaxQueueMemorySize / 2 ) / 2;
@@ -861,7 +862,23 @@
                     break;
 
                 case EHtiReboot:
+                    {
+                    if(aMessage.Length() == 2)
+                        {
+                        iRebootReason = aMessage[1];
+                        }
+                    else if(aMessage.Length() == 1)
+                        {
+                        iRebootReason = -1;
+                        }
+                    else
+                        {
+                        User::LeaveIfError(DispatchOutgoingErrorMessage( KErrArgument,
+                                      KErrDescrInvalidParameter,
+                                      KHtiSystemServiceUid ) );
+                        }
                     ShutdownAndRebootDeviceL();
+                    }
                     break;
 
                 case EHtiStop:
@@ -1022,7 +1039,16 @@
     TInt err = KErrNone;
     RProcess rebootProcess;
     // First try the UI layer rebooter
-    err = rebootProcess.Create( KHtiDeviceRebootExeUI, KNullDesC );
+    if(iRebootReason == -1)
+        {
+        err = rebootProcess.Create( KHtiDeviceRebootExeUI, KNullDesC );
+        }
+    else
+        {
+        TBuf<8> reasonNumber;
+        reasonNumber.Num(iRebootReason);
+        err = rebootProcess.Create( KHtiDeviceRebootExeUI, reasonNumber );
+        }
     if ( err != KErrNone )
         {
         HTI_LOG_FORMAT( "UI layer rebooter failed with %d", err );