addServiceClass method
Add a service class, according to complete
Implementation
void addServiceClass(ServiceClass serviceClass, {bool complete = false}) {
var bytes = serviceClass.bytes;
late EIRType remain, remove;
if (bytes.length == 2) {
if (complete == false) {
remain = EIRType.Inc16BitUUID;
remove = EIRType.Com16BitUUID;
} else {
remain = EIRType.Com16BitUUID;
remove = EIRType.Inc16BitUUID;
}
} else if (bytes.length == 4) {
if (complete == false) {
remain = EIRType.Inc32BitUUID;
remove = EIRType.Com32BitUUID;
} else {
remain = EIRType.Com32BitUUID;
remove = EIRType.Inc32BitUUID;
}
} else if (bytes.length == 16) {
if (complete == false) {
remain = EIRType.Inc128BitUUID;
remove = EIRType.Com128BitUUID;
} else {
remain = EIRType.Com128BitUUID;
remove = EIRType.Inc128BitUUID;
}
}
attributes[remain] = Uint8List.fromList(
(attributes.containsKey(remain) ? attributes[remain] : [])! +
(attributes.containsKey(remove) ? attributes[remove]! : []) +
bytes as List<int>);
if (attributes.containsKey(remove)) {
attributes.remove(remove);
}
}