-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
When trying to connect to the server hosted on an Android device, it opens a pairing request on both server and client.
The service and advertising looks like this:
await BlePeripheral.addService(
BleService(
uuid: serviceTicketing,
primary: true,
characteristics: [
BleCharacteristic(
uuid: characteristicTicketing,
properties: [
CharacteristicProperties.write.index,
],
value: null,
permissions: [AttributePermissions.writeable.index],
),
],
),
);
/// set callback for advertising state
BlePeripheral.setAdvertisingStatusUpdateCallback(
(bool advertising, String? error) {
print("AdvertisingStatus: $advertising Error $error");
});
BlePeripheral.setWriteRequestCallback(
(deviceId, characteristicId, offset, value) {
print(
"WriteRequest: $deviceId ${String.fromCharCodes(value?.toList() ?? [])} : $offset : $value ");
final userId = String.fromCharCodes(value?.toList() ?? []);
if (userId.isNotEmpty) {
addUserId(userId);
}
return null;
});
// Start advertising
await BlePeripheral.startAdvertising(
services: [serviceTicketing],
localName: "ticketing",
);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels