37
|
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 |
|
|
19 |
#include "infowidgetsathandler.h"
|
|
20 |
#include "infowidgetsathandlerprivate.h"
|
|
21 |
#include "infowidgetlogging.h"
|
|
22 |
#include <rsatservice.h>
|
|
23 |
|
|
24 |
/*!
|
|
25 |
\class InfoWidgetSatHandler
|
|
26 |
\brief Handles SIM Application Toolkit specific functionality of
|
|
27 |
Operator info widget
|
|
28 |
*/
|
|
29 |
|
|
30 |
/*!
|
|
31 |
*/
|
|
32 |
InfoWidgetSatHandler::InfoWidgetSatHandler(QObject *parent):
|
|
33 |
QObject(parent) , m_connected(false)
|
|
34 |
{
|
|
35 |
DPRINT << ": IN";
|
|
36 |
|
|
37 |
d_ptr = new InfoWidgetSatHandlerPrivate(this, m_satService);
|
|
38 |
|
|
39 |
DPRINT << ": OUT";
|
|
40 |
}
|
|
41 |
|
|
42 |
/*!
|
|
43 |
*/
|
|
44 |
InfoWidgetSatHandler::~InfoWidgetSatHandler()
|
|
45 |
{
|
|
46 |
DPRINT << ": IN";
|
|
47 |
delete d_ptr;
|
|
48 |
DPRINT << ": OUT";
|
|
49 |
}
|
|
50 |
|
|
51 |
/*!
|
|
52 |
InfoWidgetSatHandler::connect
|
|
53 |
*/
|
|
54 |
void InfoWidgetSatHandler::connect(bool connect)
|
|
55 |
{
|
|
56 |
DPRINT << ": IN : connected = " << m_connected << " : connect = " << connect;
|
|
57 |
if(connect && !m_connected){
|
|
58 |
DPRINT << "connect and startObserving() ";
|
|
59 |
m_connected = d_ptr->connect();
|
|
60 |
if(m_connected){
|
|
61 |
d_ptr->startObserving();
|
|
62 |
}
|
|
63 |
}else if (!connect && m_connected){
|
|
64 |
DPRINT << "disconnect and stopObserving() ";
|
|
65 |
m_connected = d_ptr->disconnect();
|
|
66 |
}
|
|
67 |
DPRINT << ": OUT : connected = " << m_connected;
|
|
68 |
}
|
|
69 |
|
|
70 |
/*!
|
|
71 |
InfoWidgetSatHandler::logCurrentInfo
|
|
72 |
*/
|
|
73 |
void InfoWidgetSatHandler::logCurrentInfo()
|
|
74 |
{
|
|
75 |
DPRINT << ": IN";
|
|
76 |
DPRINT << "SAT IdleModeText: " << m_displayText;
|
|
77 |
DPRINT << ": OUT";
|
|
78 |
}
|
|
79 |
|
|
80 |
/*!
|
|
81 |
InfoWidgetSatHandler::satDisplayText
|
|
82 |
*/
|
|
83 |
const QString& InfoWidgetSatHandler::satDisplayText() const
|
|
84 |
{
|
|
85 |
DPRINT << ": text: " << m_displayText;
|
|
86 |
return m_displayText;
|
|
87 |
}
|
|
88 |
|
|
89 |
/*!
|
|
90 |
InfoWidgetSatHandler::setSatDisplayText
|
|
91 |
*/
|
|
92 |
void InfoWidgetSatHandler::setSatDisplayText(const QString& displayText)
|
|
93 |
{
|
|
94 |
DPRINT << ": display text: " << displayText;
|
|
95 |
m_displayText = displayText;
|
|
96 |
}
|
|
97 |
|
|
98 |
/*!
|
|
99 |
InfoWidgetSatHandler::handleIdleModeTxtMessage
|
|
100 |
*/
|
|
101 |
void InfoWidgetSatHandler::handleIdleModeTxtMessage( int idleResult )
|
|
102 |
{
|
|
103 |
DPRINT << ": handleIdleModeTxtMessage: " << idleResult;
|
|
104 |
if(m_connected){
|
|
105 |
m_satService.SetIdleModeTextResponse((RSatService::TSATIdleResult)idleResult);
|
|
106 |
}
|
|
107 |
else{
|
|
108 |
//TODO: What's correct response if widget isn't visible? For now it's permanen problem
|
|
109 |
m_satService.SetIdleModeTextResponse( RSatService::ESATIdleCmdBeyondMeCapabilities );
|
|
110 |
}
|
|
111 |
|
|
112 |
//Pass the result
|
|
113 |
emit handleMessage(idleResult);
|
|
114 |
}
|
|
115 |
|
|
116 |
/*!
|
|
117 |
InfoWidgetSatHandler::handleSatError
|
|
118 |
*/
|
|
119 |
void InfoWidgetSatHandler::handleSatError( int operation, int errorCode )
|
|
120 |
{
|
|
121 |
DPRINT << ": satError : operation: " << operation << ": errorCode: "<<errorCode;
|
|
122 |
m_satService.SetIdleModeTextResponse( RSatService::ESATIdleMeUnableToProcessCmd );
|
|
123 |
emit handleError(operation, errorCode);
|
|
124 |
}
|
|
125 |
|
|
126 |
// End of File.
|
|
127 |
|