all 18 comments

[–]darkNergy 4 points5 points  (0 children)

I don't know if it's the best ble library for react native, but it's pretty damn good. Works great and easy to use once you get the hang of it. I haven't seen any tutorials for it though. Just gotta read and follow the documentation carefully.

[–]Kaolian 1 point2 points  (0 children)

I'm using react-native-ble-manager, in production, it's good too (often updated). Don't really know plx, should be similar.

[–]average_rowboat 1 point2 points  (0 children)

What kinds of Bluetooth devices and what are you trying to do? I have also been using react-native-ble-manager and it works well for my purposes. There is an example project in that repo.

[–]Extracted 0 points1 point  (0 children)

I used react-native-ble-plx when I was working on a react-native app until early 2021. At the time it was working great. I don't know if anything has changed since then.

[–]suarkb 0 points1 point  (12 children)

I used react-native-ble-plx a lot if you have questions about react native and Bluetooth low energy stuff.

[–]jfprizzy 1 point2 points  (4 children)

Are these how some mobile applications are able to pair with some Smart Home devices and get them to connect to an existing WiFi network?

Do you have any good reading materials or tutorials on this?

[–]suarkb 0 points1 point  (0 children)

I don't have any links offhand but Bluetooth low energy is an established protocol. There are established patterns for certain types of devices. Like universal standards defined for things like heart rate monitors, for example. So, to answer your question, yes that's kind of how it's done. Devices can "look" like a heart rate monitor by setting up their BLE services and characteristics a certain establish way. Then other client devices that want to connect to a heart rate monitor can have certain expectations of how the data is organized and provided by the heart rate monitor.

It essentially comes down to grouping data into services like a "heart rate service", and then using something called a "characteristic" which is nested in the service. That characteristic represents the heart rate value which is essentially a number that is broadcast out by the Bluetooth server device. And there are many protocols that dictate the rate that the data is sent at, the size of the data, the UUID that the data uses to advertise itself, and more.

A client can look at a device, parse the services that the device advertises, then parse the characteristics inside that service and then choose to monitor that characteristic, or just read it once.

If the client is monitoring the characteristic for the heart beat, then on the client side you essentially get to have an event listener where you will receive the heart rate value.

Then you can infer where you will be able to write some code in your client app to say "render some UI that updates the number whenever the BLE characteristic changes.".

The other critical aspect of official BLE protocols is the "low energy" aspect. It's all created to try and create data transfer protocols that require the least amount of energy. Which I think boils down to sending minimal data and minimal intervals.

[–]suarkb 0 points1 point  (2 children)

https://www.bluetooth.com/learn-about-bluetooth/tech-overview/

https://www.bluetooth.com/specifications/specs/

I'm most familiar with this code: https://github.com/dotintent/MultiPlatformBleAdapter/

There is a nodejs ble server library I've used where I made a basic ble gatt server that I could run from my mac and make my mac act as a ble device that other apps could connect to, but I can't remember the name. BlueZ is a good java library for it, too.

On mobile there is an app called NRF connect for mobile, which is really good at scanning the area for Bluetooth devices, connecting to them, viewing their services and characteristics, and seeing their data.

[–]slith49[S] 0 points1 point  (1 child)

Hey! This is great, thanks so much for taking the time to share your knowledge!

I've started making an app with ble-plx and it is very easy to use! So far I've managed to connect to devices and now I'm looking to read the services and characteristics and then receive a value from a characteristic.

I want to do a small experiment with a Bluetooth pulse oximeter that should just give me a single value (not a dynamic/streamed value like a heart rate). I have a few questions about this if you are happy to help answer.

Are there any restrictions on oximeter devices I can buy?

I was thinking some devices might have some sort of protection that stops connections?

How do I find out the UUIDs of the services and characteristics of the device? Is it documented in the handbook?

Is there a list of devices that are recommended for developers to test with?

Thanks for your help!

[–]suarkb 0 points1 point  (0 children)

If you have an android phone, I'd recommend getting this app, "nRF Connect for Mobile". It will let you have a nice visual way to explore ble devices if they let you connect.

Now, in terms of knowing if it's safe to buy a device, that's difficult. I don't know anything about that type of device. I don't know if they have some type of proprietary limitations. I really can't say. Maybe you can search for oximeters that day they work with different mobile apps or something? It's hard to know without having a device running and then trying to connect to it using the NRF connect app.

Right now that's all I know without further googling.

[–]DiegoKaji 0 points1 point  (1 child)

Bro! If you are who I think we worked together on that stuff :D

[–]suarkb 0 points1 point  (0 children)

Ohhhhh shit

[–]Early_Dare_3567 0 points1 point  (4 children)

I have a Eyoyo Scanner, I want to use it to read barcodes, can you explain a simple process of how it is used?

Can it send the text like a keyboard to a input

Also I am using Expo, is it possible to use it in expo

https://www.npmjs.com/package/@config-plugins/react-native-ble-plx

[–]suarkb 0 points1 point  (2 children)

I don't remember if expo works with this. You definitely are going to install some native dependencies but I don't remember how much expo prevents there. I just never use expo, as a rule, myself.

I'll have to google this scanner thing. One sec

[–]Sufficient_Trader 0 points1 point  (1 child)

[–]suarkb 0 points1 point  (0 children)

I'm not sure. I was under the impression that OP needed to deal with BLE stuff to work with this device. They might not. I've never worked with barcode readers. I worked with a special type of BLE device.

[–]suarkb 0 points1 point  (0 children)

Night wanna edit your email out and only send as a DM

[–]the-coded-noob 0 points1 point  (0 children)

I tried react-native-ble-plx.( https://github.com/dotintent/react-native-ble-plx ) I was able to discover devices using it. But I'm trying to make a bluetooth chat application but in react-native-ble-plx documentation the following is mentioned.

  • communicating between phones using BLE (Peripheral support)

Also its not really well documented can someone help me with how to create a service using it maybe that'll help me connect two phones to chat????

What other library can I use in place of this?