|
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 "radioservicedef.h" |
|
25 |
|
26 // Constants |
|
27 const int SERVICE_POWEROFF_DELAY = 5000; |
|
28 |
|
29 /*! |
|
30 * |
|
31 */ |
|
32 RadioControlService::RadioControlService( RadioUiEngine& engine ) : |
|
33 XQServiceProvider( RADIO_SERVICE +"."+ RADIO_CONTROL_SERVICE, &engine ), |
|
34 mUiEngine( engine ) |
|
35 { |
|
36 publishAll(); |
|
37 } |
|
38 |
|
39 /*! |
|
40 * |
|
41 */ |
|
42 RadioControlService::~RadioControlService() |
|
43 { |
|
44 } |
|
45 |
|
46 /*! |
|
47 * Public slot |
|
48 */ |
|
49 void RadioControlService::command( int commandId ) |
|
50 { |
|
51 //TODO: Uncomment when vendor id can be read from the client |
|
52 // if ( requestInfo().clientVendorId() != NOKIA_VENDORID ) { |
|
53 // return; |
|
54 // } |
|
55 |
|
56 switch ( commandId ) |
|
57 { |
|
58 case RadioServiceCommand::PowerOn: |
|
59 mUiEngine.setPowerOn(); |
|
60 break; |
|
61 |
|
62 case RadioServiceCommand::PowerOff: |
|
63 mUiEngine.setPowerOff( SERVICE_POWEROFF_DELAY ); |
|
64 break; |
|
65 |
|
66 case RadioServiceCommand::Previous: |
|
67 mUiEngine.skipStation( StationSkip::PreviousFavorite, 0, TuneReason::SkipFromWidget ); |
|
68 break; |
|
69 |
|
70 case RadioServiceCommand::Next: |
|
71 mUiEngine.skipStation( StationSkip::NextFavorite, 0, TuneReason::SkipFromWidget ); |
|
72 break; |
|
73 |
|
74 case RadioServiceCommand::SeekUp: |
|
75 mUiEngine.seekStation( Seek::Up ); |
|
76 break; |
|
77 |
|
78 case RadioServiceCommand::SeekDown: |
|
79 mUiEngine.seekStation( Seek::Down ); |
|
80 break; |
|
81 |
|
82 case RadioServiceCommand::Foreground: |
|
83 XQServiceUtil::toBackground( false ); |
|
84 break; |
|
85 |
|
86 case RadioServiceCommand::Background: |
|
87 XQServiceUtil::toBackground( true ); |
|
88 break; |
|
89 |
|
90 case RadioServiceCommand::Mute: |
|
91 mUiEngine.setMute( true ); |
|
92 break; |
|
93 |
|
94 case RadioServiceCommand::UnMute: |
|
95 mUiEngine.setMute( false ); |
|
96 break; |
|
97 |
|
98 default: |
|
99 break; |
|
100 } |
|
101 } |