Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing a Windows Mobile application that will be used in a sometimes connected environment. One of the design parameters of the application is to monitor the state of the network connection to determine whether to cache data or to save to the server. Another parameter is to track which Access Point (AP) the device is connected to (as this lets us know where in the facility the device is operating).

Using the OpenNETCF Smart Device Framework (version 2.3) I'm easilly able to determine connection status. I can also quickly get a list of all of the APs that the device can 'see'.

Now,... from the Adaptor information that I can capture I can get the SSID for the AP I am connected to. For the environment I am working with this does not help me to determine which AP I am connected to (assuming more than one is visible) as we have a common SSID for all APs.

What I really need to get is the MAC address or the assigned name of the AP.

Any ideas on how to achieve this?

Is there an alternate method to get this information??? Ideas???

Note I've posted this similar question to other forums including MSDN (http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesvbcs/thread/f534081a-a55f-4c48-b358-7cad5a9d562f)
Posted

1 solution

Okay,.... through dumb luck, trial and error and a bit of stubbornness I've found what I've been looking for using OpenNETCF.Net:

private void ShowAdaptors()
{
  OpenNETCF.Net.NetworkInformation.WirelessNetworkInterface IN;
  OpenNETCF.Net.NetworkInformation.WirelessZeroConfigNetworkInterface INw;

  listBox1.Items.Clear();

  foreach (OpenNETCF.Net.NetworkInformation.INetworkInterface ni in OpenNETCF.Net.NetworkInformation.WirelessNetworkInterface.GetAllNetworkInterfaces())
  {
    listBox1.Items.Add("Desc: " + ni.Description);
    listBox1.Items.Add("IP: " + ni.CurrentIpAddress );
    listBox1.Items.Add("ID: " + ni.Id );
    listBox1.Items.Add("Status: " + ni.InterfaceOperationalStatus);
    listBox1.Items.Add("Type: " + ni.NetworkInterfaceType);

    if (ni is OpenNETCF.Net.NetworkInformation.WirelessNetworkInterface) listBox1.Items.Add("Is Wireless");
    if (ni is OpenNETCF.Net.NetworkInformation.WirelessZeroConfigNetworkInterface) listBox1.Items.Add("Is WZC");

    if (ni is OpenNETCF.Net.NetworkInformation.WirelessZeroConfigNetworkInterface )
    {  // wireless zero config.
      INw = (OpenNETCF.Net.NetworkInformation.WirelessZeroConfigNetworkInterface)ni;
      listBox1.Items.Add(" AP: " + INw.AssociatedAccessPoint);
      listBox1.Items.Add(" AP MAC: " + INw.AssociatedAccessPointMAC.ToString());
    }
    else if (ni is OpenNETCF.Net.NetworkInformation.WirelessNetworkInterface )
    {  // wireless network
      IN = (OpenNETCF.Net.NetworkInformation.WirelessNetworkInterface)ni;
      listBox1.Items.Add(" AP: " + IN.AssociatedAccessPoint);
      listBox1.Items.Add(" AP MAC: " + IN.AssociatedAccessPointMAC.ToString());
    }
  }
}


Not the prettiest code ever written (mainly as I am still coming up to speed on C#) but it does perform the function I was looking for.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900