37
|
1 |
/*
|
|
2 |
* Copyright (c) 2004 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: implementation of CPESettingsCommand class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include "cpesettingscommand.h"
|
|
21 |
#include "mpephonemodelinternal.h"
|
|
22 |
#include <mpedatastore.h>
|
|
23 |
#include <talogger.h>
|
|
24 |
|
|
25 |
|
|
26 |
// LOCAL CONSTANTS
|
|
27 |
// None.
|
|
28 |
|
|
29 |
// ==================== LOCAL FUNCTIONS =====================================
|
|
30 |
//None.
|
|
31 |
|
|
32 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
33 |
|
|
34 |
// -----------------------------------------------------------------------------
|
|
35 |
// CPESettingsCommand::CPESettingsCommand
|
|
36 |
// C++ default constructor can NOT contain any code, that
|
|
37 |
// might leave.
|
|
38 |
// -----------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
CPESettingsCommand::CPESettingsCommand(
|
|
41 |
MPEPhoneModelInternal& aModel ) : iModel( aModel )
|
|
42 |
{
|
|
43 |
TEFLOGSTRING( KTAOBJECT, "PE: CPESettingsCommand::CPESettingsCommand" );
|
|
44 |
} //CPESettingsCommand
|
|
45 |
|
|
46 |
// -----------------------------------------------------------------------------
|
|
47 |
// CPESettingsCommand::ConstructL
|
|
48 |
// Symbian 2nd phase constructor can leave.
|
|
49 |
// -----------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
void CPESettingsCommand::ConstructL()
|
|
52 |
{
|
|
53 |
User::LeaveIfError( iSSSettings.Open() );
|
|
54 |
TInt errorCode = iSSSettings.RegisterAll( *this );
|
|
55 |
if ( errorCode == KErrNotSupported )
|
|
56 |
{
|
|
57 |
errorCode = KErrNone;
|
|
58 |
}
|
|
59 |
User::LeaveIfError( errorCode );
|
|
60 |
|
|
61 |
TEFLOGSTRING( KTAOBJECT, "PE CPESettingsCommand::ConstructL" );
|
|
62 |
} //ConstructLb
|
|
63 |
|
|
64 |
// -----------------------------------------------------------------------------
|
|
65 |
// CPESettingsCommand::NewL
|
|
66 |
// Two-phased constructor.
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
CPESettingsCommand* CPESettingsCommand::NewL(
|
|
70 |
MPEPhoneModelInternal& aModel )
|
|
71 |
{
|
|
72 |
CPESettingsCommand* self = new ( ELeave ) CPESettingsCommand( aModel );
|
|
73 |
|
|
74 |
CleanupStack::PushL( self );
|
|
75 |
self->ConstructL( );
|
|
76 |
CleanupStack::Pop( self );
|
|
77 |
|
|
78 |
TEFLOGSTRING( KTAOBJECT, "PE CPESettingsCommand::NewL" );
|
|
79 |
|
|
80 |
return self;
|
|
81 |
|
|
82 |
} //NewL
|
|
83 |
|
|
84 |
// Destructor
|
|
85 |
CPESettingsCommand::~CPESettingsCommand()
|
|
86 |
{
|
|
87 |
iSSSettings.Close();
|
|
88 |
TEFLOGSTRING( KTAOBJECT, "PE CPESettingsCommand::~CPESettingsCommand" );
|
|
89 |
} //~CPESettingsCommand
|
|
90 |
|
|
91 |
// -----------------------------------------------------------------------------
|
|
92 |
// CPESettingsCommand::GetALSLineL
|
|
93 |
// Sends synchronous request to get the ALS line and returns handle to access
|
|
94 |
// the status.
|
|
95 |
// (other items were commented in a header).
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
void CPESettingsCommand::GetALSLineL(
|
|
99 |
RMobilePhone::TMobilePhoneALSLine& aALSLine )
|
|
100 |
{
|
|
101 |
TInt value;
|
|
102 |
User::LeaveIfError( iSSSettings.Get( ESSSettingsAls, value ) );
|
|
103 |
|
|
104 |
TSSSettingsAlsValue alsValue =
|
|
105 |
static_cast< TSSSettingsAlsValue > ( value );
|
|
106 |
|
|
107 |
switch( alsValue )
|
|
108 |
{
|
|
109 |
case ESSSettingsAlsNotSupported:
|
|
110 |
aALSLine = RMobilePhone::EAlternateLineNotAvailable;
|
|
111 |
break;
|
|
112 |
case ESSSettingsAlsPrimary:
|
|
113 |
aALSLine = RMobilePhone::EAlternateLinePrimary;
|
|
114 |
break;
|
|
115 |
case ESSSettingsAlsAlternate:
|
|
116 |
aALSLine = RMobilePhone::EAlternateLineAuxiliary;
|
|
117 |
break;
|
|
118 |
default:
|
|
119 |
break;
|
|
120 |
}
|
|
121 |
} //GetALSLineL
|
|
122 |
|
|
123 |
// -----------------------------------------------------------------------------
|
|
124 |
// CPESettingsCommand::SetALSLineL
|
|
125 |
// Sends synchronous request to set the ALS line and returns handle to access
|
|
126 |
// the status.
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
void CPESettingsCommand::SetALSLineL(
|
|
130 |
RMobilePhone::TMobilePhoneALSLine& aALSLine )
|
|
131 |
{
|
|
132 |
TSSSettingsAlsValue alsValue =
|
|
133 |
static_cast<TSSSettingsAlsValue> ( aALSLine );
|
|
134 |
|
|
135 |
switch( aALSLine )
|
|
136 |
{
|
|
137 |
case RMobilePhone::EAlternateLineUnknown:
|
|
138 |
case RMobilePhone::EAlternateLineNotAvailable:
|
|
139 |
alsValue = ESSSettingsAlsNotSupported;
|
|
140 |
break;
|
|
141 |
case RMobilePhone::EAlternateLinePrimary:
|
|
142 |
alsValue = ESSSettingsAlsPrimary;
|
|
143 |
break;
|
|
144 |
case RMobilePhone::EAlternateLineAuxiliary:
|
|
145 |
alsValue = ESSSettingsAlsAlternate;
|
|
146 |
break;
|
|
147 |
default:
|
|
148 |
TEFLOGSTRING( KTAINT,
|
|
149 |
"PE CPESettingsCommand::SetALSLineL: Not valid value" );
|
|
150 |
__ASSERT_DEBUG( EFalse, Panic( EPEPanicInvalidRequest ) );
|
|
151 |
break;
|
|
152 |
}
|
|
153 |
User::LeaveIfError( iSSSettings.Set( ESSSettingsAls, alsValue ) );
|
|
154 |
}
|
|
155 |
|
|
156 |
// -----------------------------------------------------------------------------
|
|
157 |
// CPESettingsCommand::GetClirL
|
|
158 |
// Sends synchronous request to get the CLIR value and returns handle to access
|
|
159 |
// the status.
|
|
160 |
// -----------------------------------------------------------------------------
|
|
161 |
//
|
|
162 |
void CPESettingsCommand::GetClirL(
|
|
163 |
RMobileCall::TMobileCallIdRestriction& aClir )
|
|
164 |
{
|
|
165 |
TInt value;
|
|
166 |
User::LeaveIfError( iSSSettings.Get( ESSSettingsClir, value ) );
|
|
167 |
|
|
168 |
TSSSettingsClirValue clir =
|
|
169 |
static_cast<TSSSettingsClirValue> ( value );
|
|
170 |
TEFLOGSTRING2( KTAERROR,
|
|
171 |
"PE CPESettingsCommand::GetClirL, clir: %d", clir );
|
|
172 |
|
|
173 |
switch( clir )
|
|
174 |
{
|
|
175 |
case ESSSettingsClirNetworkDefault:
|
|
176 |
aClir = RMobileCall::EIdRestrictDefault;
|
|
177 |
break;
|
|
178 |
case ESSSettingsClirExplicitInvoke:
|
|
179 |
aClir = RMobileCall::EDontSendMyId;
|
|
180 |
break;
|
|
181 |
case ESSSettingsClirExplicitSuppress:
|
|
182 |
aClir = RMobileCall::ESendMyId;
|
|
183 |
break;
|
|
184 |
default:
|
|
185 |
TEFLOGSTRING2( KTAERROR,
|
|
186 |
"PE CPESettingsCommand::GetClirL, NOT VALID aClir: %d", aClir );
|
|
187 |
__ASSERT_DEBUG( EFalse, Panic( EPEPanicInvalidRequest ) );
|
|
188 |
break;
|
|
189 |
}
|
|
190 |
}
|
|
191 |
|
|
192 |
// -----------------------------------------------------------------------------
|
|
193 |
// CPESettingsCommand::GetCugL
|
|
194 |
// Sends synchronous request to get the CUG index and returns handle to access
|
|
195 |
// the status.
|
|
196 |
// -----------------------------------------------------------------------------
|
|
197 |
//
|
|
198 |
void CPESettingsCommand::GetCugL(
|
|
199 |
TInt aCugIndex )
|
|
200 |
{
|
|
201 |
TEFLOGSTRING2( KTAINT,
|
|
202 |
"PE CPESettingsCommand::GetCugL, aCugIndex: %d", aCugIndex );
|
|
203 |
User::LeaveIfError( iSSSettings.Get( ESSSettingsCug, aCugIndex ) );
|
|
204 |
}
|
|
205 |
|
|
206 |
// ---------------------------------------------------------
|
|
207 |
// CPESettingsCommand::PhoneSettingChanged
|
|
208 |
// ---------------------------------------------------------
|
|
209 |
//
|
|
210 |
void CPESettingsCommand::PhoneSettingChanged(
|
|
211 |
TSSSettingsSetting aSetting,
|
|
212 |
TInt aNewValue )
|
|
213 |
{
|
|
214 |
if ( aSetting == ESSSettingsAls )
|
|
215 |
{
|
|
216 |
TSSSettingsAlsValue alsValue =
|
|
217 |
static_cast< TSSSettingsAlsValue > ( aNewValue );
|
|
218 |
|
|
219 |
RMobilePhone::TMobilePhoneALSLine
|
|
220 |
alsLine( RMobilePhone::EAlternateLineUnknown );
|
|
221 |
|
|
222 |
switch( alsValue )
|
|
223 |
{
|
|
224 |
case ESSSettingsAlsNotSupported:
|
|
225 |
alsLine = RMobilePhone::EAlternateLineNotAvailable;
|
|
226 |
break;
|
|
227 |
case ESSSettingsAlsPrimary:
|
|
228 |
alsLine = RMobilePhone::EAlternateLinePrimary;
|
|
229 |
break;
|
|
230 |
case ESSSettingsAlsAlternate:
|
|
231 |
alsLine = RMobilePhone::EAlternateLineAuxiliary;
|
|
232 |
break;
|
|
233 |
default:
|
|
234 |
break;
|
|
235 |
}
|
|
236 |
iModel.DataStore()->SetALSLine( CCCECallParameters::TCCELineType( alsLine ) );
|
|
237 |
iModel.SendMessage( MEngineMonitor::EPEMessageALSLineChanged );
|
|
238 |
}
|
|
239 |
} // PhoneSettingChanged
|
|
240 |
|
|
241 |
// End of File
|