The RConnectionServ API has to be accessed through the Sockets Server client API, so you need to ensure that esock.lib is included in the MMP file.
The RConnectionServ::AccessPointStatusQuery() function retrieves information about the properties of one or more Access Points from the attached Tier specified earlier using the previous Connect() function.
RConnectionServ::AccessPointStatusQuery(const CConnectionServParameterBundle& aQuery, CConnectionServParameterBundle& aResult, TRequestStatus& aStatus)
The parameter aQuery is an ‘In’ parameter. It is created and deleted by the caller, CConnectionServParameterBundle , of this function. The parameter will be deleted after completing the Access Point status query. The parameter contains structured data types in CConnectionServParameterSetContainers and XParameterSet -derived types. These data types specify the group of Access Points to be returned and the information about the Access Points to be queried.
The parameter aResult is an ‘Out’ parameter. It is created and deleted by the caller, CConnectionServParameterBundle , of this function. The parameter will be deleted after completing the Access Point status query.
The time taken to complete the query depends on the implementation of the Tiers Manager stack plug-in that serves the request. It is an asynchronous request. There can only be one outstanding query at a time. Further queries before completion of an outstanding query result in KErrInUse .
RConnectionServ::CancelAccessPointStatusQuery()
This function cancels the current Access Point status query.
The following example shows how to find information about all the Access Points that are known to the device.
// Start the session as mentioned in starting a session // Create bundle (This bundle is owned by this class so the destructor of this class // must delete the bundle) iQueryBundle = CConnectionServParameterBundle::NewL(); // Set up the filter for our query TAccessPointStatusFilter availFilter; // a) We want to match against this attribute availFilter.Configured(EAccessPointFlagMatchTrue); // b) Don’t even try to find these things out as we’re not interested at present availFilter.Restricted(EAccessPointFlagIgnore); availFilter.Available(EAccessPointFlagIgnore); availFilter.Started(EAccessPointFlagIgnore); // Call helper function to create query structure iQueryBundle->AddMatchConditionL(availFilter); // Call helper function to specify what we want to get for each Access Point iQueryBundle->AddParameterSetToReturnL(XAccessPointGenericParameterSet::TypeId()); // Create container for result iStatusBundle = CConnectionServParameterBundle::NewL(); // Make call- the iStatus is a TRequestStatus owned by your active object iConnServ.AccessPointStatusQuery(*iQueryBundle, *iStatusBundle, iStatus);
At this point, a return to the Active Scheduler is necessary because the query uses active objects. So the passed in TRequestStatus functions are not completed until those active objects have run.
The RunL() of the active object runs on completion of the AccessPointStatusQuery() call, as shown below:
/*virtual*/ void CMyActiveObjectClass::RunL() { // Some function to handle errors MyErrorHandler(iStatus.Int()); // Process results CConnectionServParameterSetContainer* parSetCtr; TInt i=0; while(parSetCtr = iStatusBundle->GetParamSetContainer(i++)) { XAccessPointGenericParameterSet* genParamSet = XAccessPointGenericParameterSet::FindInParamSetContainer(parSetCtr); if(!genParamSet) continue; TUint apId = genParamSet->AccessPointInfo().AccessPoint(); TAccessPointStatus apStatus = genParamSet->AccessPointStatus(); // Your function to process result ProcessResult(apId,apStatus); } } // Later, in the destructor of this class, the bundles must be deleted delete iQueryBundle; delete iStatusBundle;
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.