• I have a Bluetooth characteristic onWrite function as so:

    onWrite: function(evt) {
      let value = new DataView(evt.data).getUint32(0, /*littleEndian=*/ true);
      // Do something with value.
     },
    

    I'd like to validate the value -something like this:

    onWrite: function(evt) {
      let value = new DataView(evt.data).getUint32(0, /*littleEndian=*/ true);
      if (value < 0)
        throw 500; // Raise some kind of exception
      // value is good, do something with value.
     },
    

    Is this supported?

About

Avatar for cmumford @cmumford started