chipweinberger / flutter_blue_plus

Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android, iOS, macOS
Other
791 stars 478 forks source link

[Help]: The second time cannot be written #945

Closed zhaoxwgit closed 4 months ago

zhaoxwgit commented 4 months ago

Requirements

Have you checked this problem on the example app?

No

FlutterBluePlus Version

1.32.8

Flutter Version

3.19.6 and 3.22.3

What OS?

iOS

OS Version

17.5.1

Bluetooth Module

n32 mcu

What is your problem?

The second time cannot be written

Logs

flutter: [FBP] <setNotifyValue> args: {remote_id: 19CC7449-916B-6B4C-6AF5-0156D81FA962, service_uuid: ffe0, secondary_service_uuid: null, characteristic_uuid: ffe1, force_indications: false, enable: true}
flutter: [FBP] <setNotifyValue> result: true
flutter: [FBP] [[ OnDescriptorWritten ]] result: {error_string: success, remote_id: 19CC7449-916B-6B4C-6AF5-0156D81FA962, secondary_service_uuid: null, characteristic_uuid: ffe1, success: 1, value: 01000000, error_code: 0, service_uuid: ffe0, descriptor_uuid: 2902}
flutter: write: AA 70 01 00 2B 55
flutter: Is subscribed: true
flutter: [FBP] <writeCharacteristic> args: {remote_id: 19CC7449-916B-6B4C-6AF5-0156D81FA962, service_uuid: ffe0, secondary_service_uuid: null, characteristic_uuid: ffe1, write_type: 1, allow_long_write: 0, value: **aa7001002b55**}
flutter: [FBP] <writeCharacteristic> result: true
flutter: [FBP] [[ OnCharacteristicWritten ]] result: {remote_id: 19CC7449-916B-6B4C-6AF5-0156D81FA962, secondary_service_uuid: null, characteristic_uuid: ffe1, success: 1, value: aa7001002b55, error_code: 0, service_uuid: ffe0, error_string: success}
flutter: Write: Success
flutter: [FBP] [[ OnCharacteristicReceived ]] result: {remote_id: 19CC7449-916B-6B4C-6AF5-0156D81FA962, secondary_service_uuid: null, characteristic_uuid: ffe1, success: 1, value: aaf00f4d34310a252f01110101340c000000e755, error_code: 0, service_uuid: ffe0, error_string: success}
flutter: [170, 240, 15, 77, 52, 49, 10, 37, 47, 1, 17, 1, 1, 52, 12, 0, 0, 0, 231, 85]
flutter: get info:0
flutter: write: AA 70 01 01 75 55
flutter: Is subscribed: true
**flutter: [FBP] <writeCharacteristic> args: {remote_id: 19CC7449-916B-6B4C-6AF5-0156D81FA962, service_uuid: ffe0, secondary_service_uuid: null, characteristic_uuid: ffe1, write_type: 1, allow_long_write: 0, value: }**
flutter: [FBP] <writeCharacteristic> result: true
flutter: [FBP] [[ OnCharacteristicWritten ]] result: {remote_id: 19CC7449-916B-6B4C-6AF5-0156D81FA962, secondary_service_uuid: null, characteristic_uuid: ffe1, success: 1, value: , error_code: 0, service_uuid: ffe0, error_string: success}
flutter: Write: Success
zhaoxwgit commented 4 months ago

first: [FBP] args: {remote_id: 19CC7449-916B-6B4C-6AF5-0156D81FA962, service_uuid: ffe0, secondary_service_uuid: null, characteristic_uuid: ffe1, write_type: 1, allow_long_write: 0, value: aa7001002b55} second:[FBP] args: {remote_id: 19CC7449-916B-6B4C-6AF5-0156D81FA962, service_uuid: ffe0, secondary_service_uuid: null, characteristic_uuid: ffe1, write_type: 1, allow_long_write: 0, value: }

//bluetooth_characteristic.dart print("value - 0: $value"); // Only allow a single ble operation to be underway at a time _Mutex mtx = MutexFactory.getMutexForKey("global"); await mtx.take().then(() => print("value - 1: $value")); print("value - 2: $value"); //log flutter: value - 0: [170, 112, 1, 1, 117, 85] flutter: value - 1: [] flutter: value - 2: []

chipweinberger commented 4 months ago

not enough info. you'll need to debug this yourself. probably an issue in your code / ble device.

zhaoxwgit commented 4 months ago

await Characteristic.write() is work @chipweinberger tank you