import { KaitaiStreamWriter } from '@iotize/common/byte-stream';
import { TargetSerialModbusProtocolConfigurationConverter } from '../../generated/converters';
var PROTOCOL_CONF_CTR_LENGHT = 8;
var ReversedTargetSerialModbusConfigurationConverter = /** @class */ (function () {
    function ReversedTargetSerialModbusConfigurationConverter() {
        this.converter = new TargetSerialModbusProtocolConfigurationConverter();
    }
    ReversedTargetSerialModbusConfigurationConverter.prototype.decode = function (data) {
        return this.converter.decode(this._reorderBytes(data));
    };
    ReversedTargetSerialModbusConfigurationConverter.prototype.encode = function (settings) {
        return this._reorderBytes(this.converter.encode(settings));
    };
    ReversedTargetSerialModbusConfigurationConverter.prototype._reorderBytes = function (data) {
        return KaitaiStreamWriter.mergeArrays(data.slice(0, PROTOCOL_CONF_CTR_LENGHT).reverse(), data.slice(PROTOCOL_CONF_CTR_LENGHT));
    };
    return ReversedTargetSerialModbusConfigurationConverter;
}());
export { ReversedTargetSerialModbusConfigurationConverter };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV2ZXJzZWQtdGFyZ2V0LXByb3RvY29sLWNvbmZpZ3VyYXRpb24tY29udmVydGVyLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGlvdGl6ZS90YXAvc2VydmljZS9pbXBsL3RhcmdldC8iLCJzb3VyY2VzIjpbImxpYi9jdXN0b20vY29udmVydGVycy9yZXZlcnNlZC10YXJnZXQtcHJvdG9jb2wtY29uZmlndXJhdGlvbi1jb252ZXJ0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFFaEUsT0FBTyxFQUFFLGdEQUFnRCxFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFJOUYsSUFBTSx3QkFBd0IsR0FBRyxDQUFDLENBQUM7QUFFbkM7SUFBQTtRQUVXLGNBQVMsR0FBRyxJQUFJLGdEQUFnRCxFQUFFLENBQ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