|
|
User login
Feeds |
WiFi APIs?
|
|||||
| Tue, 2005-03-01 13:32 | |
Forum posts: 124
Forum posts: 124
Forum posts: 3
Forum posts: 13
As far as I can tell, there are no docs on using WiFi. There are some mentions of it. But everyone who might know is being quiet.
Here's what I have figured out. See the bottom why this code is just
wrong.
(1) You need an active connection first. For example, "Easy WLAN" is
always present. Find it in the IAP database and make a connection:
RConnection connection;
TCommDbConnPref pref;
CCommsDatabase *db;
CCommsDbTableView *view;
RSocketServ server;
RConnectionMonitor monitor;
db = CCommsDatabase::NewL(EDatabaseTypeIAP);
view = db->OpenViewLC(_L("IAP"),
_L("SELECT * FROM IAP WHERE NAME = 'Easy WLAN'"));
result = view->GotoFirstRecord();
if (result == KErrNone) {
view->ReadUintL(_L("Id"), easy_wlan_id);
} else {
// flag error and return
}
CleanupStack::PopAndDestroy(); //view
delete view;
delete db;
server.Connect();
monitor.ConnectL();
connection.Open(server);
connection.EnumerateConnections(conncount);
if (conncount == 0) {
if (result == KErrNone) {
pref.SetIapId(easy_wlan_id);
pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
pref.SetDirection(ECommDbConnectionDirectionOutgoing);
connection.Start(pref, status);
User::WaitForRequest(status);
}
}
(2) Use the active connection to find information about networks:
monitor.GetConnectionInfo(1, connid, sCount);
monitor.GetPckgAttribute( connid, 0, KNetworkNames, netnames, status );
User::WaitForRequest( status ) ;
for (i=0; i<netnames().iCount; i++) {
// AT THIS POINT, you can do something with
// netnames().iNetwork[i].iName and
// netnames().iNetwork[i].iSignalStrength
}
THe problem is that an actual connection is made. The WLAN interface is
actually activated. The built-in monitor does not do this and this should not
be the way it works.
There is a wireless network server, but I can't find any way to connect to
it. I suspect that that is how we should be working with wireless network
detection and manipulation.
If anyone else has clues....please correct the code above and add to our
knowledge base. This is really frustrating.
- F
Forum posts: 1
I made some modification and found a way to get the available Wifi network:
TRequestStatus status;
TBuf<128> mes;
TInt i;
TPckgBuf<TConnMonNetworkNames> pkgNetworks;
iMonitor.GetPckgAttribute(EBearerIdWLAN, 0, KNetworkNames,pkgNetworks, status);
User::WaitForRequest( status ) ;
User::LeaveIfError(status.Int());
mes.Format(_L("%d"), pkgNetworks().iCount);
CEikonEnv::Static()->InfoWinL(_L("pkgNetworks:"),mes );
for (i=0; i<pkgNetworks().iCount; i++)
{
// AT THIS POINT, you can do something with iName and iSignalStrength
TBuf<128> name;
name.Copy(pkgNetworks().iNetwork[i].iName);
CEikonEnv::Static()->InfoWinL(_L("network:"),name );
}
This work fine on N80 device