parser property

  1. @override
BleResponseParser<ParamGetByCloudIdReply> get parser
override

Implementation

@override
BleResponseParser<ParamGetByCloudIdReply> get parser =>
    EnvelopeBleResponseParser<ParamGetByCloudIdReply>(
      (responseEnvelope) {
        final response = responseEnvelope.responseArgs ?? const <dynamic>[];
        final secondArg = response.elementAtOrNull(1);
        final thirdArg = response.elementAtOrNull(2);

        final secondAsInt = _toInt(secondArg);
        final hasUidArg = secondArg != null && secondAsInt == null;

        return ParamGetByCloudIdReply(
          dataSource: _toInt(response.elementAtOrNull(0)) ?? dataSource.value,
          dataSourceUid: hasUidArg ? _toStringValue(secondArg) : null,
          pathToRead: hasUidArg
              ? _toStringValue(thirdArg)
              : _toStringValue(secondArg),
          errorCodes: _toIntList(responseEnvelope.errors),
        );
      },
    );