boskokg / flutter_blue_plus

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

[Help]: Can't print even when char write is true #865

Closed shayant98 closed 2 months ago

shayant98 commented 2 months ago

Requirements

Have you checked this problem on the example app?

Yes

FlutterBluePlus Version

1.32.4

Flutter Version

3.19.5

What OS?

Android

OS Version

14

Bluetooth Module

Zebra ZD621

What is your problem?

tried printing but keep getting

FlutterBluePlusException | writeCharacteristic | android-code: 3 | GATT_WRITE_NOT_PERMITTED

I hope someone can help me

Logs

I/flutter (29906):  Printer2Service | sendZPLCommands - Service: BluetoothService{remoteId: 00:07:4D:E4:DD:E2, serviceUuid: 1800, isPrimary: true, characteristics: [BluetoothCharacteristic{remoteId: 00:07:4D:E4:DD:E2, serviceUuid: 1800, secondaryServiceUuid: null, characteristicUuid: 2a00, descriptors: [], properties: CharacteristicProperties{broadcast: false, read: true, writeWithoutResponse: false, write: true, notify: false, indicate: false, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryptionRequired: false, indicateEncryptionRequired: false}, value: []}, BluetoothCharacteristic{remoteId: 00:07:4D:E4:DD:E2, serviceUuid: 1800, secondaryServiceUuid: null, characteristicUuid: 2a01, descriptors: [], properties: CharacteristicProperties{broadcast: false, read: true, writeWithoutRespon
I/flutter (29906): se: false, write: true, notify: false, indicate: false, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryptionRequired: false, indicateEncryptionRequired: false}, value: []}, BluetoothCharacteristic{remoteId: 00:07:4D:E4:DD:E2, serviceUuid: 1800, secondaryServiceUuid: null, characteristicUuid: 2a04, descriptors: [], properties: CharacteristicProperties{broadcast: false, read: true, writeWithoutResponse: false, write: false, notify: false, indicate: false, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryptionRequired: false, indicateEncryptionRequired: false}, value: []}, BluetoothCharacteristic{remoteId: 00:07:4D:E4:DD:E2, serviceUuid: 1800, secondaryServiceUuid: null, characteristicUuid: 2aa6, descriptors: [], properties: CharacteristicProper
I/flutter (29906): ties{broadcast: false, read: true, writeWithoutResponse: false, write: false, notify: false, indicate: false, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryptionRequired: false, indicateEncryptionRequired: false}, value: []}], includedServices: []}
D/[FBP-Android](29906): [FBP] onMethodCall: writeCharacteristic
E/[FBP-Android](29906): [FBP] onCharacteristicWrite:
E/[FBP-Android](29906): [FBP]   chr: 2a00
E/[FBP-Android](29906): [FBP]   status: GATT_WRITE_NOT_PERMITTED (3)
E/flutter (29906): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FlutterBluePlusException | writeCharacteristic | android-code: 3 | GATT_WRITE_NOT_PERMITTED
E/flutter (29906): #0      BluetoothCharacteristic.write (package:flutter_blue_plus/src/bluetooth_characteristic.dart:216:9)
E/flutter (29906): <asynchronous suspension>
E/flutter (29906): #1      Printer2Service.sendZPLCommands (package:wms/services/printer2_service.dart:54:11)
E/flutter (29906): <asynchronous suspension>
E/flutter (29906): 
chipweinberger commented 2 months ago

this error code is returned by your ble device, not FBP. there is nothing we can do.

char.properties.write is not a guarantee. it's reported by the device and the device can lie.