registerCharacteristics method

Future<void> registerCharacteristics()

Implementation

Future<void> registerCharacteristics() async {
  /// simulator
  if (isSimulator) return _setupBleStreams();

  /// Non-simulator
  if (device == null) return;

  final services = await device!.discoverServices();
  for (final service in services) {
    final characteristics = service.characteristics;
    for (final characteristic in characteristics) {
      uuid.characteristic.forEach(
        (key, value) {
          final uuid = characteristic.uuid.str128;
          if (value == null) return;
          if (uuid.toLowerCase() == value.toLowerCase()) {
            '${key.name} was registered [${uuid.toLowerCase()}]'.log;
            points[key] = characteristic;
          }
        },
      );
    }
  }
  _setupBleStreams();
}