36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
|
|
|
const abawoServiceBtUUIDPrefix = '0993826f-0ee4-4b37-9614';
|
|
const abawoUniversalShiftersServiceBtUUID =
|
|
'0993826f-0ee4-4b37-9614-d13ecba4ffc2';
|
|
|
|
const abawoManuIdentData = [0x41, 0x28, 0x18, 0xA9];
|
|
|
|
bool isAbawoDeviceGuid(Uuid guid) {
|
|
return guid
|
|
.toString()
|
|
.toLowerCase()
|
|
.replaceAll('-', '')
|
|
.startsWith(abawoServiceBtUUIDPrefix.toLowerCase().replaceAll('-', ''));
|
|
}
|
|
|
|
bool isAbawoUniversalShiftersDeviceGuid(Uuid guid) {
|
|
return guid == Uuid.parse(abawoUniversalShiftersServiceBtUUID);
|
|
}
|
|
|
|
bool isConnectableAbawoDeviceGuid(Uuid guid) {
|
|
return isAbawoUniversalShiftersDeviceGuid(guid);
|
|
}
|
|
|
|
bool hasConnectableAbawoDeviceGuid(List<Uuid> guid) => guid
|
|
.map((id) => isConnectableAbawoDeviceGuid(id))
|
|
.fold(false, (v, e) => v || e);
|
|
|
|
bool isAbawoDeviceIdent(List<int> manuData) {
|
|
if (manuData.length < abawoManuIdentData.length) return false;
|
|
for (int i = 0; i < abawoManuIdentData.length; i++) {
|
|
if (manuData[i] != abawoManuIdentData[i]) return false;
|
|
}
|
|
return true;
|
|
}
|