views:

1824

answers:

1

The title kinda sums it up--I need to be able to pro grammatically connect to a known access point (the SSID and credentials will be loaded during device provisioning). I understand that both the Compact Framework SDK and the OpenNETCF SDK offer some helper methods, but I can't seem to find a good tutorial on how to use them.

+1  A: 

OpenNETCF's Smart Device Framework is probably the simplest mechanism to do this. The chanllenge with wireless is that the radio OEM (whether is was the device oem or not) can choose any number of ways to advertise the interface. Maybe as a plain NDIS device with proprietary controls (a real pain to interface with) or at the other end using Wireless Zero Config (WZC). The SDF tries to handle any scenario, providing more and more capability depending on what the hardware interface advertises.

So, if you want to add a preferred network using a WZC-enabled interface (really the only way to connect is for the network to be in the preferred list) and that netowork is open (not WEP, WPA, etc), it's a pretty simple task. In fact WPA and even TKIP are pretty straightforward. You simply call AddPreferredNetwork. So you'd call NetworkInterface.GetAllNetworkInterfaces, then iterate the result (or filter with LINQ) to get an adapter that is of the WirelessZeroConfigNetworkInterface type (yes, long name) and then call AddPreferredNetwork on that with your SSID and any added info like the key material.

Of course you can do all of this without the SDF as well - the amount of work required through P/Invoke is just a lot higher. But it's still all "documented" in some form. Most of what we did was a "translation" of the network dialog in Windows CE, which the full source for ships in Platform Builder.

ctacke