"use strict";
/**
 * This file has been generated
 * DO NOT EDIT, IT MAY BE OVERWRITTEN
 */
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
var import_adapter_1 = require("./import-adapter");
var models_1 = require("../model/models");
var VariableFormatConverter = /** @class */ (function (_super) {
    __extends(VariableFormatConverter, _super);
    function VariableFormatConverter() {
        return _super.call(this, models_1.VariableFormat, 1) || this;
    }
    return VariableFormatConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.VariableFormatConverter = VariableFormatConverter;
var VariableTypeConverter = /** @class */ (function (_super) {
    __extends(VariableTypeConverter, _super);
    function VariableTypeConverter() {
        return _super.call(this, models_1.VariableType, 1) || this;
    }
    return VariableTypeConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.VariableTypeConverter = VariableTypeConverter;
var AvailablePowerSourceConverter = /** @class */ (function (_super) {
    __extends(AvailablePowerSourceConverter, _super);
    function AvailablePowerSourceConverter() {
        return _super.call(this, models_1.AvailablePowerSource, 1) || this;
    }
    return AvailablePowerSourceConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.AvailablePowerSourceConverter = AvailablePowerSourceConverter;
var FirmwareStateConverter = /** @class */ (function (_super) {
    __extends(FirmwareStateConverter, _super);
    function FirmwareStateConverter() {
        return _super.call(this, models_1.FirmwareState, 1) || this;
    }
    return FirmwareStateConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.FirmwareStateConverter = FirmwareStateConverter;
var FirmwareUpdateResultConverter = /** @class */ (function (_super) {
    __extends(FirmwareUpdateResultConverter, _super);
    function FirmwareUpdateResultConverter() {
        return _super.call(this, models_1.FirmwareUpdateResult, 1) || this;
    }
    return FirmwareUpdateResultConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.FirmwareUpdateResultConverter = FirmwareUpdateResultConverter;
var HostProtocolConverter = /** @class */ (function (_super) {
    __extends(HostProtocolConverter, _super);
    function HostProtocolConverter() {
        return _super.call(this, models_1.HostProtocol, 2) || this;
    }
    return HostProtocolConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.HostProtocolConverter = HostProtocolConverter;
var LowPowerOptimisationLevelConverter = /** @class */ (function (_super) {
    __extends(LowPowerOptimisationLevelConverter, _super);
    function LowPowerOptimisationLevelConverter() {
        return _super.call(this, models_1.LowPowerOptimisationLevel, 1) || this;
    }
    return LowPowerOptimisationLevelConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.LowPowerOptimisationLevelConverter = LowPowerOptimisationLevelConverter;
var NetworkModeConverter = /** @class */ (function (_super) {
    __extends(NetworkModeConverter, _super);
    function NetworkModeConverter() {
        return _super.call(this, models_1.NetworkMode, 1) || this;
    }
    return NetworkModeConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.NetworkModeConverter = NetworkModeConverter;
var CloudConnectionModeConverter = /** @class */ (function (_super) {
    __extends(CloudConnectionModeConverter, _super);
    function CloudConnectionModeConverter() {
        return _super.call(this, models_1.CloudConnectionMode, 1) || this;
    }
    return CloudConnectionModeConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.CloudConnectionModeConverter = CloudConnectionModeConverter;
var TargetProtocolConverter = /** @class */ (function (_super) {
    __extends(TargetProtocolConverter, _super);
    function TargetProtocolConverter() {
        return _super.call(this, models_1.TargetProtocol, 1) || this;
    }
    return TargetProtocolConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.TargetProtocolConverter = TargetProtocolConverter;
var CoreTypeConverter = /** @class */ (function (_super) {
    __extends(CoreTypeConverter, _super);
    function CoreTypeConverter() {
        return _super.call(this, models_1.CoreType, 1) || this;
    }
    return CoreTypeConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.CoreTypeConverter = CoreTypeConverter;
var NfcPairingModeConverter = /** @class */ (function (_super) {
    __extends(NfcPairingModeConverter, _super);
    function NfcPairingModeConverter() {
        return _super.call(this, models_1.NfcPairingMode, 1) || this;
    }
    return NfcPairingModeConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.NfcPairingModeConverter = NfcPairingModeConverter;
var TargetCoreTypeConverter = /** @class */ (function (_super) {
    __extends(TargetCoreTypeConverter, _super);
    function TargetCoreTypeConverter() {
        return _super.call(this, models_1.TargetCoreType, 1) || this;
    }
    return TargetCoreTypeConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.TargetCoreTypeConverter = TargetCoreTypeConverter;
var SpecialFeatureConverter = /** @class */ (function (_super) {
    __extends(SpecialFeatureConverter, _super);
    function SpecialFeatureConverter() {
        return _super.call(this, models_1.SpecialFeature, 1) || this;
    }
    return SpecialFeatureConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.SpecialFeatureConverter = SpecialFeatureConverter;
var NfcConnectionPriorityConverter = /** @class */ (function (_super) {
    __extends(NfcConnectionPriorityConverter, _super);
    function NfcConnectionPriorityConverter() {
        return _super.call(this, models_1.NfcConnectionPriority, 1) || this;
    }
    return NfcConnectionPriorityConverter;
}(import_adapter_1.FixedSizeEnumConverter));
exports.NfcConnectionPriorityConverter = NfcConnectionPriorityConverter;
var AclEntryConverter = /** @class */ (function () {
    function AclEntryConverter() {
    }
    AclEntryConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.forwardBits(3);
        stream.writeBitsBoolean(model.create, 1);
        stream.writeBitsBoolean(model.delete, 1);
        stream.writeBitsBoolean(model.execute, 1);
        stream.writeBitsBoolean(model.write, 1);
        stream.writeBitsBoolean(model.read, 1);
        return stream.toBytes;
    };
    AclEntryConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        stream.forwardBits(3);
        model.create = stream.readBitsBoolean(1);
        model.delete = stream.readBitsBoolean(1);
        model.execute = stream.readBitsBoolean(1);
        model.write = stream.readBitsBoolean(1);
        model.read = stream.readBitsBoolean(1);
        return model;
    };
    return AclEntryConverter;
}());
exports.AclEntryConverter = AclEntryConverter;
var MemoryInfoConverter = /** @class */ (function () {
    function MemoryInfoConverter() {
    }
    MemoryInfoConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeU4(model.address);
        stream.writeU4(model.length);
        stream.writeBitsInt(/*parseInt(VariableFormat[*/ model.format /*])*/, 8);
        return stream.toBytes;
    };
    MemoryInfoConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.address = stream.readU4();
        model.length = stream.readU4();
        model.format = /*MemoryInfo.VariableFormat[*/ stream.readU1();
        return model;
    };
    return MemoryInfoConverter;
}());
exports.MemoryInfoConverter = MemoryInfoConverter;
var MemoryWriteInfoConverter = /** @class */ (function () {
    function MemoryWriteInfoConverter() {
    }
    MemoryWriteInfoConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeMemoryInfo(model.info);
        stream.writeBytes(model.data);
        return stream.toBytes;
    };
    MemoryWriteInfoConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.info = stream.readMemoryInfo();
        model.data = stream.readBytesFull();
        return model;
    };
    return MemoryWriteInfoConverter;
}());
exports.MemoryWriteInfoConverter = MemoryWriteInfoConverter;
var ReadWriteRightsConverter = /** @class */ (function () {
    function ReadWriteRightsConverter() {
    }
    ReadWriteRightsConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeU2(model.groupId);
        stream.forwardBits(6);
        stream.writeBitsBoolean(model.write, 1);
        stream.writeBitsBoolean(model.read, 1);
        return stream.toBytes;
    };
    ReadWriteRightsConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.groupId = stream.readU2();
        stream.forwardBits(6);
        model.write = stream.readBitsBoolean(1);
        model.read = stream.readBitsBoolean(1);
        return model;
    };
    return ReadWriteRightsConverter;
}());
exports.ReadWriteRightsConverter = ReadWriteRightsConverter;
var DataLogOptionConverter = /** @class */ (function () {
    function DataLogOptionConverter() {
    }
    DataLogOptionConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.forwardBits(6);
        stream.writeBitsBoolean(model.security, 1);
        stream.writeBitsBoolean(model.qos, 1);
        stream.forwardBits(5);
        stream.writeBitsBoolean(model.logOnChange, 1);
        stream.writeBitsBoolean(model.rollingMode, 1);
        stream.writeBitsBoolean(model.autorun, 1);
        return stream.toBytes;
    };
    DataLogOptionConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        stream.forwardBits(6);
        model.security = stream.readBitsBoolean(1);
        model.qos = stream.readBitsBoolean(1);
        stream.forwardBits(5);
        model.logOnChange = stream.readBitsBoolean(1);
        model.rollingMode = stream.readBitsBoolean(1);
        model.autorun = stream.readBitsBoolean(1);
        return model;
    };
    return DataLogOptionConverter;
}());
exports.DataLogOptionConverter = DataLogOptionConverter;
var UartSettingsConverter = /** @class */ (function () {
    function UartSettingsConverter() {
    }
    UartSettingsConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeU1(model.slv);
        stream.forwardBits(3);
        stream.writeBitsBoolean(model.ofs, 1);
        stream.writeBitsInt(model.baudRate, 20);
        stream.forwardBits(4);
        stream.writeBitsInt(/*parseInt(UartSettings.PhysicalPort[*/ model.physicalPort /*])*/, 4);
        stream.writeBitsInt(/*parseInt(UartSettings.StopBit[*/ model.stopBit /*])*/, 2);
        stream.writeBitsInt(/*parseInt(UartSettings.BitParity[*/ model.bitParity /*])*/, 4);
        stream.writeBitsInt(/*parseInt(UartSettings.DataBitsLength[*/ model.dataBitsLength /*])*/, 2);
        stream.writeBitsInt(/*parseInt(UartSettings.HandshakeDelimiter[*/ model.handshakeDelimiter /*])*/, 4);
        stream.writeBitsInt(/*parseInt(UartSettings.Handshake[*/ model.handshakeValue /*])*/, 4);
        stream.writeU1(model.timeout);
        return stream.toBytes;
    };
    UartSettingsConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.slv = stream.readU1();
        stream.forwardBits(3);
        model.ofs = stream.readBitsBoolean(1);
        model.baudRate = stream.readBitsInt(20);
        stream.forwardBits(4);
        model.physicalPort = /*UartSettings.PhysicalPort[*/ stream.readBitsInt(4);
        model.stopBit = /*UartSettings.StopBit[*/ stream.readBitsInt(2);
        model.bitParity = /*UartSettings.BitParity[*/ stream.readBitsInt(4);
        model.dataBitsLength = /*UartSettings.DataBitsLength[*/ stream.readBitsInt(2);
        model.handshakeDelimiter = /*UartSettings.HandshakeDelimiter[*/ stream.readBitsInt(4);
        model.handshakeValue = /*UartSettings.Handshake[*/ stream.readBitsInt(4);
        model.timeout = stream.readU1();
        return model;
    };
    return UartSettingsConverter;
}());
exports.UartSettingsConverter = UartSettingsConverter;
var ProtocolConfigurationConverter = /** @class */ (function () {
    function ProtocolConfigurationConverter() {
    }
    ProtocolConfigurationConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeU1(model.slv);
        stream.forwardBits(3);
        stream.writeBitsBoolean(model.ofs, 1);
        stream.writeBitsInt(model.baudRate, 20);
        stream.writeBitsBoolean(model.identification, 1);
        stream.forwardBits(1);
        stream.writeBitsBoolean(model.ledStatus, 1);
        stream.forwardBits(1);
        stream.writeBitsInt(/*parseInt(UartSettings.PhysicalPort[*/ model.physicalPort /*])*/, 4);
        stream.writeBitsInt(/*parseInt(UartSettings.StopBit[*/ model.stopBit /*])*/, 2);
        stream.writeBitsInt(/*parseInt(UartSettings.BitParity[*/ model.bitParity /*])*/, 4);
        stream.writeBitsInt(/*parseInt(UartSettings.DataBitsLength[*/ model.dataBitsLength /*])*/, 2);
        stream.writeBitsInt(/*parseInt(UartSettings.HandshakeDelimiter[*/ model.handshakeDelimiter /*])*/, 4);
        stream.writeBitsInt(/*parseInt(UartSettings.Handshake[*/ model.handshakeValue /*])*/, 4);
        stream.writeU1(model.timeout);
        stream.writeProtocolConfigurationUsbSettings(model.usbSettings);
        return stream.toBytes;
    };
    ProtocolConfigurationConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.slv = stream.readU1();
        stream.forwardBits(3);
        model.ofs = stream.readBitsBoolean(1);
        model.baudRate = stream.readBitsInt(20);
        model.identification = stream.readBitsBoolean(1);
        stream.forwardBits(1);
        model.ledStatus = stream.readBitsBoolean(1);
        stream.forwardBits(1);
        model.physicalPort = /*ProtocolConfiguration.UartSettingsPhysicalPort[*/ stream.readBitsInt(4);
        model.stopBit = /*ProtocolConfiguration.UartSettingsStopBit[*/ stream.readBitsInt(2);
        model.bitParity = /*ProtocolConfiguration.UartSettingsBitParity[*/ stream.readBitsInt(4);
        model.dataBitsLength = /*ProtocolConfiguration.UartSettingsDataBitsLength[*/ stream.readBitsInt(2);
        model.handshakeDelimiter = /*ProtocolConfiguration.UartSettingsHandshakeDelimiter[*/ stream.readBitsInt(4);
        model.handshakeValue = /*ProtocolConfiguration.UartSettingsHandshake[*/ stream.readBitsInt(4);
        model.timeout = stream.readU1();
        model.usbSettings = stream.readProtocolConfigurationUsbSettings();
        return model;
    };
    return ProtocolConfigurationConverter;
}());
exports.ProtocolConfigurationConverter = ProtocolConfigurationConverter;
var TapVersionConverter = /** @class */ (function () {
    function TapVersionConverter() {
    }
    TapVersionConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeU1(model.major);
        stream.writeU1(model.minor);
        stream.writeU2(model.patch);
        return stream.toBytes;
    };
    TapVersionConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.major = stream.readU1();
        model.minor = stream.readU1();
        model.patch = stream.readU2();
        return model;
    };
    return TapVersionConverter;
}());
exports.TapVersionConverter = TapVersionConverter;
var Lwm2mTlvConverter = /** @class */ (function () {
    function Lwm2mTlvConverter() {
    }
    Lwm2mTlvConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeBitsInt(model.identifierType, 2);
        stream.writeBitsBoolean(model.identifierLength, 1);
        stream.writeBitsInt(model.lengthType, 2);
        stream.writeBitsInt(model.other, 3);
        stream.writeBytes(model.identifier, 1);
        stream.writeU2(model.len);
        stream.writeBytes(model.value);
        return stream.toBytes;
    };
    Lwm2mTlvConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.identifierType = stream.readBitsInt(2);
        model.identifierLength = stream.readBitsBoolean(1);
        model.lengthType = stream.readBitsInt(2);
        model.other = stream.readBitsInt(3);
        model.identifier = stream.readBytes(1);
        model.len = stream.readU2();
        model.value = stream.readBytesFull();
        return model;
    };
    return Lwm2mTlvConverter;
}());
exports.Lwm2mTlvConverter = Lwm2mTlvConverter;
var InterfaceLockConverter = /** @class */ (function () {
    function InterfaceLockConverter() {
    }
    InterfaceLockConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.forwardBits(8);
        stream.forwardBits(3);
        stream.writeBitsBoolean(model.scramActivated, 1);
        stream.writeBitsBoolean(model.hashPassword, 1);
        stream.writeBitsBoolean(model.factoryReset, 1);
        stream.writeBitsBoolean(model.resourceLogUid, 1);
        stream.writeBitsBoolean(model.resourceFactory, 1);
        return stream.toBytes;
    };
    InterfaceLockConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        stream.forwardBits(8);
        stream.forwardBits(3);
        model.scramActivated = stream.readBitsBoolean(1);
        model.hashPassword = stream.readBitsBoolean(1);
        model.factoryReset = stream.readBitsBoolean(1);
        model.resourceLogUid = stream.readBitsBoolean(1);
        model.resourceFactory = stream.readBitsBoolean(1);
        return model;
    };
    return InterfaceLockConverter;
}());
exports.InterfaceLockConverter = InterfaceLockConverter;
var LoginCredentialConverter = /** @class */ (function () {
    function LoginCredentialConverter() {
    }
    LoginCredentialConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeStr(model.username, 16);
        stream.writeStr(model.password, 16);
        return stream.toBytes;
    };
    LoginCredentialConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.username = stream.readStr(16);
        model.password = stream.readStr(16);
        return model;
    };
    return LoginCredentialConverter;
}());
exports.LoginCredentialConverter = LoginCredentialConverter;
var LoginCredentialHashedConverter = /** @class */ (function () {
    function LoginCredentialHashedConverter() {
    }
    LoginCredentialHashedConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeStr(model.username, 16);
        stream.writeBytes(model.password, 16);
        return stream.toBytes;
    };
    LoginCredentialHashedConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.username = stream.readStr(16);
        model.password = stream.readBytes(16);
        return model;
    };
    return LoginCredentialHashedConverter;
}());
exports.LoginCredentialHashedConverter = LoginCredentialHashedConverter;
var ScramLoginParamsConverter = /** @class */ (function () {
    function ScramLoginParamsConverter() {
    }
    ScramLoginParamsConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeStr(model.username, 16);
        stream.writeU4(model.clientNonce);
        return stream.toBytes;
    };
    ScramLoginParamsConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.username = stream.readStr(16);
        model.clientNonce = stream.readU4();
        return model;
    };
    return ScramLoginParamsConverter;
}());
exports.ScramLoginParamsConverter = ScramLoginParamsConverter;
var ScramLoginResponseBodyConverter = /** @class */ (function () {
    function ScramLoginResponseBodyConverter() {
    }
    ScramLoginResponseBodyConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeU4(model.serverNonce);
        stream.writeBytes(model.salt, 4);
        stream.writeU4(model.iterationNumber);
        return stream.toBytes;
    };
    ScramLoginResponseBodyConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.serverNonce = stream.readU4();
        model.salt = stream.readBytes(4);
        model.iterationNumber = stream.readU4();
        return model;
    };
    return ScramLoginResponseBodyConverter;
}());
exports.ScramLoginResponseBodyConverter = ScramLoginResponseBodyConverter;
var TargetComStatsConverter = /** @class */ (function () {
    function TargetComStatsConverter() {
    }
    TargetComStatsConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeU4(model.nbFailCom);
        stream.writeU4(model.nbSuccessfulCom);
        return stream.toBytes;
    };
    TargetComStatsConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.nbFailCom = stream.readU4();
        model.nbSuccessfulCom = stream.readU4();
        return model;
    };
    return TargetComStatsConverter;
}());
exports.TargetComStatsConverter = TargetComStatsConverter;
var AvailableFunctionConverter = /** @class */ (function () {
    function AvailableFunctionConverter() {
    }
    AvailableFunctionConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.forwardBits(6);
        stream.writeBitsBoolean(model.debug, 1);
        stream.writeBitsBoolean(model.dataLog, 1);
        return stream.toBytes;
    };
    AvailableFunctionConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        stream.forwardBits(6);
        model.debug = stream.readBitsBoolean(1);
        model.dataLog = stream.readBitsBoolean(1);
        return model;
    };
    return AvailableFunctionConverter;
}());
exports.AvailableFunctionConverter = AvailableFunctionConverter;
var MultiRequestConverter = /** @class */ (function () {
    function MultiRequestConverter() {
    }
    MultiRequestConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        for (var _i = 0, _a = model.requests; _i < _a.length; _i++) {
            var item = _a[_i];
            stream.writeMultiRequestRequestItem(item);
        }
        return stream.toBytes;
    };
    MultiRequestConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        while (!stream.isEof()) {
            model.requests = model.requests || [];
            model.requests.push(stream.readMultiRequestRequestItem());
        }
        return model;
    };
    return MultiRequestConverter;
}());
exports.MultiRequestConverter = MultiRequestConverter;
var MultiResponseConverter = /** @class */ (function () {
    function MultiResponseConverter() {
    }
    MultiResponseConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        for (var _i = 0, _a = model.responses; _i < _a.length; _i++) {
            var item = _a[_i];
            stream.writeMultiResponseResponseItem(item);
        }
        return stream.toBytes;
    };
    MultiResponseConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        while (!stream.isEof()) {
            model.responses = model.responses || [];
            model.responses.push(stream.readMultiResponseResponseItem());
        }
        return model;
    };
    return MultiResponseConverter;
}());
exports.MultiResponseConverter = MultiResponseConverter;
var CrcCheckBodyConverter = /** @class */ (function () {
    function CrcCheckBodyConverter() {
    }
    CrcCheckBodyConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeU4(model.address);
        stream.writeU4(model.size);
        stream.writeU4(model.crc);
        return stream.toBytes;
    };
    CrcCheckBodyConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.address = stream.readU4();
        model.size = stream.readU4();
        model.crc = stream.readU4();
        return model;
    };
    return CrcCheckBodyConverter;
}());
exports.CrcCheckBodyConverter = CrcCheckBodyConverter;
var SinglePacketConverter = /** @class */ (function () {
    function SinglePacketConverter() {
    }
    SinglePacketConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeU4(model.sendTime);
        stream.writeSinglePacketOuterHeader(model.outerHeader);
        stream.writeSinglePacketPayload(model.payload);
        return stream.toBytes;
    };
    SinglePacketConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.sendTime = stream.readU4();
        model.outerHeader = stream.readSinglePacketOuterHeader();
        model.payload = stream.readSinglePacketPayload();
        return model;
    };
    return SinglePacketConverter;
}());
exports.SinglePacketConverter = SinglePacketConverter;
var AclEntriesConverter = /** @class */ (function () {
    function AclEntriesConverter() {
    }
    AclEntriesConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        for (var _i = 0, _a = model.items; _i < _a.length; _i++) {
            var item = _a[_i];
            stream.writeAclEntry(item);
        }
        return stream.toBytes;
    };
    AclEntriesConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        while (!stream.isEof()) {
            model.items = model.items || [];
            model.items.push(stream.readAclEntry());
        }
        return model;
    };
    return AclEntriesConverter;
}());
exports.AclEntriesConverter = AclEntriesConverter;
var LoraConfigConverter = /** @class */ (function () {
    function LoraConfigConverter() {
    }
    LoraConfigConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeBitsBoolean(model.classA, 1);
        stream.writeBitsBoolean(model.classB, 1);
        stream.writeBitsBoolean(model.classC, 1);
        stream.writeBitsBoolean(model.dataLoggingEnabled, 1);
        stream.writeBitsBoolean(model.singlePacketEnabled, 1);
        return stream.toBytes;
    };
    LoraConfigConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.classA = stream.readBitsBoolean(1);
        model.classB = stream.readBitsBoolean(1);
        model.classC = stream.readBitsBoolean(1);
        model.dataLoggingEnabled = stream.readBitsBoolean(1);
        model.singlePacketEnabled = stream.readBitsBoolean(1);
        return model;
    };
    return LoraConfigConverter;
}());
exports.LoraConfigConverter = LoraConfigConverter;
var SinglePacketPartConverter = /** @class */ (function () {
    function SinglePacketPartConverter() {
    }
    SinglePacketPartConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeU2(model.len);
        stream.writeU2(model.offset);
        stream.writeBytes(model.data, model.len * 16);
        return stream.toBytes;
    };
    SinglePacketPartConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.len = stream.readU2();
        model.offset = stream.readU2();
        model.data = stream.readBytes(model.len * 16);
        return model;
    };
    return SinglePacketPartConverter;
}());
exports.SinglePacketPartConverter = SinglePacketPartConverter;
var ModbusOptionsConverter = /** @class */ (function () {
    function ModbusOptionsConverter() {
    }
    ModbusOptionsConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.forwardBits(6);
        stream.writeBitsInt(/*parseInt(ModbusOptions.ObjectType[*/ model.objectType /*])*/, 2);
        stream.writeU1(model.slave);
        stream.writeU2(model.address);
        stream.writeU4(model.length);
        stream.writeBitsInt(/*parseInt(VariableFormat[*/ model.format /*])*/, 8);
        return stream.toBytes;
    };
    ModbusOptionsConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        stream.forwardBits(6);
        model.objectType = /*ModbusOptions.ObjectType[*/ stream.readBitsInt(2);
        model.slave = stream.readU1();
        model.address = stream.readU2();
        model.length = stream.readU4();
        model.format = /*ModbusOptions.VariableFormat[*/ stream.readU1();
        return model;
    };
    return ModbusOptionsConverter;
}());
exports.ModbusOptionsConverter = ModbusOptionsConverter;
var ModbusWriteOptionsConverter = /** @class */ (function () {
    function ModbusWriteOptionsConverter() {
    }
    ModbusWriteOptionsConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeModbusOptions(model.options);
        stream.writeBytes(model.data);
        return stream.toBytes;
    };
    ModbusWriteOptionsConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.options = stream.readModbusOptions();
        model.data = stream.readBytesFull();
        return model;
    };
    return ModbusWriteOptionsConverter;
}());
exports.ModbusWriteOptionsConverter = ModbusWriteOptionsConverter;
var SinglePacketStoreInfoConverter = /** @class */ (function () {
    function SinglePacketStoreInfoConverter() {
    }
    SinglePacketStoreInfoConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.forwardBits(24);
        stream.writeBitsInt(/*parseInt(SinglePacketStoreInfo.State[*/ model.state /*])*/, 8);
        return stream.toBytes;
    };
    SinglePacketStoreInfoConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        stream.forwardBits(24);
        model.state = /*SinglePacketStoreInfo.State[*/ stream.readU1();
        return model;
    };
    return SinglePacketStoreInfoConverter;
}());
exports.SinglePacketStoreInfoConverter = SinglePacketStoreInfoConverter;
var AdpControlInConverter = /** @class */ (function () {
    function AdpControlInConverter() {
    }
    AdpControlInConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeBitsInt(/*parseInt(AdpControlIn.Command[*/ model.command /*])*/, 16);
        stream.writeU2(model.param);
        return stream.toBytes;
    };
    AdpControlInConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.command = /*AdpControlIn.Command[*/ stream.readU2();
        model.param = stream.readU2();
        return model;
    };
    return AdpControlInConverter;
}());
exports.AdpControlInConverter = AdpControlInConverter;
var AdpControlOutConverter = /** @class */ (function () {
    function AdpControlOutConverter() {
    }
    AdpControlOutConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeBitsInt(/*parseInt(AdpControlOut.ResultCode[*/ model.resultCode /*])*/, 16);
        stream.writeU2(model.param);
        return stream.toBytes;
    };
    AdpControlOutConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.resultCode = /*AdpControlOut.ResultCode[*/ stream.readU2();
        model.param = stream.readU2();
        return model;
    };
    return AdpControlOutConverter;
}());
exports.AdpControlOutConverter = AdpControlOutConverter;
var AdpStatsConverter = /** @class */ (function () {
    function AdpStatsConverter() {
    }
    AdpStatsConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeAdpStatsHeader(model.header);
        stream.writeAdpStatsState(model.state);
        stream.writeAdpStatsUart(model.uart);
        stream.writeAdpStatsUsb(model.usb);
        stream.writeBytes(model.current, 4);
        stream.writeAdpStatsCom(model.com);
        stream.writeBytes(model.battery, 4);
        stream.writeAdpStatsIntern(model.intern);
        return stream.toBytes;
    };
    AdpStatsConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.header = stream.readAdpStatsHeader();
        model.state = stream.readAdpStatsState();
        model.uart = stream.readAdpStatsUart();
        model.usb = stream.readAdpStatsUsb();
        model.current = stream.readBytes(4);
        model.com = stream.readAdpStatsCom();
        model.battery = stream.readBytes(4);
        model.intern = stream.readAdpStatsIntern();
        return model;
    };
    return AdpStatsConverter;
}());
exports.AdpStatsConverter = AdpStatsConverter;
var EncryptedIVCommandConverter = /** @class */ (function () {
    function EncryptedIVCommandConverter() {
    }
    EncryptedIVCommandConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeBytes(model.iv, 16);
        stream.writeBytes(model.command);
        return stream.toBytes;
    };
    EncryptedIVCommandConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.iv = stream.readBytes(16);
        model.command = stream.readBytesFull();
        return model;
    };
    return EncryptedIVCommandConverter;
}());
exports.EncryptedIVCommandConverter = EncryptedIVCommandConverter;
var EncryptedIVResponseConverter = /** @class */ (function () {
    function EncryptedIVResponseConverter() {
    }
    EncryptedIVResponseConverter.prototype.encode = function (model, stream) {
        if (stream === void 0) { stream = new import_adapter_1.TapStreamWriter(); }
        stream.writeBytes(model.iv, 16);
        stream.writeBytes(model.response);
        return stream.toBytes;
    };
    EncryptedIVResponseConverter.prototype.decode = function (data) {
        var stream = (data instanceof import_adapter_1.TapStreamReader) ? data : import_adapter_1.TapStreamReader.create(data);
        var model = {};
        model.iv = stream.readBytes(16);
        model.response = stream.readBytesFull();
        return model;
    };
    return EncryptedIVResponseConverter;
}());
exports.EncryptedIVResponseConverter = EncryptedIVResponseConverter;
