PhilipsHue / flutter_reactive_ble

Flutter library that handles BLE operations for multiple devices.
https://developers.meethue.com/
Other
661 stars 321 forks source link

No response value for long commands. #825

Closed kimdindoo closed 3 months ago

kimdindoo commented 8 months ago

MTU is set to maximum.

          String? foundDeviceId = await storage.read(key: DEVICE_ID);

          String dataToSend =
              'set_cfg bpt cal_result C9840300077D0000780000004600000000000000A6B3003C00008542588C4F40D43930BBE345563D852F153EB5BC873E68EECC3E362A093FB51B273F6BE43E3F488F523F905A623F52BF6D3FF703753F5605793F9E117A3FBBD9793F201A793F5E0A783FC96F783F7CD3793FAC957B3FD76A7C3FC34A7C3FB7067A3FA8CF763FFBC1723FA1386D3F3F99663FC4735E3F37D8553FBE194D3F77E9433F21733A3F04DF303F1A01273F874B1D3F7E81143F80E20A3FF4DD003F0613EE3EF004DB3EFDC8C73EEE1FB23EC78C9B3E97A8863E3274603ED67E2D3EEEE5EE3DBB9A823D90DA813C31EA5EBC000000004D4D4D4\n';

          List<int> dataBytes = utf8.encode(dataToSend);
          for (int i = 0; i < dataBytes.length; i += 16) {
            int end = i + 16 < dataBytes.length ? i + 16 : dataBytes.length;
            List<int> chunk = dataBytes.sublist(i, end);

            final characteristic = QualifiedCharacteristic(
              serviceId: Uuid.parse('6E400000-B5A3-F393-E0A9-E50E24DCCA9E'),
              characteristicId:
                  Uuid.parse('6E400002-B5A3-F393-E0A9-E50E24DCCA9E'),
              deviceId: foundDeviceId!,
            );

            flutterReactiveBle.writeCharacteristicWithResponse(
                characteristic,
                value: chunk);
          }

Since the Bluetooth device can read 16 bytes at a time, I implemented it like the code above. However, no response value comes.

Taym95 commented 3 months ago

I don't think this is library issue, please check your device