BLE Ionic Native (Write with Response)

I am trying to write a command to a BLE device. I have followed the docs and send the command in a buffer format via BLE.write(deviceId, serviceUUID, characteristicUUID, value).

I am connected and bounded to the device OK, my trouble is getting a detailed response from the peripheral. When I write the data I get a response of “OK” but should have more data.

Just curious if it is something I was doing wrong when writing to the device using the @ionic-native/ble framework. Below is the write command I am sending

          BLE.write(product, serviceUUID, charID, commandBuffer).then(
            result=>
             {  console.log("Write succesfull line 87: " + result);
            }).catch(error=> 
              { console.log("Error On line 88: " + error); });

With Bluetooth Low Energy, there is no value returned when writing. All you get is an acknowledgement from the Bluetooth layer that the value has been written. If you need to get a value back from the peripheral, you have to use read or notifications in combination with write.

Have you figured out how to retrieve a response packet. Please Let me know if you have.

Hi,

Yeah you need to start notification first and once you have that listening you can send different write commands.

           BLE.startNotification(product, serviceUUID, charID).subscribe(
            data => {
              onNotifyTemperatureChange(data);
            }
          );

I call the onNotifyTemperatureChange function to then convert the data being read from bytes to string.

Hope this helps