unlockPairing method
Implementation
Future<void> unlockPairing({String psk = 'viamsetup'}) async {
final bleService = await getBleService();
final cryptoCharacteristic = bleService.characteristics.firstWhere(
(char) => char.uuid.str == ViamBluetoothUUIDs.cryptoUUID,
orElse: () => throw Exception('cryptoCharacteristic not found'),
);
final publicKeyBytes = await cryptoCharacteristic.read();
final publicKey = _publicKey(Uint8List.fromList(publicKeyBytes));
final encoder = _encoder(publicKey);
final unlockPairingCharacteristic = bleService.characteristics.firstWhere(
(char) => char.uuid.str == ViamBluetoothUUIDs.unlockPairingUUID,
orElse: () => throw Exception('unlockPairingCharacteristic not found'),
);
// "1" is expected by the device
await unlockPairingCharacteristic.write(encoder.process(utf8.encode("$psk:1")));
}