onDataReceived method

  1. @override
void onDataReceived(
  1. String deviceId,
  2. String serviceUuid,
  3. String characteristicUuid,
  4. Uint8List data,
)
override

Implementation

@override
void onDataReceived(String deviceId, String serviceUuid,
    String characteristicUuid, Uint8List data) {
  String uuid = characteristicUuid.toLowerCase();
  // byte[] value = characteristic.getValue();
  String hex = data.toHex(withSpace: true);

  if (Uuids.tiOADImageIdentify == uuid) {
    print("$_tag Image Identify Rx: $deviceId [$hex]");

    int status = data[0];
    if (status == 0) {
      _writeCtrlCMD(_ctrlCmdStartOADProcess);
    } else {
      print(
          "$_tag Image Identify Error($status): ${OADStatus.getMessage(status)}");
      mListener?.onStatusChange(deviceId, status);
    }
  } else if (Uuids.tiOADControlPoint == uuid) {
    //Log.e(TAG, "Image Control Point Rx: " + hex);
    _handleControlPointResponse(deviceId, data);
  }
}