i am new to bluetooth development.
i try to reading data from bluetooth device, with this service and characteristic uuid.
this is uuid i got
but after i connect to device according to documentation of react-native-ble-plx then try to monitoring or reading the device (i hope to get reading data every 1 minutes or so) but the monitoring code not working.
is there any missing step? can you give me example code? i try every uuid characteristic but none of them working. here is my code:
manager.startDeviceScan(null, null, (error, device) => {
if (error) {
// Handle error (scanning will be stopped automatically)
console.log('eror device scan',JSON.stringify(error))
return
}
if (device.name === deviceName) {
// Stop scanning as it's not necessary if you are scanning for one device.
manager.stopDeviceScan()
// Proceed with connection.
device
.connect()
.then(async (device) => {
let allServicAndChar = device.discoverAllServicesAndCharacteristics()
console.log('allServicAndChar',JSON.stringify(allServicAndChar));
return allServicAndChar;
})
.then(async device => {
console.log('read characteristic');
if(manager){
//this code is called
console.log('this code is called')
// code below me is no response
device.monitorCharacteristicForService('fee7', 'FEC8', (error, characteristic) => {
if(error){
__DEV__ && console.log('errorc',JSON.stringify(error));
}else{
console.log('===',characteristic?.value);
}
})
}
})
.catch(error => {
// Handle errors
console.log('error connect to a device',JSON.stringify(error));
})
}
