radioapp/radiouiengine/src/radiocontrolservice.cpp
branchGCC_SURGE
changeset 37 451b2e1545b2
parent 19 afea38384506
parent 33 11b6825f0862
equal deleted inserted replaced
26:6bcf277166c1 37:451b2e1545b2
    21 // User includes
    21 // User includes
    22 #include "radiocontrolservice.h"
    22 #include "radiocontrolservice.h"
    23 #include "radiouiengine.h"
    23 #include "radiouiengine.h"
    24 #include "radioservicedef.h"
    24 #include "radioservicedef.h"
    25 
    25 
       
    26 // Constants
       
    27 const int SERVICE_POWEROFF_DELAY = 5000;
       
    28 
    26 /*!
    29 /*!
    27  *
    30  *
    28  */
    31  */
    29 RadioControlService::RadioControlService( RadioUiEngine& engine ) :
    32 RadioControlService::RadioControlService( RadioUiEngine& engine ) :
    30     XQServiceProvider( RADIO_CONTROL_SERVICE , &engine ),
    33     XQServiceProvider( RADIO_SERVICE +"."+ RADIO_CONTROL_SERVICE, &engine ),
    31     mUiEngine( engine )
    34     mUiEngine( engine )
    32 {
    35 {
    33     publishAll();
    36     publishAll();
    34     if ( XQServiceUtil::isService() ) {
       
    35         XQServiceUtil::toBackground( true );
       
    36     }
       
    37 }
    37 }
    38 
    38 
    39 /*!
    39 /*!
    40  *
    40  *
    41  */
    41  */
    46 /*!
    46 /*!
    47  * Public slot
    47  * Public slot
    48  */
    48  */
    49 void RadioControlService::command( int commandId )
    49 void RadioControlService::command( int commandId )
    50 {
    50 {
       
    51     //TODO: Uncomment when vendor id can be read from the client
       
    52 //    if ( requestInfo().clientVendorId() != NOKIA_VENDORID ) {
       
    53 //        return;
       
    54 //    }
       
    55 
    51     switch ( commandId )
    56     switch ( commandId )
    52     {
    57     {
    53         case RadioServiceCommand::Play:
    58         case RadioServiceCommand::PowerOn:
    54             mUiEngine.setMute( false );
    59             mUiEngine.setPowerOn();
    55             break;
    60             break;
    56 
    61 
    57         case RadioServiceCommand::Pause:
    62         case RadioServiceCommand::PowerOff:
    58             mUiEngine.setMute( true );
    63             mUiEngine.setPowerOff( SERVICE_POWEROFF_DELAY );
    59             break;
    64             break;
    60 
    65 
    61         case RadioServiceCommand::Previous:
    66         case RadioServiceCommand::Previous:
    62             mUiEngine.skipStation( StationSkip::PreviousFavorite );
    67             mUiEngine.skipStation( StationSkip::PreviousFavorite );
    63             break;
    68             break;
    65         case RadioServiceCommand::Next:
    70         case RadioServiceCommand::Next:
    66             mUiEngine.skipStation( StationSkip::NextFavorite );
    71             mUiEngine.skipStation( StationSkip::NextFavorite );
    67             break;
    72             break;
    68 
    73 
    69         case RadioServiceCommand::SeekUp:
    74         case RadioServiceCommand::SeekUp:
    70             mUiEngine.seekStation( Seeking::Up );
    75             mUiEngine.seekStation( Seek::Up );
    71             break;
    76             break;
    72 
    77 
    73         case RadioServiceCommand::SeekDown:
    78         case RadioServiceCommand::SeekDown:
    74             mUiEngine.seekStation( Seeking::Down );
    79             mUiEngine.seekStation( Seek::Down );
    75             break;
    80             break;
    76 
    81 
    77         case RadioServiceCommand::Foreground:
    82         case RadioServiceCommand::Foreground:
    78             XQServiceUtil::toBackground( false );
    83             XQServiceUtil::toBackground( false );
    79             break;
    84             break;
    80 
    85 
    81         case RadioServiceCommand::Background:
    86         case RadioServiceCommand::Background:
    82             XQServiceUtil::toBackground( true );
    87             XQServiceUtil::toBackground( true );
    83             break;
    88             break;
    84 
    89 
       
    90         case RadioServiceCommand::Mute:
       
    91             mUiEngine.setMute( true );
       
    92             break;
       
    93 
       
    94         case RadioServiceCommand::UnMute:
       
    95             mUiEngine.setMute( false );
       
    96             break;
       
    97 
    85         default:
    98         default:
    86             break;
    99             break;
    87     }
   100     }
    88 }
   101 }