setCharacteristicNotification method

Future<void> setCharacteristicNotification({
  1. required String deviceId,
  2. required String serviceUuid,
  3. required String characteristicUuid,
  4. required bool enable,
})

开启或关闭 GATT 特征通知/指示。

参数:

  • deviceId:已连接设备标识,无默认值。
  • serviceUuid:服务 UUID,无默认值。
  • characteristicUuid:特征 UUID,无默认值。
  • enabletrue 开启,false 关闭,无默认值。

收到的数据从 characteristicValues 监听。Android 会写 CCCD;iOS/macOS 使用 CoreBluetooth 的通知订阅接口;Linux 使用 BlueZ StartNotify/StopNotify 并监听 PropertiesChanged(Value);Windows 写入 CCCD 并监听 WinRT ValueChanged;Web 使用 startNotifications(),不会直接写 CCCD。

Implementation

Future<void> setCharacteristicNotification({
  required String deviceId,
  required String serviceUuid,
  required String characteristicUuid,
  required bool enable,
}) {
  throw UnimplementedError(
    'setCharacteristicNotification() has not been implemented.',
  );
}