I am working with micro-controllers and Bluetooth devices (RN42 HID) and after a LOT of testing on Mac and windows over the last 1 week, have found the SPP (Serial Port) communications to be too slow (up to 4 seconds to open a com port) and unreliable / unstable. When you potentially have 7 devices connecting and disconnecting this means that it can take over 30 seconds to open and close each port and collect the data from them.
I already use the MBS HID plugin to communicate directly with USB-HID micro-controllers, and it is very fast and very stable, but now I need to do this wirelessley.
So I am now looking at other connection methods, the most appealing is the HID mode, where the Bluetooth radio pairs to the O/S and is recognized as a human interface device and it’s class can be set to numerous types set including keyboard.
The Bluetooth radio still transmits and receives ASCII characters, however there are no “gameInputElement” and although the gameInputManager can recognize the device, of course with no elements it can’t do anything.
So is it possible to modify the class so that it can send and receive data from the Bluetooth HID device, I am not an experienced programmer but are guessing that if Xojo can find the device, then it should be able to communicate with it with some modifications.
Thanks, yes I emailed Christian yesterday. they don’t have anything to communicate with (non-usb) HID devices, to have them write a custom plugin just for me is going to be very expensive.
But I did make some progress with the gameInput plugin, and are now able to connect to the Bluetooth device and are also able to read the values of the elements when the Bluetooth class is set to Gamepad, Mouse or Joystick classes.
So the inputGame control does work, if it was able to write as well as read, then it would be a workable solution, and as I understand, HID devices do support writing as well as reading, so it looks like this is a limitation with the plugin and not the bluetooth device or specs.
The ideal situation would be where the GameInput plugin connected to the bluetooth device and just transmitted and received strings, just as happens with serial or usb. The design of the plugin currently uses the HID reports to collect data from the bluetooth radio’s registers, and these (button and x-y posn) registers need to be set via the serial connection at the other end of the pipe using hex:
$FD$06$10$20$30$40$FF$FF
In this example:
FD is the command
06 is the number of bytes in the data packet
10 = x axis position (-127 to + 127)
20 = y axis position (-127 to + 127)
30 = z axis position (-127 to + 127)
40 = X Axis Rotation
FF,FF = 16 Button register, 1 bit per button.
Is is possible to access / modify / extend the built-in plugins in RB ?
I am kind of surprised that there is so little interest in interfacing with the outside world with realbasic / Xojo.
The gameInput test code which was included with RB2005 is no longer included with the samples, so I am guessing that there has been little or no usage of this plugin since it was released.
The real beauty of HID is that it requires no drivers on windows, linux or osx, and there are soo many different classes of HID device such that a HID device does not simply need to be a keyboard mouse or joystick.
From my testing above, it is quite clear that xojo/rb CAN talk to HID devices natively, it’s just that probably due to no demand, the plugin has never been enhanced to do anything else except a simple reading of the HID endpoints.
I have spent several days trying to find a solution to this, but drawn a blank, and woul really appreciate some help from the experienced programmers in helping me move forward as now I am stuck, and have googled my heart out trying to find out how to accomplish this.
Is it possible to access / modify / extend the gameInput plugins so that they can do a little more than just read the HID registers ??
In a few weeks, I will have to make a software able to communicate with a bluetooth device. I really like developing with XOJO, but I would like to know if there is a reliable way to do this in XOJO or if I have to look for another language…