Hi all,
I want to connect the device to a wifi iap already saved in the phone and then read the default gateway.
I have saw RConnection API. Are the correct API?
Is there an example to start?
Printable View
Hi all,
I want to connect the device to a wifi iap already saved in the phone and then read the default gateway.
I have saw RConnection API. Are the correct API?
Is there an example to start?
As you already have active thread for the problem, you should not start new ones, just explain the problem in it: [url]http://www.developer.nokia.com/Community/Discussion/showthread.php?237592-Problem-with-wlan-IAP[/url]
But this is another question
I suppose for default IAP, you could see: [url]http://www.developer.nokia.com/Community/Wiki/Default_iap[/url]
and checking all accesspoints, youcould see: [url]http://www.developer.nokia.com/Community/Wiki/Reading_internet_access_points_from_the_device[/url]
Hello,
sorry i didn't precisely understand what you were asking:
1. do you want to search for wi-fi iap stored on phone and then start a connection using them?
2. do you want to search for wi-fi iap stored on phone and read their settings (like default gateway)?
3. do you want to know if the phone is connected through wi-fi and then read settings?
then:
1 & 2. maybe something like this (taking into account only bearer wlan):
[url]http://www.developer.nokia.com/Community/Wiki/Reading_internet_access_points_from_the_device[/url]
or post #3 of
[url]http://www.developer.nokia.com/Community/Discussion/showthread.php?234705-getting-IAP-id-of-all-3g-gprs-options&highlight=[/url]
(again searching for wlan and not gprs):
and #3 of
[url]http://www.developer.nokia.com/Community/Discussion/showthread.php?232440-WLan-passive-usage&highlight=[/url]
3. yes, RConnectionMonitor is the right API to monitor phone connections, please see post #4 in [url]http://www.developer.nokia.com/Community/Discussion/showthread.php?238679-Couldn-t-setup-connection-for-http-post[/url] for some starting points... you can also look into rconnmon.h for attribute list (but at first glance i don't see anything related to default gateway...)
there's also a couple of links that could give you an idea about wi-fi scanning:
[url]http://www.developer.nokia.com/Community/Wiki/WLAN_Management_API[/url]
[url]http://www.developer.nokia.com/Community/Discussion/showthread.php?139791-WLAN-scanning[/url]
hope it helps somehow :-)
regards
pg
Thank you..
but I didn't find for start a connection to a wi-fi iap stored in the device and how disconnect from a wi-fi iap
[QUOTE=andrea993;909201]Thank you..
but I didn't find for start a connection to a wi-fi iap stored in the device and how disconnect from a wi-fi iap[/QUOTE]
hello,
* step 1, look for defined wlan iap:
[url]http://www.developer.nokia.com/Community/Wiki/Reading_internet_access_points_from_the_device[/url]
take the part starting more or less from:
[CODE]CCommsDbTableView* gprsTable = iCommsDB->OpenIAPTableViewMatchingBearerSetLC(
ECommDbBearerGPRS|ECommDbBearerWLAN|ECommDbBearerVirtual,
ECommDbConnectionDirectionOutgoing); [/CODE]
and filter using only ECommDbBearerWLAN
or, you can use CommsDat API
more info here:
[url]http://library.developer.nokia.com/index.jsp?topic=/S60_5th_Edition_Cpp_Developers_Library/GUID-35228542-8C95-4849-A73F-2B4F082F0C44/sdk/doc_source/guide/Communications-Infrastructure-subsystem-guide/commsdat/CommsDat%20API%20and%20Migration%20Guide.html[/url]
[url]http://www.symlab.org/wiki/index.php/Symbian_OS_Communications_Programming/6._IP_and_Related_Technologies[/url]
and something like this:
[CODE] CommsDat::CMDBSession *dbs = CMDBSession::NewLC(KCDLatestVersion);
// Counter for the iap we append
TInt prefIapCount = 0;
// Reset the IAP ID array
iIapArray.Reset();
if(iUseWiFi)
{
//let's search for "LANService" serviceType
//Create a record set
CMDBRecordSet<CCDIAPRecord>* wlanIapRecordSet = new (ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord);
CleanupStack::PushL(wlanIapRecordSet);
//To find all IAP records supporting LANService service
TPtrC lanServiceType(KCDTypeNameLANService);
//To prime for a search, create a record with the priming fields and append it to the Recordset
CCDIAPRecord* ptrPrimingRecord = static_cast<CCDIAPRecord *>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
ptrPrimingRecord->iServiceType.SetMaxLengthL(lanServiceType.Length());
ptrPrimingRecord->iServiceType = lanServiceType;
wlanIapRecordSet->iRecords.AppendL(ptrPrimingRecord);
ptrPrimingRecord=NULL; //since ownership is been passed to the recordset
//Search
if(wlanIapRecordSet->FindL(*dbs))
{
//The iapRecordSet->iRecords.Count() will now reflect the number of records found
TInt wlanIapRecordsFound = wlanIapRecordSet->iRecords.Count();
for(TInt8 i=0; i<wlanIapRecordsFound; i++)
{
CCDIAPRecord* singleIapRecord = static_cast<CCDIAPRecord*>( wlanIapRecordSet->iRecords[i]);
RBuf iapName;
iapName.CreateL(singleIapRecord->iRecordName);
iapName.CleanupClosePushL();
if(iapName.Compare(_L("IPDC"))==0 || iapName.Compare(_L("Easy WLAN"))==0 || iapName.Compare(_L("Search for WLAN"))==0)
{
;// do nothing, it's not valid wlan ap
}
else
{
// it's a valid wlan ap, append it
prefIapCount = ++prefIapCount;
iIapArray.Insert(singleIapRecord->RecordId(),0);
}
CleanupStack::PopAndDestroy(); // iapName
}
}
else
{
// No records found..but iRecords[0] is still present (though will only
//contain the priming values), so its important to check for the return code
}
CleanupStack::PopAndDestroy(1); //wlanIapRecordSet
}
[/CODE]
you should now have a list of configured access points id
* step 2, connect through the iap, use RConnection::Start(TConnPref& aPref) as documented in:
[url]http://www.symlab.org/main/documentation/reference/s3/pdk/GUID-D24D5F17-462E-5424-99A7-9B16E9FEDC93.html[/url]
[url]http://www.symlab.org/main/documentation/reference/s3/pdk/GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD.html[/url]
loop through the list until you find one that connects with no errors
* step 4, close connection using RConnection::Close()
If you want to use a specific connection for HTTP traffic, this is the link:
[url]http://www.developer.nokia.com/Community/Wiki/CS000825_-_Using_an_already_active_connection[/url]
regards,
pg
Thank you :) I solved.
And is possilbe to connect the device to a wi-fi network without make an iap first?
[QUOTE=andrea993;909425]
And is possilbe to connect the device to a wi-fi network without make an iap first?[/QUOTE]
never found an easy way.... but i admit i've never been enough motivated to search for it into symbian sources... IAPs seem just an aggregation of ntw info, maybe in some layers below you can get rid of them (provided that you can isolate code/libs and obtain capabilities) ...
In the pdk I've found "wlmserver.cpp".
The problem is that to close a connection I should use RConnection::Stop() (RConnection::Close() doesn't work) but it need NetworkControl capability. So I'm looking for a way to make a temporary connection to a wlan network (start and stop connection) without use NetworkControl.
I admit I have not checked all the links in this discussion, but the related IAP configuration articles I remember about are [url]http://www.developer.nokia.com/Community/Wiki/WLAN_access_point_configuration_using_CommsDat_API[/url], [url]http://www.developer.nokia.com/Community/Wiki/How_to_create_access_points[/url] and [url]http://www.developer.nokia.com/Community/Wiki/Archived:How_can_I_create_a_WLAN_access_point_and_automatically_connect_to_it%3F[/url]
For the capability stuff:
- NetworkServices is "free", you can even self-sign it. It is required for doing any communication, including connection to an IAP
- NetworkControl is the strong one, it is required for RConnection::Stop for example. However that particular method you do not really need, as an unused IAP (RConnection::Close) is expected to stop after a while, depending on device settings. NetworkControl is "strong" because it can kill a connection even if an other application would use it, so RConnection::Stop is not a friendly move in general
- CommDD would be a capability needed if you want to access the WLAN driver without configuring an IAP, but that is certainly some arcane thing, you would need to get documentation directly from Nokia (drivers for actual hardware are not present in the ex-open sourced code). It is also a high level capability anyway.
- I have not really checked, but for working with IAP configuration, Write/ReadDeviceData are probably enough, which are accessible with a devcert.
It is true that you will not be able to remove the "temporary" IAP configuration, since it is going to be remain used for a while after a simple RConnection::Close.
By the way, the super-old CAp* API set may still work (though it is marked as deprecated for several platform releases), [url]http://www.developer.nokia.com/Community/Wiki/Creating,_deleting,_editing,_and_listing_WLAN_access_points_using_Symbian_C%2B%2B[/url] summarizes some use of it.
To make an iap and connect the device to it I've not any problem.
But after, if I want disconnect the device from the iap I can't use RConnection::Close because as soon I connect to it others applications start to use it also if I don't want (I think it because Close doesn't work) and RConnection::Stop require NetworkControl.
Is there a way to start a private connection that only my application can use, where I can start and stop the connection without NetworkControl?
[QUOTE=andrea993;909479]
But after, if I want disconnect the device from the iap I can't use RConnection::Close because as soon I connect to it others applications start to use it also if I don't want[/QUOTE]
This is not nice, i would take a deeper look into those apps ;-) Or change their settings if possible.
[QUOTE=andrea993;909479] (I think it because Close doesn't work) and RConnection::Stop require NetworkControl.[/QUOTE]
As Wizard already mentioned, Close() is nicer than Stop(): Close() closes the connection if no one else (no other app) is using it, Stop() forces a brutal disconnection for all, that's why it requires higher caps.
[QUOTE=andrea993;909479] Is there a way to start a private connection that only my application can use, where I can start and stop the connection without NetworkControl?[/QUOTE]
hmmm... while looking at these things sometime ago, i found that somewhere into iap database there's a field that let's you specify the id of the app that can use the IAP.... but it wasn't my need so i didn't test it..... if i can find the link again i'll post it
[QUOTE=pavarang;909496]
hmmm... while looking at these things sometime ago, i found that somewhere into iap database there's a field that let's you specify the id of the app that can use the IAP.... but it wasn't my need so i didn't test it..... if i can find the link again i'll post it[/QUOTE]
Excellent!!
Maybe is this: IAP_APPSID?
[QUOTE=andrea993;909499]Excellent!!
Maybe is this: IAP_APPSID?[/QUOTE]
Yes! I've put it into my OpenGrok but i couldn't find any useful example, maybe it's not even taken into consideration by connection manager....
but you could try.. just write into it the sid of your app and see what happens when you try to use it from your app and from another app (web browser for example)
good luck :-)