B4J Question BLE functionality with B4J

megaB4x

Member
Licensed User
Longtime User
Hi all,

I am new to B4J and am interested in developing applications for PC and MAC that will work with BLE devices. I want to be able to read BLE data sent from BLE peripheral. Please guide me how can be this achieved in B4J. If B4J doesn't support this function out of the box, is there a library that can be used?

Thanks!
 

Roycefer

Well-Known Member
Licensed User
Longtime User
If you can get the BLE device to present itself to the computer as a virtual serial port (in Windows, this will show up as "COM5" or something) then you can use the jSerial library and AsyncStreams in the jRandomAccessFile library. If you're going to be passing text back and forth and don't need access to the raw Byte buffers, look at using AsyncStreamsText in addition to all that.

Look at this tutorial for some inspiration: http://b4x.com/android/forum/threads/b4j-arduino-demo.37678/
 
Upvote 0

megaB4x

Member
Licensed User
Longtime User
Hi Roycefer! I am looking for a Bluetooth BLE HID profile in B4J where I can have peripheral act as an HID device, for example a keyboard or mouse. The UART you suggested is a good option but if there is a HID implementation in B4J that will awesome.

Thanks again for the suggestion!
 
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
Does your BLE device behave like a real HID device, triggering system keyboard events and mouse events? Or is it one of those devices that abuse the HID profile (like a weather station) and, in fact, don't have a human interacting with it? If it's the former, then you can use my jNativeHookB4J library to intercept the keyboard and mouse events. Otherwise, you'll probably have to create your own solution as I don't think there is a B4J HID library. If you know some Java, you could probably wrap this project: https://github.com/nyholku/purejavahidapi, it seems pretty straightforward.
 
Upvote 0

megaB4x

Member
Licensed User
Longtime User
Yes, it sends standard HID keyboard and mouse events. Your library jNativeHookB4J looks very interesting. I will look into it as soon and open a new thread if I have questions pertaining to it. Thanks again for taking time to suggest options.
 
Upvote 0
Top