140 // |
140 // |
141 void CCCHSPSHandler::GetServiceInfoL( const TUint32 aServiceId, |
141 void CCCHSPSHandler::GetServiceInfoL( const TUint32 aServiceId, |
142 TCCHService& aService ) const |
142 TCCHService& aService ) const |
143 { |
143 { |
144 CCHLOGSTRING( "CCCHSPSHandler::GetServiceInfoL: IN" ); |
144 CCHLOGSTRING( "CCCHSPSHandler::GetServiceInfoL: IN" ); |
|
145 |
|
146 aService.iSubservices.Reset(); |
|
147 |
|
148 // Get entry |
145 TInt err( KErrNone ); |
149 TInt err( KErrNone ); |
146 // Get entry |
|
147 CSPEntry* entry = CSPEntry::NewLC(); |
150 CSPEntry* entry = CSPEntry::NewLC(); |
148 err = iSettings->FindEntryL( aServiceId, *entry ); |
151 err = iSettings->FindEntryL( aServiceId, *entry ); |
149 CCHLOGSTRING2( "iSettings->FindEntryL err: %d", err ); |
152 |
150 if ( KErrNone == err ) |
153 if ( KErrNone == err ) |
151 { |
154 { |
152 // Read service id and service name |
155 // Read service id and service name |
153 aService.iServiceId = aServiceId; |
156 aService.iServiceId = aServiceId; |
154 RBuf buf; |
157 RBuf buf; |
155 buf.Create( entry->GetServiceName(), KCCHMaxServiceNameLength ); |
158 CleanupClosePushL( buf ); |
|
159 buf.CreateL( entry->GetServiceName(), KCCHMaxServiceNameLength ); |
156 aService.iServiceName.Copy( buf ); |
160 aService.iServiceName.Copy( buf ); |
157 buf.Close(); |
161 CleanupStack::PopAndDestroy( &buf ); |
158 |
162 |
159 // get all service properties a.k.a subservices |
163 // Check which subservices are supported |
160 RPropertyArray properties; |
164 RPropertyNameArray propertyNameArray; |
161 properties = entry->GetAllProperties(); |
165 CleanupClosePushL( propertyNameArray ); |
162 |
166 propertyNameArray.AppendL( EPropertyVoIPSubServicePluginId ); |
163 TServicePropertyName propertyName; |
167 propertyNameArray.AppendL( EPropertyPresenceSubServicePluginId ); |
164 TUint count( 0 ); |
168 propertyNameArray.AppendL( EPropertyIMSubServicePluginId ); |
165 TInt pServiceId( 0 ); |
169 propertyNameArray.AppendL( EPropertyVMBXSubServicePluginId ); |
166 TInt pSnap( 0 ); |
170 |
167 TInt pIap( 0 ); |
171 for ( TInt i( 0 ) ; i < propertyNameArray.Count() ; i++ ) |
168 TBool pSnapLocked( EFalse ); |
172 { |
169 |
173 CSPProperty* property = CSPProperty::NewLC(); |
170 for ( TInt i( 0 ); i < properties.Count() && |
174 |
171 count < KCCHMaxSubservicesCount; i++ ) |
175 err = iSettings->FindPropertyL( |
172 { |
176 aServiceId, |
173 propertyName = properties[ i ]->GetName(); |
177 propertyNameArray[ i ], |
174 |
178 *property ); |
175 // Check is subservice valid |
179 |
176 TBool valid( EFalse ); |
180 if ( !err && ValidSubserviceL( aServiceId, propertyNameArray[ i ] ) ) |
177 TRAPD( error, valid = ValidSubserviceL( aServiceId, propertyName ) ); |
|
178 if ( KErrNone == error && valid ) |
|
179 { |
181 { |
180 aService.iSubservices[ count ].iConnectionInfo.iServiceSelection.iType = |
182 TCCHSubserviceType type = ECCHUnknown; |
181 propertyName == |
183 switch ( propertyNameArray[ i ] ) |
182 EPropertyVoIPSubServicePluginId ? ECCHVoIPSub : |
184 { |
183 propertyName == |
185 case EPropertyVoIPSubServicePluginId: |
184 EPropertyPresenceSubServicePluginId ? ECCHPresenceSub : |
186 { |
185 propertyName == |
187 type = ECCHVoIPSub; |
186 EPropertyIMSubServicePluginId ? ECCHIMSub : |
188 } |
187 propertyName == |
189 break; |
188 EPropertyVMBXSubServicePluginId ? ECCHVMBxSub : |
190 case EPropertyPresenceSubServicePluginId: |
189 ECCHUnknown; |
191 { |
|
192 type = ECCHPresenceSub; |
|
193 } |
|
194 break; |
|
195 case EPropertyIMSubServicePluginId: |
|
196 { |
|
197 type = ECCHIMSub; |
|
198 } |
|
199 break; |
|
200 case EPropertyVMBXSubServicePluginId: |
|
201 { |
|
202 type = ECCHVMBxSub; |
|
203 } |
|
204 break; |
|
205 default: |
|
206 { |
|
207 type = ECCHUnknown; |
|
208 break; |
|
209 } |
|
210 } |
|
211 |
|
212 CCHLOGSTRING2( "CCCHSPSHandler::GetServiceInfoL: subservice type=%d", type ); |
190 |
213 |
191 if ( ECCHUnknown != aService.iSubservices[ count ].iConnectionInfo.iServiceSelection.iType ) |
214 aService.iSubservices[ i ].iConnectionInfo.iServiceSelection.iType = type; |
192 { |
215 aService.iSubservices[ i ].iConnectionInfo.iServiceSelection.iServiceId = aServiceId; |
193 aService.iSubservices[ count ].iConnectionInfo.iServiceSelection.iServiceId = aServiceId; |
216 |
194 aService.iSubservices[ count ].iState = ECCHUninitialized; |
217 // These are just initialized here. Correct values are got from connectivity plugin |
195 |
218 aService.iSubservices[ i ].iState = ECCHUninitialized; |
196 GetSettingsIdL( aServiceId, |
219 aService.iSubservices[ i ].iSubserviceId = KErrNone; |
197 aService.iSubservices[ count ].iConnectionInfo.iServiceSelection.iType, |
220 aService.iSubservices[ i ].iConnectionInfo.iSNAPId = KErrNone; |
198 pServiceId ); |
221 aService.iSubservices[ i ].iConnectionInfo.iIapId = KErrNone; |
199 aService.iSubservices[ count ].iSubserviceId = |
222 aService.iSubservices[ i ].iConnectionInfo.iSNAPLocked = EFalse; |
200 static_cast<TUint> ( pServiceId ); |
|
201 |
|
202 GetSNAPIdL( aServiceId, |
|
203 aService.iSubservices[ count ].iConnectionInfo.iServiceSelection.iType, |
|
204 pSnap ); |
|
205 aService.iSubservices[ count ].iConnectionInfo.iSNAPId = |
|
206 static_cast<TUint32> ( pSnap ); |
|
207 |
|
208 GetSNAPIdL( aServiceId, |
|
209 aService.iSubservices[ count ].iConnectionInfo.iServiceSelection.iType, |
|
210 pSnapLocked ); |
|
211 aService.iSubservices[ count ].iConnectionInfo.iSNAPLocked = |
|
212 static_cast<TUint32> ( pSnapLocked ); |
|
213 |
|
214 GetIapIdL( aServiceId, |
|
215 aService.iSubservices[ count ].iConnectionInfo.iServiceSelection.iType, |
|
216 pIap ); |
|
217 aService.iSubservices[ count ].iConnectionInfo.iIapId = |
|
218 static_cast<TUint32> ( pIap ); |
|
219 |
|
220 count++; |
|
221 } |
|
222 } |
223 } |
223 } |
224 |
224 } |
225 CleanupStack::PopAndDestroy( property ); |
|
226 } |
|
227 |
|
228 CleanupStack::PopAndDestroy( &propertyNameArray ); |
|
229 } |
225 else |
230 else |
226 { |
231 { |
|
232 CCHLOGSTRING2( "CCCHSPSHandler::GetServiceInfoL: error getting entry err=%d", err ); |
227 User::Leave( err ); |
233 User::Leave( err ); |
228 } |
234 } |
229 |
235 |
230 CleanupStack::PopAndDestroy( entry ); |
236 CleanupStack::PopAndDestroy( entry ); |
231 |
237 |
299 } |
305 } |
300 |
306 |
301 CCHLOGSTRING2( |
307 CCHLOGSTRING2( |
302 "CCCHSPSHandler::GetConnectivityPluginUidL: aUid 0x%X", aUid ); |
308 "CCCHSPSHandler::GetConnectivityPluginUidL: aUid 0x%X", aUid ); |
303 } |
309 } |
304 |
|
305 // --------------------------------------------------------------------------- |
|
306 // CCCHSPSHandler::GetSNAPIdL |
|
307 // (other items were commented in a header). |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 void CCCHSPSHandler::GetSNAPIdL( TUint32 aServiceId, |
|
311 TCCHSubserviceType aType, |
|
312 TInt& aSNAPId ) const |
|
313 { |
|
314 CCHLOGSTRING( "CCCHSPSHandler::GetSNAPIdL: IN" ); |
|
315 CCHLOGSTRING2( "CCCHSPSHandler::GetSNAPIdL: aServiceId %d", aServiceId ); |
|
316 CCHLOGSTRING2( "CCCHSPSHandler::GetSNAPIdL: aType %d", aType ); |
|
317 |
|
318 TSPItemType propertyType( EItemTypeNotDefined ); |
|
319 TServicePropertyName propertyName( EPropertyUnknown ); |
|
320 RPropertyArray subproperties; |
|
321 CleanupClosePushL( subproperties ); |
|
322 |
|
323 ChangeToPropertyStyleL( aType, propertyType, propertyName ); |
|
324 |
|
325 // Find correct subservice |
|
326 TInt err( iSettings->FindSubServicePropertiesL( |
|
327 aServiceId, propertyType, subproperties ) ); |
|
328 CCHLOGSTRING2( "CCH: iSettings->FindSubServicePropertiesL err: %d" , err ); |
|
329 for ( TInt i( 0 ); i < subproperties.Count(); i++ ) |
|
330 { |
|
331 // Read subservice's SNAP Id |
|
332 if ( propertyName == subproperties[ i ]->GetName() ) |
|
333 { |
|
334 subproperties[ i ]->GetValue( aSNAPId ); |
|
335 i = subproperties.Count(); |
|
336 } |
|
337 } |
|
338 |
|
339 subproperties.ResetAndDestroy( ); |
|
340 CleanupStack::PopAndDestroy( &subproperties ); |
|
341 CCHLOGSTRING2( "CCCHSPSHandler::GetSNAPIdL: aSNAPId %d", aSNAPId ); |
|
342 } |
|
343 |
|
344 // --------------------------------------------------------------------------- |
|
345 // CCCHSPSHandler::GetIapIdL |
|
346 // (other items were commented in a header). |
|
347 // --------------------------------------------------------------------------- |
|
348 // |
|
349 void CCCHSPSHandler::GetIapIdL( TUint32 aServiceId, |
|
350 TCCHSubserviceType aType, |
|
351 TInt& aIapId ) const |
|
352 { |
|
353 CCHLOGSTRING( "CCCHSPSHandler::GetIapIdL: IN" ); |
|
354 CCHLOGSTRING2( "CCCHSPSHandler::GetIapIdL: aServiceId %d", aServiceId ); |
|
355 CCHLOGSTRING2( "CCCHSPSHandler::GetIapIdL: aType %d", aType ); |
|
356 |
|
357 TSPItemType propertyType( EItemTypeNotDefined ); |
|
358 TServicePropertyName propertyName( EPropertyUnknown ); |
|
359 RPropertyArray subproperties; |
|
360 CleanupClosePushL( subproperties ); |
|
361 |
|
362 ChangeToPropertyStyleL( aType, propertyType, propertyName ); |
|
363 |
|
364 // Find correct subservice |
|
365 TInt err( iSettings->FindSubServicePropertiesL( |
|
366 aServiceId, propertyType, subproperties ) ); |
|
367 CCHLOGSTRING2( "CCH: iSettings->FindSubServicePropertiesL err: %d" , err ); |
|
368 for ( TInt i( 0 ); i < subproperties.Count(); i++ ) |
|
369 { |
|
370 // Read subservice's IAP Id |
|
371 if ( propertyName == subproperties[ i ]->GetName() ) |
|
372 { |
|
373 subproperties[ i ]->GetValue( aIapId ); |
|
374 i = subproperties.Count(); |
|
375 } |
|
376 } |
|
377 |
|
378 subproperties.ResetAndDestroy( ); |
|
379 CleanupStack::PopAndDestroy( &subproperties ); |
|
380 CCHLOGSTRING2( "CCCHSPSHandler::GetIapIdL: aIapId %d", aIapId ); |
|
381 } |
|
382 |
|
383 // --------------------------------------------------------------------------- |
|
384 // CCCHSPSHandler::GetSettingsIdL |
|
385 // (other items were commented in a header). |
|
386 // --------------------------------------------------------------------------- |
|
387 // |
|
388 void CCCHSPSHandler::GetSettingsIdL( TUint32 aServiceId, |
|
389 TCCHSubserviceType aType, |
|
390 TInt& aId ) const |
|
391 { |
|
392 TSPItemType propertyType( EItemTypeNotDefined ); |
|
393 TServicePropertyName propertyName( EPropertyUnknown ); |
|
394 RPropertyArray subproperties; |
|
395 CleanupClosePushL( subproperties ); |
|
396 |
|
397 ChangeToPropertyStyleL( aType, propertyType, propertyName ); |
|
398 |
|
399 // Find correct subservice |
|
400 TInt err( iSettings->FindSubServicePropertiesL( |
|
401 aServiceId, propertyType, subproperties ) ); |
|
402 CCHLOGSTRING2( "CCH: iSettings->FindSubServicePropertiesL err: %d" , err ); |
|
403 for ( TInt i( 0 ); i < subproperties.Count(); i++ ) |
|
404 { |
|
405 // Read subservice's Id |
|
406 if ( propertyName == subproperties[ i ]->GetName() ) |
|
407 { |
|
408 TInt id( 0 ); |
|
409 subproperties[ i ]->GetValue( id ); |
|
410 aId = id; |
|
411 i = subproperties.Count(); |
|
412 } |
|
413 } |
|
414 |
|
415 subproperties.ResetAndDestroy( ); |
|
416 CleanupStack::PopAndDestroy( &subproperties ); |
|
417 } |
|
418 |
310 |
419 // --------------------------------------------------------------------------- |
311 // --------------------------------------------------------------------------- |
420 // CCCHSPSHandler::LoadAtStartUpL |
312 // CCCHSPSHandler::LoadAtStartUpL |
421 // (other items were commented in a header). |
313 // (other items were commented in a header). |
422 // --------------------------------------------------------------------------- |
314 // --------------------------------------------------------------------------- |
423 // |
315 // |
424 void CCCHSPSHandler::LoadAtStartUpL( TUint32 aServiceId, |
316 void CCCHSPSHandler::LoadAtStartUpL( TUint32 aServiceId, |
425 TCCHSubserviceType aType, |
317 TCCHSubserviceType aType, |
426 TBool& aEnabled ) const |
318 TBool& aEnabled ) const |
427 { |
319 { |
|
320 CCHLOGSTRING2( "CCCHSPSHandler::LoadAtStartUpL: aType %d", aType ); |
|
321 |
428 |
322 |
429 TSPItemType propertyType( EItemTypeNotDefined ); |
323 TSPItemType propertyType( EItemTypeNotDefined ); |
430 TServicePropertyName propertyName( EPropertyUnknown ); |
324 TServicePropertyName propertyName( EPropertyUnknown ); |
431 RPropertyArray subproperties; |
325 RPropertyArray subproperties; |
432 CleanupClosePushL( subproperties ); |
326 CleanupClosePushL( subproperties ); |