vnikitin
Posts: 11
Joined: Wed Dec 21, 2005 5:19 pm

Bond, DeviceLost and DiscoverDevices

Thu Apr 06, 2006 11:03 pm

I try to use the FindAndConnect sample and modify it as little as possible and understand how to get things to work.
So I have some questions.

1. For some bluetoth modules (Baracoda for example)
device.DiscoverServices(ServiceType.SerialPort) requires remoteDevice.bond(pin) method first
You told me: "in Bluetooth you do not need to bond before discover services. So there must be something fundamantaly wrong with what you are doing."
This is correct beacause of Bluetooth specification Version 1.1 Part K:5 "Serial port profile" chapter 3.1.1 Establish link

and set up virtual serial connection "Note: The order between steps 1 and 2 is not critical (may be the other way
round)".
step 1. is "Submit a query using SDP to find out the RFCOMM Server channel number of the desired application in the remote

device."
step 2. is "Optionally, require authentication of the remote device to be performed."

2. device.bond(pin) = true even the remoteDevice is switched off
So it was my mistake to use this property to recognize loss of conection.

3. Which event can I use to recognize loss of connection?
If it absent, I think it should be done because of Bluetooth specification Version 1.1 Part F:1 "RFCOMM with TS 07.10 Serial

Port Emulation" chapter 5.2.3 Link loss handling: "If an L2CAP link loss notification is received, the local RFCOMM entity is
responsible for sending a connection loss notification to the port emulation/
proxy entity for each active DLC."

4. When m_network.DiscoverDevicesAsync() started and remoteDevice is switched off (connection is lost)
the event m_network.DeviceLost fires with eventArgs.EventType = EventType.DeviceDiscovered instead of EventType.DeviceLost

5. If I use Device.DiscoverServices() method after declaration DiscoveryListener
device.ServiceDiscovered += new BlueToolsEventHandler(device_ServiceDiscovered);
device.ServiceDiscoveryCompleted += new BlueToolsEventHandler(device_ServiceDiscoveryCompleted);
the events fire:
device.ServiceDiscovered only first time after the program is started
device.ServiceDiscoveryCompleted each time
If do not declare DiscoveryListener no events fire.

I'v tested these for widcomm at Franson.BlueTools.200 and Franson.BlueTools.200.CF

Best regards, Vitaly.

Return to “BlueTools”