28
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: P&S property writer/reader
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "vccengpsproperty.h"
|
|
20 |
#include "rubydebug.h"
|
|
21 |
|
|
22 |
// ======== MEMBER FUNCTIONS ========
|
|
23 |
|
|
24 |
// ---------------------------------------------------------------------------
|
|
25 |
// Constructor
|
|
26 |
// ---------------------------------------------------------------------------
|
|
27 |
//
|
|
28 |
CVccEngPsProperty::CVccEngPsProperty()
|
|
29 |
{
|
|
30 |
RUBY_DEBUG_BLOCK( "CVccEngPsProperty::CVccEngPsProperty" );
|
|
31 |
}
|
|
32 |
|
|
33 |
// ---------------------------------------------------------------------------
|
|
34 |
// Destructor
|
|
35 |
// ---------------------------------------------------------------------------
|
|
36 |
//
|
|
37 |
CVccEngPsProperty::~CVccEngPsProperty()
|
|
38 |
{
|
|
39 |
RUBY_DEBUG0( "CVccEngPsProperty::~CVccEngPsProperty() - ENTER" );
|
|
40 |
iHoStatusKey.Close();
|
|
41 |
iErrorCodeKey.Close();
|
|
42 |
RUBY_DEBUG0( "CVccEngPsProperty::~CVccEngPsProperty() - EXIT" );
|
|
43 |
}
|
|
44 |
|
|
45 |
// ---------------------------------------------------------------------------
|
|
46 |
// 2nd phase constructor
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
void CVccEngPsProperty::ConstructL()
|
|
50 |
{
|
|
51 |
RUBY_DEBUG_BLOCKL( "CVccEngPsProperty::ConstructL" );
|
|
52 |
|
|
53 |
DefineKeysL();
|
|
54 |
CreateHandlesL();
|
|
55 |
}
|
|
56 |
|
|
57 |
// ---------------------------------------------------------------------------
|
|
58 |
// Symbian constructor
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
//
|
|
61 |
CVccEngPsProperty* CVccEngPsProperty::NewL()
|
|
62 |
{
|
|
63 |
RUBY_DEBUG_BLOCKL( "CVccEngPsProperty::NewL" );
|
|
64 |
|
|
65 |
CVccEngPsProperty* self = new ( ELeave ) CVccEngPsProperty();
|
|
66 |
CleanupStack::PushL( self );
|
|
67 |
self->ConstructL();
|
|
68 |
CleanupStack::Pop( self );
|
|
69 |
|
|
70 |
return self;
|
|
71 |
}
|
|
72 |
|
|
73 |
// ---------------------------------------------------------------------------
|
|
74 |
// Sets the value of a VCC property
|
|
75 |
// ---------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
void CVccEngPsProperty::NotifySubscriberL( TVccHoStatus aStatus,
|
|
78 |
TInt aErrorCode )
|
|
79 |
{
|
|
80 |
RUBY_DEBUG_BLOCKL( "CVccEngPsProperty::NotifySubscriberL" );
|
|
81 |
RUBY_DEBUG1( " -status = %d", aStatus );
|
|
82 |
RUBY_DEBUG1( " -errorcode = %d", aErrorCode);
|
|
83 |
|
|
84 |
switch( aStatus )
|
|
85 |
{
|
|
86 |
case EVccHoStateIdle:
|
|
87 |
case EVccCsToPsHoStarted:
|
|
88 |
case EVccPsToCsHoStarted:
|
|
89 |
case EVccCsToPsHoInprogress:
|
|
90 |
case EVccPsToCsHoInprogress:
|
|
91 |
case EVccCsToPsHoSuccessful:
|
|
92 |
case EVccCsToPsHoFailure:
|
|
93 |
case EVccHoUnavailable:
|
|
94 |
case EVccCsToPsNotAllowed:
|
|
95 |
case EVccPsToCsNotAllowed:
|
|
96 |
case EVccHoStateIdleIfSingleCall:
|
|
97 |
case EVccHoAllowedToCsIfSingleCall:
|
|
98 |
case EVccHoAllowedToPsIfSingleCall:
|
|
99 |
{
|
|
100 |
RUBY_DEBUG0( " -updating keys" );
|
|
101 |
|
|
102 |
User::LeaveIfError( iHoStatusKey.Set( aStatus ));
|
|
103 |
User::LeaveIfError( iErrorCodeKey.Set( aErrorCode ));
|
|
104 |
break;
|
|
105 |
}
|
|
106 |
case EVccHoStateUnknown:
|
|
107 |
default:
|
|
108 |
{
|
|
109 |
RUBY_DEBUG0( " -Error, unknown key!!" );
|
|
110 |
|
|
111 |
User::Leave( KErrNotFound );
|
|
112 |
break;
|
|
113 |
}
|
|
114 |
}
|
|
115 |
}
|
|
116 |
|
|
117 |
// ---------------------------------------------------------------------------
|
|
118 |
// Gets the Ho status property
|
|
119 |
// ---------------------------------------------------------------------------
|
|
120 |
//
|
|
121 |
TInt CVccEngPsProperty::GetCurrentHoStatus( TVccHoStatus& aStatus )
|
|
122 |
{
|
|
123 |
RUBY_DEBUG_BLOCK( "CVccEngPsProperty::GetCurrentHoStatus" );
|
|
124 |
|
|
125 |
TInt value ( EVccHoStateUnknown );
|
|
126 |
TInt err = iHoStatusKey.Get( value );
|
|
127 |
aStatus = ( TVccHoStatus ) value;
|
|
128 |
return err;
|
|
129 |
}
|
|
130 |
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
// Gets the error code
|
|
133 |
// ---------------------------------------------------------------------------
|
|
134 |
//
|
|
135 |
TInt CVccEngPsProperty::GetCurrentErrorCode( TInt& aErrorCode )
|
|
136 |
{
|
|
137 |
RUBY_DEBUG_BLOCK( "CVccEngPsProperty::GetCurrentErrorCode" );
|
|
138 |
|
|
139 |
TInt err = iErrorCodeKey.Get( aErrorCode );
|
|
140 |
return err;
|
|
141 |
}
|
|
142 |
|
|
143 |
// ---------------------------------------------------------------------------
|
|
144 |
// Defines the keys the UI can update
|
|
145 |
// ---------------------------------------------------------------------------
|
|
146 |
//
|
|
147 |
void CVccEngPsProperty::DefineKeysL()
|
|
148 |
{
|
|
149 |
RUBY_DEBUG_BLOCK( "CVccEngPsProperty::DefineKeysL" );
|
|
150 |
|
|
151 |
RProcess myProcess;
|
|
152 |
|
|
153 |
_LIT_SECURITY_POLICY_PASS(KPassReadPolicy);
|
|
154 |
_LIT_SECURITY_POLICY_S0( KAllowSidPolicy, myProcess.SecureId() );
|
|
155 |
|
|
156 |
TInt err = RProperty::Define( KPSVccPropertyCategory,
|
|
157 |
KVccPropKeyHoStatus,
|
|
158 |
RProperty::EInt,
|
|
159 |
KPassReadPolicy,
|
|
160 |
KAllowSidPolicy );
|
|
161 |
|
|
162 |
if ( err != KErrNone && err != KErrAlreadyExists )
|
|
163 |
{
|
|
164 |
User::Leave( err );
|
|
165 |
}
|
|
166 |
|
|
167 |
err = RProperty::Define( KPSVccPropertyCategory,
|
|
168 |
KVccPropKeyHoError,
|
|
169 |
RProperty::EInt,
|
|
170 |
KPassReadPolicy,
|
|
171 |
KAllowSidPolicy );
|
|
172 |
|
|
173 |
if ( err != KErrNone && err != KErrAlreadyExists )
|
|
174 |
{
|
|
175 |
User::Leave( err );
|
|
176 |
}
|
|
177 |
}
|
|
178 |
|
|
179 |
// ---------------------------------------------------------------------------
|
|
180 |
// Defines the keys the UI can update
|
|
181 |
// ---------------------------------------------------------------------------
|
|
182 |
//
|
|
183 |
void CVccEngPsProperty::CreateHandlesL()
|
|
184 |
{
|
|
185 |
RUBY_DEBUG_BLOCKL( "CVccEngPsProperty::CreateHandlesL" );
|
|
186 |
|
|
187 |
User::LeaveIfError( iHoStatusKey.Attach( KPSVccPropertyCategory,
|
|
188 |
KVccPropKeyHoStatus ));
|
|
189 |
User::LeaveIfError( iErrorCodeKey.Attach( KPSVccPropertyCategory,
|
|
190 |
KVccPropKeyHoError ));
|
|
191 |
}
|