30 // Constructor |
30 // Constructor |
31 IrControlService::IrControlService(IRApplication *aIrApp, QObject *aParent) : |
31 IrControlService::IrControlService(IRApplication *aIrApp, QObject *aParent) : |
32 XQServiceProvider(IR_CONTROL_SERVICE_NAME, aParent), |
32 XQServiceProvider(IR_CONTROL_SERVICE_NAME, aParent), |
33 mIrApp(aIrApp) |
33 mIrApp(aIrApp) |
34 { |
34 { |
|
35 LOG_METHOD; |
35 publishAll(); |
36 publishAll(); |
36 } |
37 } |
37 |
38 |
38 // Destructor |
39 // Destructor |
39 IrControlService::~IrControlService() |
40 IrControlService::~IrControlService() |
40 { |
41 { |
|
42 LOG_METHOD; |
41 } |
43 } |
42 |
44 |
43 // service interface, called via Qt Highway |
45 // service interface, called via Qt Highway |
44 int IrControlService::handleCmd(int aCmdId) |
46 int IrControlService::handleCmd(int aCmdId) |
45 { |
47 { |
46 LOG_FORMAT( "IrControlService::handleCmd, the command is %d", aCmdId); |
48 LOG_METHOD; |
|
49 LOG_FORMAT( "command = %d", aCmdId); |
47 IrServiceResult::Type result = IrServiceResult::Fail; |
50 IrServiceResult::Type result = IrServiceResult::Fail; |
48 |
51 |
49 switch (aCmdId) |
52 switch (aCmdId) |
50 { |
53 { |
51 case IrServiceCmd::LaunchNormally: |
54 case IrServiceCmd::LaunchNormally: |
86 return (int)result; |
89 return (int)result; |
87 } |
90 } |
88 |
91 |
89 IrServiceResult::Type IrControlService::handleLaunchNowPlayingViewCmd() |
92 IrServiceResult::Type IrControlService::handleLaunchNowPlayingViewCmd() |
90 { |
93 { |
|
94 LOG_METHOD; |
91 if (!mIrApp->isAppFullyStarted()) |
95 if (!mIrApp->isAppFullyStarted()) |
92 { |
96 { |
93 mIrApp->launchStartingView(EIRView_PlayingView); |
97 mIrApp->launchStartingView(EIRView_PlayingView); |
94 } |
98 } |
95 return IrServiceResult::Success; |
99 return IrServiceResult::Success; |
96 } |
100 } |
97 |
101 |
98 IrServiceResult::Type IrControlService::handleLaunchNormallyCmd() |
102 IrServiceResult::Type IrControlService::handleLaunchNormallyCmd() |
99 { |
103 { |
|
104 LOG_METHOD; |
100 if (!mIrApp->isAppFullyStarted()) |
105 if (!mIrApp->isAppFullyStarted()) |
101 { |
106 { |
102 mIrApp->setLaunchView(); |
107 mIrApp->setLaunchView(); |
103 } |
108 } |
104 return IrServiceResult::Success; |
109 return IrServiceResult::Success; |
105 } |
110 } |
106 |
111 |
107 IrServiceResult::Type IrControlService::handlePlayCmd() |
112 IrServiceResult::Type IrControlService::handlePlayCmd() |
108 { |
113 { |
|
114 LOG_METHOD; |
109 #ifdef HS_WIDGET_ENABLED |
115 #ifdef HS_WIDGET_ENABLED |
110 LOG( "IrControlService::handlePlayCmd"); |
116 LOG( "IrControlService::handlePlayCmd"); |
111 bool ret = mIrApp->startPlaying(); |
117 bool ret = mIrApp->startPlaying(); |
112 LOG_FORMAT( "IrControlService::handlePlayCmd, the ret is:%d",(int)ret); |
118 LOG_FORMAT( "IrControlService::handlePlayCmd, the ret is:%d",(int)ret); |
113 return ret?IrServiceResult::Success : IrServiceResult::Fail; |
119 return ret?IrServiceResult::Success : IrServiceResult::Fail; |
117 |
123 |
118 } |
124 } |
119 |
125 |
120 IrServiceResult::Type IrControlService::handleStopCmd() |
126 IrServiceResult::Type IrControlService::handleStopCmd() |
121 { |
127 { |
|
128 LOG_METHOD; |
122 if (mIrApp->getPlayController()->isPlaying()) |
129 if (mIrApp->getPlayController()->isPlaying()) |
123 { |
130 { |
124 mIrApp->getPlayController()->stop(EIRQUserTerminated); |
131 mIrApp->getPlayController()->stop(EIRQUserTerminated); |
125 } |
132 } |
126 return IrServiceResult::Success; |
133 return IrServiceResult::Success; |
127 } |
134 } |
128 |
135 |
129 IrServiceResult::Type IrControlService::handleCancelCmd() |
136 IrServiceResult::Type IrControlService::handleCancelCmd() |
130 { |
137 { |
|
138 LOG_METHOD; |
131 #ifdef HS_WIDGET_ENABLED |
139 #ifdef HS_WIDGET_ENABLED |
132 mIrApp->cancelPlayerLoading(); |
140 mIrApp->cancelPlayerLoading(); |
133 #endif |
141 #endif |
134 return IrServiceResult::Success; |
142 return IrServiceResult::Success; |
135 } |
143 } |