WebBluetoothRemoteGATTDescriptor.fromJSObject constructor

WebBluetoothRemoteGATTDescriptor.fromJSObject(
  1. Object _jsObject,
  2. WebBluetoothRemoteGATTCharacteristic characteristic
)

Create a new instance from a js object.

This should only be done by the library or if you're testing.

To get an instance use WebBluetoothRemoteGATTCharacteristic.getDescriptor, and WebBluetoothRemoteGATTCharacteristic.getDescriptors.

Implementation

WebBluetoothRemoteGATTDescriptor.fromJSObject(
    this._jsObject, this.characteristic) {
  if (!_JSUtil.hasProperty(_jsObject, "characteristic")) {
    throw UnsupportedError("JSObject does not have characteristic");
  }
  if (!_JSUtil.hasProperty(_jsObject, "uuid")) {
    throw UnsupportedError("JSObject does not have uuid");
  }
  if (!_JSUtil.hasProperty(_jsObject, "value")) {
    throw UnsupportedError("JSObject does not have value");
  }
  if (!_JSUtil.hasProperty(_jsObject, "readValue")) {
    throw UnsupportedError("JSObject does not have readValue");
  }
  if (!_JSUtil.hasProperty(_jsObject, "writeValue")) {
    throw UnsupportedError("JSObject does not have writeValue");
  }
}