Can i send data through this libraries,
I am connecting to a DA14680 chip through react native ble plx app and i want to send a json file
is that possible ?
Thanks
I have never worked with DA14680 but it looks like it supports BLE, so it's doable. Just remember that characteristic reads and writes are limited to negotiated MTU which is lower then 512B. I would suggest to use JSON binary format to compress data as much as possible (like MessagePack) to send as little chunks as possible via characteristics.
@Cierpliwy Okay this is great, sufficient for my needs
actually i would be glad if you give me the name of the method to send data,
and just for the information, can i connect and send data to a smartphone advertised as an ibeacon???
Thanks
I recommend to read intro page of documentation and check functions in it:
https://polidea.github.io/react-native-ble-plx/
@marwakhalil did you get it to work?
@briancohn , yes i used writeCharacteristicWithResponseForDevice() and it worked
@marwakhalil, can you show example how you did it?
@marwakhalil I'd really appreciate that too, thanks so much
`scan() {
this.manager.startDeviceScan(null, null, (error, device) => {
if (error) {
console.log("something went wrong");
return;
}
console.log("device id est : " + device.id + "device name : " + device.name + "device is connectable : " +
device.isConnectable + "rssi : " + device.rssi);
if (device.id === ‘XX:XX:XX:XX:XX:XX’) {
this.manager.stopDeviceScan();
device.connect()
.then((device) => {
return device.discoverAllServicesAndCharacteristics();
console.log('connected');
})
}
})
}
send() {
this.manager.writeCharacteristicWithResponseForDevice(deviceId,
serviceId,
characteristicId,
base64Value)
.catch((error) => {
console.log('error in writing data');
console.log(error);
})
}
`
i made a scan for all devices and i fixed a mac id for testing
Hi,
I have same issue, @marwakhalil or anybody else could you post a working code example ?
I can't figure out how you find serviceId and characteristicId ...
Thx
Most helpful comment
@briancohn , yes i used writeCharacteristicWithResponseForDevice() and it worked