Send text data via Bluetooth using React-Native App - react-native

I have a Bluetooth (BLE) Module connected to an Arduino and I would like to send a simple text string to it using a React-Native app. Once the string is sent, the Arduino will do some processing.
I've tried using react-native-ble-plx but I've a feeling that isn't the right way to pass the text input to. I've tested using the Bluetooth Terminal Android app and was able to send text data to my Bluetooth Module/Arduino device. I basically want to replicate that.
In my react-native app, i'm able to connect to the Bluetooth Module but not able to send any data.
So, does anyone know which libraries I should be doing to send simple text data? Thanks.

react-native-ble-plx is far enough to do so. You can check out our side project which uses this lib to send colors to Arduino and handle LED lights https://github.com/SparingSoftware/HomeLed

Related

React native ble scanning

I am new to React native, we are looking to switch from cordova to React native...
I am finding a really hard time trying to think of a way to manage the ble scanning in the app.
so basically I have a raspberry pi emitting an encrypted BLE signal updated every second.
I want my app that scan for ble signals around it using react-native-ble-manager
I only want the app to start scanning after authentication and fetching the keys for decryption,
now my point of confusion is, i want to create a context BleScanning and wrap all the components that should show after authentication in it. Basically tab navigator for a Nearby devices screen, Site management screen, and profile screen. Inside side management many screens will be nested for management of the site and raspberry pi and access rights and so on...
now at every second the raspberry pi emits a signature, the app will detect a new device that doesn't understand it, i want to store this signature in a variable that doesn't force the components to update. decrypt the signature, see if the raspberry pi is setup to accept manual commands or automatic commands
if manual command: the device name should show up in Nearby devices screen
if automatic command: i do not need to update any of the screens, just make the phone emit a ble signature when the device in range specified (on any screen in the tab navigator).
my point of concern is how to manage all this without making every component wrapped in BleScanning context from updating on every signature scan

How to send a texture with Agora Video SDK for Unity

I'm using the package Agora Video SDK for Unity and I have followed these two tutorials:
https://www.agora.io/en/blog/agora-video-sdk-for-unity-quick-start-programming-guide/
https://docs.agora.io/en/Video/screensharing_unity?platform=Unity
Up to here, it is working fine. The problem is that instead os sharing my screen, I want to send a texture. To do so, I'm loading a png picture and trying to set it to the mTexture you find in the second link. It seems to be working on my computer, but it is like it doesn't arrive to the target computer.
How can I send a texture properly?
Thanks
did you copy every line of the code from the example as is? You may not want to do the ReadPixel part since this reads the screen. You may just read the raw data from your input texture and send it with the PushVideoFrame every update.

Bluetooth scanner device receive data in React Native

I want to make in React Native a app that connects to a bluetooth scanner device, and receive data from it (barcodes id) after the scanned was made. It is possible? What I need to use?
Thank you!
You can scan barcodes directly from your phone and there are libraries that support such functionality for react native. However if using a bluetooth scanner device is a requirement then you have two options you can choose from -
Get access to bluetooth functionality through Native Modules
Use an existing library that provides bluetooth capabilities to react-native. A really good option can be this library https://github.com/Polidea/react-native-ble-plx
In general it is possible to achieve what you need

How to read data in background in React Native

I have an app in React Native, that uses the bluetooth connection to read data from external devices.
I need a way to continue to read this data in background when, for example, the user starts a reading session and put the app in background.
What should I use to do this?
My code is divided in two parts:
Scan and Connect
Reading Data from external devices.
You need a background service for this. The following link for Android will help you.
github => react-native-foreground-service
If you want, you can do it yourself as described on the RN official site. But you'll have to write Java code for it.
React Native => Native Module

Is there a way to send a phone call to a phone number without start the dialer Voice application using react native?

We are making an electronic device with a SIM Card included in it. Then, when we make a call to a certain phone number associated with this SimCard, that triggers some actions in the device.
Now I want to develop a react native phone application to send the phone call request "in the background" when a button is tapped in this app.
Are there any ways to do this? I don't want to run the installed phone app/dialer app, because we do not intend to talk someone, but only trigger an event.
I've been looking for a solution but the react-native modules working with phone calls (example: react-native-communications) are not very clear concerning this.
If a solution using react native weren't available I accept other ideas about how to implement this requirement (angular, or using an intermediate server with node/PHP/Java/etc..)
Thank you.