Bluetooth support

27 views
Skip to first unread message

andrea antonello

unread,
Apr 16, 2018, 11:02:26 AM4/16/18
to CodenameOne Discussions
Hi developers, 
I am now playing around with fantastic CN1 a while now and have a question for the community.

Does anyone have experience with bluetooth in CN1. I am not talking about BLE, but "normal" bluetooth.

I basically need to:
  • connect to a paired device (hence get the list devices to choose from)
  • send data to the connection
  • read data from a connection (ex. a stream of data from a GPS, but could also be a device that measures environmental data)

I did search around the web and in the forum, but I can't find anyone working with it openly. I have 0 knowledge of IOS but have experience on the android and desktop part, so I am not even sure if the above workflow would work the same way also in IOS.

Any idea, hint or maybe even code to share? :-)

Cheers,
Andrea

Shai Almog

unread,
Apr 17, 2018, 12:30:15 AM4/17/18
to CodenameOne Discussions
Hi,
there were a few guys working on this in the past but most moved to BLE as it's pretty much the standard now.
I'm guessing this can be ported in the same way that the original BLE project was ported: https://github.com/bcsphere/bluetooth/

Since bluetooth is a HUGE API it would require quite a lot of work. I'd love to have a more organized "how to" for Cordova plugin ports but right now we don't have much.

andrea antonello

unread,
Apr 17, 2018, 3:32:51 AM4/17/18
to codenameone...@googlegroups.com
Hi Shai,
 
there were a few guys working on this in the past but most moved to BLE as it's pretty much the standard now.

yes it is indeed for many things, but still used very few on certain types of devices (gps, measurement tools). Honestly I have no idea why. But I have not been able to find a device (apart of headphones, fitness watches and beacons) that would produce some measured output that bases on BLE.
Does anyone know of such a consumer device? I would love to test it with the BLE plugin. But I would ideally something where I can send commands to and then read produced output.
 
I'm guessing this can be ported in the same way that the original BLE project was ported: https://github.com/bcsphere/bluetooth/

I didn't see this project before, thanks. 
 
Since bluetooth is a HUGE API it would require quite a lot of work.

I assume yes, I have always used only a fraction of it though (as summarized in the bullet list).
 
I'd love to have a more organized "how to" for Cordova plugin ports but right now we don't have much.

Yes, it would be interesting to understand what skills one needs to have :-)

Thanks,
Andrea



 

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/9db1aa1f-3b1a-4e6c-8460-0510b2f1a781%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Shai Almog

unread,
Apr 18, 2018, 1:12:48 AM4/18/18
to CodenameOne Discussions
Hi,
I think most of the work is mechanical but since this API is huge I'm sure there is a lot of nuance especially in the callbacks from the API.

One of the problems with Cordova porting is that Cordova by its essence is limited to JavaScripts asynchronous functionality. The proponents of JS claim this as an advantage but it's a huge disadvantage as operating systems & hardware are by their nature synchronous (e.g. bluetooth) so it makes the most sense to just have a thread reading from/to said device.

This would actually be simpler and reduce the implementation size considerably. But this is non-trivial to do especially for a feature that is so huge. I'm sure we can cut out some API's from this mix but it would still be a lot of code to deal with.
Reply all
Reply to author
Forward
0 new messages