Hello,
I'm new to using Bluetooth, so am not sure if I'm missing something.
I'm trying to write a few functions that will transfer arbitrary information from one device to another. I'm not sure of the best way to do this, so was originally looking at making a modification to a "Bluetooth Chat" sample.
I'm running Windows 7, programming in MS Dev. Studio 2008. Therefore, my desktop bluetooth stack is a Microsoft stack. The device I need to transfer information to and from is an HTC Touch Pro 2 (which, from my understanding, has a Widcomm stack). I'm using the Microsoft CF and Windows Mobile 6 Professional to program for the HTC.
I believe I've followed all of the instructions to get the Widcomm stack to run (copied the native DLL to the execution folder, etc.), however, I am still having issues. I modified the BluetoothChat sample program by removing the listener and translating it to C#. My goal was to get the program running on the HTC. I successfully get a list of devices I can connect to, however, when I go to send a message, I get an error on the client.Connect() function stating "IOException was unhandled - IOError on socket". I pulled the lines of code apart to ensure that this was the command that was having the issue:
BluetoothClient client = null;
BluetoothAddress adr = null;
BluetoothEndPoint endpt = null;
...
adr = ((BluetoothDeviceInfo)cboDevices.SelectedItem).DeviceAddress;
endpt = new BluetoothEndPoint(adr, ServiceName);
client = new BluetoothClient();
client.Connect(endpt);
After a bit, I gave up on this attempt and tried to run the DeviceListener code. For this, I'm getting an error on the device "Assertion Failed: Unexpected exception creating factory 'InTheHand.Net.Bluetooth.Widcomm.WidcommBluetoothFactory, ex:System.MissingMethodException: Can't find PInvoke DLL '32feetWidcomm' at InTheHand.Net.Bluetooth.Widcomm.WidcommBtIf.Create() ... The source code shows an issue for the line:
InTheHand.Net.Bluetooth.BluetoothRadio.PrimaryRadio.Mode = InTheHand.Net.Bluetooth.RadioMode.Discoverable.
Now, reading through the forums, it sounds like this is expected as it's the Widcomm stack.
So, is there another way I should be approaching my problem? Again, my hope is to simply pass a string that I can parse out on one side or the other, so that the devices can communicate. i.e. (a string formatted "Show:HelloWorld+Length:10+Unit:sec").
Thanks.