Quantcast
Channel: 32feet.NET
Viewing all articles
Browse latest Browse all 469

New Post: Bluetooth Serial Port Question

$
0
0
Hi,
I have been trying to get the In The Hand tools to work, to help me with a Bluetooth connection from a Windows Mobile 6 device to a printer, and a passport scanner. I think the printer is now working correctly as I can stream data to it, but I cannot get the passport scanner to work. The passport scanner has its own SDK, which requires the COM port. The passport scanner SDK then fires an event to interrupt the application every time a passport is scanned.

I think I am very close to getting my code working, but could really use some advice. Can anyone help me, please? Here's what I've done, and what I'm seeing:

I create a new BluetoothClient, and use it to DiscoverDevices. This works successfully, and I can then loop through the discovered devices to find the passport scanner.

I then set the BluetoothClient's PIN (using SetPin), and set Authenticate and Encrypt to TRUE

I then create a new BlutoothEndPoint, passing in the device's address and the GUID for a BluetoothSerialPort. This is also successful

I can then use the BluetoothClient's Connect method to initiate the connection, and at this point the passport scanner screen changes to "Connecting", so something is definitely working!

I then create a new serial port, using BluetoothSerialPort.CreateClient, and this is also successful, passing back COM9 as the port to use.

I don't know whether I need this next step or not, but I have found that by calling the device.SetServiceState, a new key is written to the registry key HKLM\SOFTWARE\Microsoft\Bluetooth\Serial\Ports, although the Port key is blank. I have tried moving this line of code around in my program to see if it needs to be done earlier, or later, but it dosn't seem to make any difference

At this stage, when I call the passport scanner's SDK with COM9 as the serial port, it fails to connect.

Summary, I've read lots of web pages talking about problems with Bluetooth serial ports, and ways to avoid using them, but my passport scanner's SDK requires a serial port, so I need to find a solution. I seem so close now, that I'm hoping I am just misunderstanding something, or need to add a line or two more of code.

Can anyone help me?

Thanks

Viewing all articles
Browse latest Browse all 469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>