react-native-ble-plx

How to authenticate with Mi Band 3 in React Native

扶醉桌前 提交于 2021-01-28 04:57:48
问题 I have struggled for a few days to find a way to authenticate to my Mi Band 3 using React Native. I'm using react-native-ble-plx to make the connection. I can search for the nearby devices and I can even connect to the band, but when I try to call some service or characteristic, anything happens. Upon a few hours of searching, I realized that the problem might be the authentication, so I started looking for that, but I can't find anything. I found a question similar to this one, but the only

Losing data after connecting the bluetooth module

旧城冷巷雨未停 提交于 2020-12-08 05:32:12
问题 Objective I am trying to return data from the BlueTooth device after connected because to use the read and write function, need some data. Example data name, overflowServiceUUIDs, solicitedServiceUUIDs, mtu, rssi... and many others. Because if I want to read or write I need some attributes. I am using the library react-native-ble-plx . What is happening? After the device connected I lost some values. Important type DeviceState = { connected: boolean; services: Service[]; device: Device | null

Large file sending by using react-native-ble-plx

生来就可爱ヽ(ⅴ<●) 提交于 2020-05-17 06:23:11
问题 I'm trying to write in a characteristic that sends a binary file as the value, this value is large, it's 19215 bytes which is not a problem because i negociated the mtu using : device.connect({ requestMTU: 260 }) i've divided the file into 240 bytes for each element and each time encode the element to base64 and i use the function writeCharacteristicWithResponseForDevice() in order to write that element, the issue is i successfully wrote the whole file 19215 bytes using a loop to write each

React Native - Global Event Listener

你离开我真会死。 提交于 2019-12-23 15:17:22
问题 I have a listener registered in my Pairing screen that calls a method whenever the connected Bluetooth device gets disconnected // Pairing.js const BleManagerModule = NativeModules.BleManager; const bleManagerEmitter = new NativeEventEmitter(BleManagerModule); componentDidMount() { this.handlerDisconnected = bleManagerEmitter.addListener( "BleManagerDisconnectPeripheral", this.handlePeripheralDisconnected ); } componentWillUnmount() { this.handlerDisconnected.remove(); } I want this event all