WebBluetoothRemoteGATTCharacteristic.fromJSObject constructor

WebBluetoothRemoteGATTCharacteristic.fromJSObject(
  1. Object _jsObject,
  2. WebBluetoothRemoteGATTService service
)

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 WebBluetoothRemoteGATTService.getCharacteristic, and WebBluetoothRemoteGATTService.getCharacteristics.

Implementation

WebBluetoothRemoteGATTCharacteristic.fromJSObject(
    this._jsObject, this.service) {
  if (!_JSUtil.hasProperty(_jsObject, "service")) {
    throw UnsupportedError("JSObject does not have service");
  }
  if (!_JSUtil.hasProperty(_jsObject, "uuid")) {
    throw UnsupportedError("JSObject does not have uuid");
  }
  if (!_JSUtil.hasProperty(_jsObject, "properties")) {
    throw UnsupportedError("JSObject does not have properties");
  }
  if (!_JSUtil.hasProperty(_jsObject, "getDescriptor")) {
    throw UnsupportedError("JSObject does not have getDescriptor");
  }
  if (!_JSUtil.hasProperty(_jsObject, "getDescriptors")) {
    throw UnsupportedError("JSObject does not have getDescriptors");
  }
  if (!_JSUtil.hasProperty(_jsObject, "readValue")) {
    throw UnsupportedError("JSObject does not have readValue");
  }
  if (!_JSUtil.hasProperty(_jsObject, "writeValue")) {
    throw UnsupportedError("JSObject does not have writeValue");
  }
  if (!_JSUtil.hasProperty(_jsObject, "startNotifications")) {
    throw UnsupportedError("JSObject does not have startNotifications");
  }
  if (!_JSUtil.hasProperty(_jsObject, "stopNotifications")) {
    throw UnsupportedError("JSObject does not have stopNotifications");
  }
  if (!_JSUtil.hasProperty(_jsObject, "addEventListener")) {
    throw UnsupportedError("JSObject does not have addEventListener");
  }
}