BluetoothGattServerRequest constructor

const BluetoothGattServerRequest({
  1. required String event,
  2. required String deviceId,
  3. String? serviceUuid,
  4. String? characteristicUuid,
  5. String? descriptorUuid,
  6. int? requestId,
  7. int offset = 0,
  8. List<int> value = const <int>[],
  9. bool preparedWrite = false,
  10. bool responseNeeded = false,
  11. Map<String, dynamic> raw = const <String, dynamic>{},
})

创建 GATT Server 请求事件。

参数:

  • event:事件名称,无默认值。常见值包括 serviceAddedconnectionStatecharacteristicReadcharacteristicWritedescriptorReaddescriptorWritesubscribedunsubscribednotificationSent
  • deviceId:中心设备标识,无默认值;iOS/macOS 为 central UUID,Android 为设备地址。
  • serviceUuid:服务 UUID,默认 null
  • characteristicUuid:特征 UUID,默认 null
  • descriptorUuid:描述符 UUID,默认 null
  • requestId:Android GATT 请求 ID,默认 null;iOS/macOS 通常为空。
  • offset:读写偏移,默认 0
  • value:请求或响应字节数组,默认 const <int>[]
  • preparedWrite:是否 prepared write,默认 false;主要 Android 有意义。
  • responseNeeded:是否需要响应,默认 false
  • raw:原生完整字段,默认 const <String, dynamic>{}

Implementation

const BluetoothGattServerRequest({
  required this.event,
  required this.deviceId,
  this.serviceUuid,
  this.characteristicUuid,
  this.descriptorUuid,
  this.requestId,
  this.offset = 0,
  this.value = const <int>[],
  this.preparedWrite = false,
  this.responseNeeded = false,
  this.raw = const <String, dynamic>{},
});