radioapp/radiouiengine/src/radiocontrolservice.cpp
changeset 28 075425b8d9a4
parent 24 6df133bd92e1
child 32 189d20c34778
child 34 bc10a61bd7d3
--- a/radioapp/radiouiengine/src/radiocontrolservice.cpp	Fri Jun 04 10:21:36 2010 +0100
+++ b/radioapp/radiouiengine/src/radiocontrolservice.cpp	Fri Jun 11 13:38:32 2010 +0300
@@ -23,11 +23,14 @@
 #include "radiouiengine.h"
 #include "radioservicedef.h"
 
+// Constants
+const int SERVICE_POWEROFF_DELAY = 5000;
+
 /*!
  *
  */
 RadioControlService::RadioControlService( RadioUiEngine& engine ) :
-    XQServiceProvider( RADIO_CONTROL_SERVICE , &engine ),
+    XQServiceProvider( RADIO_CONTROL_SERVICE, &engine ),
     mUiEngine( engine )
 {
     publishAll();
@@ -48,14 +51,19 @@
  */
 void RadioControlService::command( int commandId )
 {
+    //TODO: Uncomment when vendor id can be read from the client
+//    if ( requestInfo().clientVendorId() != NOKIA_VENDORID ) {
+//        return;
+//    }
+
     switch ( commandId )
     {
-        case RadioServiceCommand::Play:
-            mUiEngine.setMute( false );
+        case RadioServiceCommand::PowerOn:
+            mUiEngine.setPowerOn();
             break;
 
-        case RadioServiceCommand::Pause:
-            mUiEngine.setMute( true );
+        case RadioServiceCommand::PowerOff:
+            mUiEngine.setPowerOff( SERVICE_POWEROFF_DELAY );
             break;
 
         case RadioServiceCommand::Previous:
@@ -67,11 +75,11 @@
             break;
 
         case RadioServiceCommand::SeekUp:
-            mUiEngine.seekStation( Seeking::Up );
+            mUiEngine.seekStation( Seek::Up );
             break;
 
         case RadioServiceCommand::SeekDown:
-            mUiEngine.seekStation( Seeking::Down );
+            mUiEngine.seekStation( Seek::Down );
             break;
 
         case RadioServiceCommand::Foreground:
@@ -82,6 +90,14 @@
             XQServiceUtil::toBackground( true );
             break;
 
+        case RadioServiceCommand::Mute:
+            mUiEngine.setMute( true );
+            break;
+
+        case RadioServiceCommand::UnMute:
+            mUiEngine.setMute( false );
+            break;
+
         default:
             break;
     }