NativeBluetoothRemoteGATTServer.fromJSObject constructor

NativeBluetoothRemoteGATTServer.fromJSObject(
  1. Object _jsObject,
  2. WebBluetoothDevice device
)

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 WebBluetoothDevice.gatt.

Implementation

NativeBluetoothRemoteGATTServer.fromJSObject(this._jsObject, this.device) {
  if (!_JSUtil.hasProperty(_jsObject, "connected")) {
    throw UnsupportedError("JSObject does not have connected");
  }
  if (!_JSUtil.hasProperty(_jsObject, "device")) {
    throw UnsupportedError("JSObject does not have device");
  }
  if (!_JSUtil.hasProperty(_jsObject, "connect")) {
    throw UnsupportedError("JSObject does not have connect");
  }
  if (!_JSUtil.hasProperty(_jsObject, "disconnect")) {
    throw UnsupportedError("JSObject does not have disconnect");
  }
  if (!_JSUtil.hasProperty(_jsObject, "getPrimaryService")) {
    throw UnsupportedError("JSObject does not have getPrimaryService");
  }
  if (!_JSUtil.hasProperty(_jsObject, "getPrimaryServices")) {
    throw UnsupportedError("JSObject does not have getPrimaryServices");
  }
}