views:

3285

answers:

2

I'm looking for a way to connect a Windows Mobile device to a PC via Bluetooth and have it show up on the PC as a HID device (i.e. Keyboard or Mouse). I imagine this would mostly be a matter of modifying the available Bluetooth profiles on the Windows Mobile device so that it exposes a Bluetooth HID interface... Is that even possible? Would it require a custom driver or something on the WinMo device?? For the most part, my main requirement is that it not require ANY special software on the PC side, it should simply use the built in Bluetooth stack and think that the WinMo device is actually a HID device and not a PDA.

I have WinMo devices that have barcode scanning capability, so I would like to be able to use the PDA to scan barcodes to the PC, using that HID interface.

Also, I mainly use C++ and C#, so if it could be done in one of these languages, that would be best.

Any suggestions?

+1  A: 

It's perfectly possible. Just start a bluetooth server registered with the HID service Guid {00001124-0000-1000-8000-00805f9b34fb}. If the device supports the Microsoft bluetooth stack you can use Peter Foot's excellent .NET CF library (http://32feet.net/) and BluetoothService.HumanInterfaceDevice;

UPDATE:

With Peter Foot's library the server would look something like this:

using System.IO;
using InTheHand.Net.Sockets;
using InTheHand.Net.Bluetooth;

// ...

BluetoothListener l = new BluetoothListener(
    BluetoothService.HumanInterfaceDevice);
using (l) {
    BluetoothClient c = l.AcceptBluetoothClient();
    using (c) {
        Stream s = c.GetStream();
        using (s) {
            // send HID bytes
        }
    }
}

Regards, tamberg

tamberg
Very cool...any chance you could give me a quick code example, I've got the library now, but not really sure how to make it work.
Adam Haile
See update above (sorry, no working example at hand)
tamberg
I'm the maintainer of 32feet.NET, and I'm sorry to say that the answer is wrong. HID runs over the Bluetooth L2CAP layer, 'normal' applications run over the higher-level "RFCOMM" layer, which is what BluetoothListener/BluetoothClient expose so that example won't work. :-( Because L2CAP isn't supported on all platforms we don't provide support for it -- contributions are welcomed however.See info on protocols/layers at e.g. http://www.alanjmcf.me.uk/comms/bluetooth/Bluetooth%20Profiles%20and%2032feet.NET.html
alanjmcf
Thanks for clarifying. Cheers
tamberg
A: 

Could someone write any example of code instead "send HID bytes", please?