radioapp/radiouiengine/src/radiocontrolservice.cpp
changeset 14 63aabac4416d
child 16 f54ebcfc1b80
equal deleted inserted replaced
13:46974bebc798 14:63aabac4416d
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <xqserviceutil.h>
       
    20 
       
    21 // User includes
       
    22 #include "radiocontrolservice.h"
       
    23 #include "radiouiengine.h"
       
    24 #include "radioserviceconst.h"
       
    25 
       
    26 /*!
       
    27  *
       
    28  */
       
    29 RadioControlService::RadioControlService( RadioUiEngine& engine ) :
       
    30     XQServiceProvider( RADIO_CONTROL_SERVICE , &engine ),
       
    31     mUiEngine( engine )
       
    32 {
       
    33     publishAll();
       
    34     if ( XQServiceUtil::isService() ) {
       
    35         XQServiceUtil::toBackground( true );
       
    36     }
       
    37 }
       
    38 
       
    39 /*!
       
    40  *
       
    41  */
       
    42 RadioControlService::~RadioControlService()
       
    43 {
       
    44 }
       
    45 
       
    46 /*!
       
    47  * Public slot
       
    48  */
       
    49 void RadioControlService::command( int commandId )
       
    50 {
       
    51     switch ( commandId )
       
    52     {
       
    53         case RadioServiceCommand::Play:
       
    54             mUiEngine.toggleMute();
       
    55             break;
       
    56 
       
    57         case RadioServiceCommand::Pause:
       
    58             mUiEngine.toggleMute();
       
    59             break;
       
    60 
       
    61         case RadioServiceCommand::Previous:
       
    62             mUiEngine.skipPrevious();
       
    63             break;
       
    64 
       
    65         case RadioServiceCommand::Next:
       
    66             mUiEngine.skipNext();
       
    67             break;
       
    68 
       
    69         case RadioServiceCommand::SeekUp:
       
    70             mUiEngine.seekUp();
       
    71             break;
       
    72 
       
    73         case RadioServiceCommand::SeekDown:
       
    74             mUiEngine.seekDown();
       
    75             break;
       
    76 
       
    77         case RadioServiceCommand::Foreground:
       
    78             XQServiceUtil::toBackground( false );
       
    79             break;
       
    80 
       
    81         case RadioServiceCommand::Background:
       
    82             XQServiceUtil::toBackground( true );
       
    83             break;
       
    84 
       
    85         default:
       
    86             break;
       
    87     }
       
    88 }