In article news:(E-Mail Removed),
(E-Mail Removed) wrote:
[...]
> In my application, I need to survey the surrounding area for bluetooth
> devices and for each device that is found, see if it's running a
> service with a particular GUID. I use PInvoke to call the
> WSALookupServiceBegin and WSALookupServiceNext methods to achieve
> this. At this point, I am finding devices correctly, but it seems that
> the service discovery fails.
>
Well there's the
http://32feet.net/ library which also provides
Bluetooth support for .NET. It should be able to do all of what you
want. Handling all that horrible native Winsock access behind the
scenes. :-)
Perhaps code something like the following (uncompiled...). Ask again in
the forums there if you need some help with it.
Guid searchedForUuid = ...
BluetoothClient cli = new ...;
BluetoothDeviceInfo[] devices = cli.DiscoverDevices(...);
foreach (BluetoothDeviceInfo curDevice in devices) {
// SDP lookup
ServiceRecord[] svcRecords =
curDevice.GetServiceRecords(searchedForUuid);
...check record contents?...
// Otherwise one could just try a connect to the service, e.g.
cli = new ...;
try{
cli.Connect(curDevice.DeviceAddress, searchedForUuid);
cli.Close();
} catch (SocketExcecption sex) {
switch(sex.ErrorCode) {
...
}
}
}//for
--
Alan J. McFarlane
http://www.alanjmcf.me.uk/
Please follow-up in the newsgroup for the benefit of all.