Enumerating configured WiFi network connections

D

David Clegg

I am attempting to add logic to our app so we can monitor for, and use
a WiFi connection, if one becomes available. This is relatively easy to
do using the OpenNETCF.Net.Adapter and OpenNETCF.Net.AccessPoint
classes (BTW, you OpenNETCF.Org guys rock!). However, using
Adapter.NearbyAccessPoints returns all found access points, but I want
to be able to consider only access points that have already been
configured on the device.

What I think I need is a way to enumerate through the items in the
'Configure Wireless Networks' dialog, and to return their SSIDs. I can
enumerate through the connections using the
OpenNETCF.Net.ConnectionManager.EnumDestinations class, but the
DestinationInfo instances contained in the collection don't have access
to the SSID as far as I can tell. Is there an easy way to get this
information?

--
Cheers,
David Clegg
(e-mail address removed)

Vote 1 http://cc.borland.com/codecentral/ccweb.exe/listing?id=21489 :)
Now supports Google Groups searching with Dyna-extend(tm) technology!

QualityCentral. The best way to bug Borland about bugs.
http://qc.borland.com

"I know I'm not usually a praying man, but if you're up there, please
Superman, help me!" - Homer Simpson
 
P

Paul G. Tobey [eMVP]

I don't think that there's going to be a right answer, unless you can find
something in the Connection Manager API (native), that you can then port
over to managed code. Remember, also, that the Connection Manager doesn't
exist on every Windows CE device.

The preferred list of connections might be what you're after. WZC does
return that in several calls that the .Net namespace components are making.
I'll have to look at how best to extract the list...

Paul T.
 
P

Paul G. Tobey [eMVP]

I've added the ability to get, not just NearbyAccessPoints, but also
PreferredAccessPoints in OpenNETCF.Net. There is also a sample that does
this (called RFUtilsCSharp). You'll need to get the changed files via
Vault, as well as the sample, if you want it.

Paul T.
 
D

David Clegg

Paul said:
I've added the ability to get, not just NearbyAccessPoints, but also
PreferredAccessPoints in OpenNETCF.Net. There is also a sample that
does this (called RFUtilsCSharp). You'll need to get the changed
files via Vault, as well as the sample, if you want it.

Thanks a bunch, Paul. I'll check this out.

--
Cheers,
David Clegg
(e-mail address removed)

Vote 1 http://cc.borland.com/codecentral/ccweb.exe/listing?id=21489 :)
Now supports Google Groups searching with Dyna-extend(tm) technology!

QualityCentral. The best way to bug Borland about bugs.
http://qc.borland.com

"If the Bible has taught us nothing else, and it hasn't, its that girls
should stick to girl's sports, such as hot oil wrestling foxy boxy and
such and such" - Homer Simpson
 
D

David Clegg

Paul said:
I've added the ability to get, not just NearbyAccessPoints, but also
PreferredAccessPoints in OpenNETCF.Net. There is also a sample that
does this (called RFUtilsCSharp). You'll need to get the changed
files via Vault, as well as the sample, if you want it.

I've tried to use this new PreferredAccessPoints property and, while
the AccessPointCollection appears to have the correct number of
AccessPoint instances, all the properties of each AccessPoint instance
have the same value.

The access point details that are duplicated is not always the same.
I'm not sure of the exact pattern here (still investigating), but I
suspect it may be the details of the last discovered access point.

I'll try to debug this a bit further, but may have to leave it for now
in order to move onto something else (tight deadlines etc). If I do
find some more clues, I'll post back here.

--
Cheers,
David Clegg
(e-mail address removed)

Vote 1 http://cc.borland.com/codecentral/ccweb.exe/listing?id=21489 :)
Now supports Google Groups searching with Dyna-extend(tm) technology!

QualityCentral. The best way to bug Borland about bugs.
http://qc.borland.com

"I am so smart, I am so smart, s-m-r-t ." - Homer Simpson
 
P

Paul G. Tobey [eMVP]

I believe that the data is from the current connection, if any. That's just
the way the data comes back from WZC. Once you know what the name of the AP
is, you can use the regular Nearby... list to get the data on it.

Paul T.
 
P

Paul G. Tobey [eMVP]

I've added another property to the Adapter class,
NearbyPreferredAccessPoints, which returns those APs which are in the
preferred list *and* which are within range. For those, the signal strength
is updated to the current strength. If you use PreferredAccessPoints,
you'll still get the signal strength value from when the AP was put on the
preferred list, not the current strength. I've also updated the sample to
show nearby preferred APs.

Paul T.
 
V

Vincnet

I also got always the same prefered device, but the count was good...

I step into code an fix the error:
c = c.Item( 0 ); should be "i"

internal unsafe void RefreshListPreferred( bool nearbyOnly )
{

// Step through the list and add a new AP to the
// collection for each entry.
for ( int i = 0; i < cl.NumberOfItems; i++ )
{
WZC_WLAN_CONFIG c = cl.Item( i );
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top