I work with sevel333 and have taken over this task.
I still have some questions. I would appreciate any help you can provide on this matter.
What I need to accomplish.
The PC will be in slave mode constantly monitoring for already paired devices to connect to it. Once a device connects, the PC/device will communicate using a ASCII protocol over the SPP profile.
Current Implementation
1) We create a Incoming Bluetooth virtual COM port.
2) Open virtual COM Port
3) Wait until a device connects. (done by monitoring the "DSR" signal of the COM Port and waiting till it goes HIGH)
4) Send data over the virtual com port to talk with the device.
Note:
* The device is the Master. The device's Bluetooth is normally off. It powers on it's Bluetooth and initiates master mode connection to the PC. If the PC does not respond via the ASCII protocol within a few seconds of the device connecting, the device times out, disconnects, and powers off the Bluetooth..
Problems
Our current setup works fine. However, there are a number of downfalls that I would like to address by eliminating the dependency of the virtual com port.
Your library has the ability to talk directly with the stack. I would like to use this ability to bypass the need to utilize a virtual com port. However, I'm at a loss on how to accomplish this with your library. I would appreciate any help you may be able to provide.
I tried the wclnet.wclClient class unsuccessfully. I set this client up as follows
' Set up radio
Dim _discovery As new wclnet.wclBluetoothDiscovery
Dim _radio As wclnet.wclBluetoothRadio = _discovery.EnumRadios(0) 'Yes I know I should have error checking.
Dim _client As new wclnet.wclClient
' I am not sure if I have to set up the serial baudrate but I did regardless because I know the baud set by the device is 115200
_client.SerialParams.BaudRate = wclnet.wclBaudRate.br115200
_client.ClientTransport = wclnet.wclClientTransport.ctBluetooth
_client.BluetoothParams.Radio = _radio
_client.BluetoothParams.Channel = 1
_client.BluetoothParams.Service = new Guid("00001101-0000-1000-8000-00805F9B34FB")
_client.Open()
After this I'm stuck. I'm not sure how to detect when the device connects so that I can send it something.
I know I'm doing something wrong because, the device never makes a successful connection. The behavior observed is the same as if the virtual COM Port is closed.
Am I completely off target here? Any help would be appreciated.