OpenBluetoothToolbox / SimpleBLE

SimpleBLE - the all-in-one Bluetooth library for MacOS, iOS, Windows, Linux and Android.
https://www.simpleble.org
Other
703 stars 118 forks source link

Java bindings #265

Open KlemenDEV opened 1 year ago

KlemenDEV commented 1 year ago

It would be neat to have Java bindings for this library. There is currently no BLE desktop Java library to my knowledge.

JNA/SWIG/JNR-FFI could be used to achieve this.

Originally this was a comment at #121 but moved to a separate ticket.

KlemenDEV commented 10 months ago

I have started to work on Java bindings, but am currently stuck at #267

enkatsu commented 10 months ago

@KlemenDEV Just like you, I am also developing Java bindings. If you don’t mind, I would like to contribute to your development work. Could you please share with me the URL of your repository?

lebenski commented 8 months ago

I would love this! Any work in progress that I can take a look at?

L4m4L commented 8 months ago

@KlemenDEV how did you go with Java bindings? I have made good progress, but am currently stuck on passing my user-defined structs to the simpleble_peripheral_write_command function. Any assistance would be appreciated!

KlemenDEV commented 8 months ago

The project got a bit stuck because it is currently not the priority at the company I was working on those bindings for

L4m4L commented 8 months ago

No worries, I will post up my repo so others can critique it - it's close I think but I'm not implementing the Pointers correctly I think with JNI-FFI (for function calls using structs)

L4m4L commented 8 months ago

Here's where I have gotten up to, very messy at the moment but not sure if it is similar to where you left off?

If I can get something to work I will definitely update this code and share it with SimpleBLE

L4m4L commented 7 months ago

Hi @KlemenDEV, I finally got Java bindings to work using Java Native Access. The weirdest thing was that I needed to change the parameter order for "simpleble_peripheral_write_command" in order for it to work...? So I think JNA was mixing up calling conventions somewhere along the way, so it may not be that stable.

Anyway, the code is here. Happy for questions/comments/feedback!