B4J Question BLE functionality with B4J

Discussion in 'B4J Questions' started by megaB4x, Jul 18, 2015.

  1. megaB4x

    megaB4x Member Licensed 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?

  2. Roycefer

    Roycefer Well-Known Member Licensed 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/
  3. megaB4x

    megaB4x Member Licensed 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!
  4. Roycefer

    Roycefer Well-Known Member Licensed 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.
    megaB4x likes this.
  5. megaB4x

    megaB4x Member Licensed 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.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice