Dec 30 2008

Accessing the Skyhook Wireless SDK from C# - prerelease wrapper

Category: Windows Mobile | Future | WindowsJoel Ivory Johnson @ 12:31

I've got a working wrapper for the Skyhook Wireless SDK but it has some [known] bugs.  I am also working on an OpenCellID wrapper and a Virtual Earth example that will make use of both services so I can't concentrate on taking care of the bugs just yet, but I promised to make the wrapper available this week so I am uploading it with the disclaimer that it is in prerelease form.  I don't plan on changing the methods by much between this version and a proper release version.  This code is not production ready and it confers no rights or warranties.   In the attachment you will find the C wrapper (Which handles conversion between wide and ani characters among other things), the wrapper, and a simple client of the wrapper.

Using the wrapper is wasy.  You only need to create a Wps object and then ask for your location.

Known Bugs:

  • If you examine the WPSPROXY wrapper you will find that in some cases memory is allocaated for a wide character conversion but not released.
  • I noticed if I ask for location while periodic location is active then a lockup will occur.  This is either a but or something that I am not supposed to do.

 Remember to ensure that WSAPI.DLL and WPSPROXY.DLL are deployed with your application.

 

A few simple code examples:

 //Get Full Address (exception thrown if address is not available)
  WPS wps = new Wps("myUserName","MyRealm");
 WiFiLocation location = wps.GetWiFiLocation(StreetAddressLookupType.FullStreet);


 //Get Full Address (no exception thrown if address is not available)
  WPS wps = new Wps("myUserName","MyRealm");
 ResultCode  = wps.GetWiFiLocation(StreetAddressLookupType.FullStreet, out loc);
 if(rc!=ResultCode.OK)
 {
    Console.out.WriteLine("Could not acquire location");
 }

 

 Download Code Here

Tags: