UNPKG

@iotize/device-client.js

Version:

IoTize Device client for Javascript

817 lines (816 loc) 32.3 kB
"use strict"; /** * This file has been generated * DO NOT EDIT, IT MAY BE OVERWRITTEN */ Object.defineProperty(exports, "__esModule", { value: true }); var import_adapter_1 = require("./import-adapter"); import_adapter_1.TapStreamReader.prototype.readTypes = function () { var model = {}; return model; }; import_adapter_1.TapStreamReader.prototype.readAclEntry = function () { var model = {}; this.forwardBits(3); model.create = this.readBitsBoolean(1); model.delete = this.readBitsBoolean(1); model.execute = this.readBitsBoolean(1); model.write = this.readBitsBoolean(1); model.read = this.readBitsBoolean(1); return model; }; import_adapter_1.TapStreamReader.prototype.readMemoryInfo = function () { var model = {}; model.address = this.readU4(); model.length = this.readU4(); model.format = /*MemoryInfo.VariableFormat[*/ this.readU1(); return model; }; import_adapter_1.TapStreamReader.prototype.readMemoryWriteInfo = function () { var model = {}; model.info = this.readMemoryInfo(); model.data = this.readBytesFull(); return model; }; import_adapter_1.TapStreamReader.prototype.readReadWriteRights = function () { var model = {}; model.groupId = this.readU2(); this.forwardBits(6); model.write = this.readBitsBoolean(1); model.read = this.readBitsBoolean(1); return model; }; import_adapter_1.TapStreamReader.prototype.readDataLogOption = function () { var model = {}; this.forwardBits(6); model.security = this.readBitsBoolean(1); model.qos = this.readBitsBoolean(1); this.forwardBits(5); model.logOnChange = this.readBitsBoolean(1); model.rollingMode = this.readBitsBoolean(1); model.autorun = this.readBitsBoolean(1); return model; }; import_adapter_1.TapStreamReader.prototype.readUartSettings = function () { var model = {}; model.slv = this.readU1(); this.forwardBits(3); model.ofs = this.readBitsBoolean(1); model.baudRate = this.readBitsInt(20); this.forwardBits(4); model.physicalPort = /*UartSettings.PhysicalPort[*/ this.readBitsInt(4); model.stopBit = /*UartSettings.StopBit[*/ this.readBitsInt(2); model.bitParity = /*UartSettings.BitParity[*/ this.readBitsInt(4); model.dataBitsLength = /*UartSettings.DataBitsLength[*/ this.readBitsInt(2); model.handshakeDelimiter = /*UartSettings.HandshakeDelimiter[*/ this.readBitsInt(4); model.handshakeValue = /*UartSettings.Handshake[*/ this.readBitsInt(4); model.timeout = this.readU1(); return model; }; import_adapter_1.TapStreamReader.prototype.readProtocolConfiguration = function () { var model = {}; model.slv = this.readU1(); this.forwardBits(3); model.ofs = this.readBitsBoolean(1); model.baudRate = this.readBitsInt(20); model.identification = this.readBitsBoolean(1); this.forwardBits(1); model.ledStatus = this.readBitsBoolean(1); this.forwardBits(1); model.physicalPort = /*ProtocolConfiguration.UartSettingsPhysicalPort[*/ this.readBitsInt(4); model.stopBit = /*ProtocolConfiguration.UartSettingsStopBit[*/ this.readBitsInt(2); model.bitParity = /*ProtocolConfiguration.UartSettingsBitParity[*/ this.readBitsInt(4); model.dataBitsLength = /*ProtocolConfiguration.UartSettingsDataBitsLength[*/ this.readBitsInt(2); model.handshakeDelimiter = /*ProtocolConfiguration.UartSettingsHandshakeDelimiter[*/ this.readBitsInt(4); model.handshakeValue = /*ProtocolConfiguration.UartSettingsHandshake[*/ this.readBitsInt(4); model.timeout = this.readU1(); model.usbSettings = this.readProtocolConfigurationUsbSettings(); return model; }; import_adapter_1.TapStreamReader.prototype.readProtocolConfigurationUsbSettings = function () { var model = {}; while (!this.isEof()) { model.aliases = model.aliases || []; model.aliases.push(this.readProtocolConfigurationUsbAlias()); } return model; }; import_adapter_1.TapStreamReader.prototype.readProtocolConfigurationUsbAlias = function () { var model = {}; model.pid = this.readBytes(2); model.vid = this.readBytes(2); model.equ = this.readU1(); return model; }; import_adapter_1.TapStreamReader.prototype.readTapVersion = function () { var model = {}; model.major = this.readU1(); model.minor = this.readU1(); model.patch = this.readU2(); return model; }; import_adapter_1.TapStreamReader.prototype.readLwm2mTlv = function () { var model = {}; model.identifierType = this.readBitsInt(2); model.identifierLength = this.readBitsBoolean(1); model.lengthType = this.readBitsInt(2); model.other = this.readBitsInt(3); model.identifier = this.readBytes(1); model.len = this.readU2(); model.value = this.readBytesFull(); return model; }; import_adapter_1.TapStreamReader.prototype.readInterfaceLock = function () { var model = {}; this.forwardBits(8); this.forwardBits(3); model.scramActivated = this.readBitsBoolean(1); model.hashPassword = this.readBitsBoolean(1); model.factoryReset = this.readBitsBoolean(1); model.resourceLogUid = this.readBitsBoolean(1); model.resourceFactory = this.readBitsBoolean(1); return model; }; import_adapter_1.TapStreamReader.prototype.readLoginCredential = function () { var model = {}; model.username = this.readStr(16); model.password = this.readStr(16); return model; }; import_adapter_1.TapStreamReader.prototype.readLoginCredentialHashed = function () { var model = {}; model.username = this.readStr(16); model.password = this.readBytes(16); return model; }; import_adapter_1.TapStreamReader.prototype.readScramLoginParams = function () { var model = {}; model.username = this.readStr(16); model.clientNonce = this.readU4(); return model; }; import_adapter_1.TapStreamReader.prototype.readScramLoginResponseBody = function () { var model = {}; model.serverNonce = this.readU4(); model.salt = this.readBytes(4); model.iterationNumber = this.readU4(); return model; }; import_adapter_1.TapStreamReader.prototype.readTargetComStats = function () { var model = {}; model.nbFailCom = this.readU4(); model.nbSuccessfulCom = this.readU4(); return model; }; import_adapter_1.TapStreamReader.prototype.readAvailableFunction = function () { var model = {}; this.forwardBits(6); model.debug = this.readBitsBoolean(1); model.dataLog = this.readBitsBoolean(1); return model; }; import_adapter_1.TapStreamReader.prototype.readMultiRequest = function () { var model = {}; while (!this.isEof()) { model.requests = model.requests || []; model.requests.push(this.readMultiRequestRequestItem()); } return model; }; import_adapter_1.TapStreamReader.prototype.readMultiRequestRequestItem = function () { var model = {}; model.requestLen = this.readU2(); model.request = this.subStream(model.requestLen).readTapRequest(); model.expectedCodeRet = this.readU1(); return model; }; import_adapter_1.TapStreamReader.prototype.readMultiResponse = function () { var model = {}; while (!this.isEof()) { model.responses = model.responses || []; model.responses.push(this.readMultiResponseResponseItem()); } return model; }; import_adapter_1.TapStreamReader.prototype.readMultiResponseResponseItem = function () { var model = {}; model.responseLen = this.readU2(); model.response = this.subStream(model.responseLen).readTapResponse(); return model; }; import_adapter_1.TapStreamReader.prototype.readCrcCheckBody = function () { var model = {}; model.address = this.readU4(); model.size = this.readU4(); model.crc = this.readU4(); return model; }; import_adapter_1.TapStreamReader.prototype.readSinglePacket = function () { var model = {}; model.sendTime = this.readU4(); model.outerHeader = this.readSinglePacketOuterHeader(); model.payload = this.readSinglePacketPayload(); return model; }; import_adapter_1.TapStreamReader.prototype.readSinglePacketOuterHeader = function () { var model = {}; model.packetLength = this.readU2(); model.packetId = this.readU2(); model.configVersion = this.readU4(); model.messageType = /*SinglePacket.PacketType[*/ this.readBitsInt(4); model.isExtended = this.readBitsBoolean(1); this.forwardBits(1); model.encryption = this.readBitsBoolean(1); model.ack = this.readBitsBoolean(1); model.senderId = this.readU1(); model.salt = this.readU2(); return model; }; import_adapter_1.TapStreamReader.prototype.readSinglePacketPayload = function () { var model = {}; model.logTime = this.readU4(); model.dataSize = this.readU2(); model.data = this.readBytes(model.dataSize); model.padding = this.readBytes((4 - ((model.dataSize + 10) % 4)) % 4); model.crc = this.readU4(); return model; }; import_adapter_1.TapStreamReader.prototype.readAclEntries = function () { var model = {}; while (!this.isEof()) { model.items = model.items || []; model.items.push(this.readAclEntry()); } return model; }; import_adapter_1.TapStreamReader.prototype.readLoraConfig = function () { var model = {}; model.classA = this.readBitsBoolean(1); model.classB = this.readBitsBoolean(1); model.classC = this.readBitsBoolean(1); model.dataLoggingEnabled = this.readBitsBoolean(1); model.singlePacketEnabled = this.readBitsBoolean(1); return model; }; import_adapter_1.TapStreamReader.prototype.readSinglePacketPart = function () { var model = {}; model.len = this.readU2(); model.offset = this.readU2(); model.data = this.readBytes(model.len * 16); return model; }; import_adapter_1.TapStreamReader.prototype.readModbusOptions = function () { var model = {}; this.forwardBits(6); model.objectType = /*ModbusOptions.ObjectType[*/ this.readBitsInt(2); model.slave = this.readU1(); model.address = this.readU2(); model.length = this.readU4(); model.format = /*ModbusOptions.VariableFormat[*/ this.readU1(); return model; }; import_adapter_1.TapStreamReader.prototype.readModbusWriteOptions = function () { var model = {}; model.options = this.readModbusOptions(); model.data = this.readBytesFull(); return model; }; import_adapter_1.TapStreamReader.prototype.readSinglePacketStoreInfo = function () { var model = {}; this.forwardBits(24); model.state = /*SinglePacketStoreInfo.State[*/ this.readU1(); return model; }; import_adapter_1.TapStreamReader.prototype.readAdpControlIn = function () { var model = {}; model.command = /*AdpControlIn.Command[*/ this.readU2(); model.param = this.readU2(); return model; }; import_adapter_1.TapStreamReader.prototype.readAdpControlOut = function () { var model = {}; model.resultCode = /*AdpControlOut.ResultCode[*/ this.readU2(); model.param = this.readU2(); return model; }; import_adapter_1.TapStreamReader.prototype.readAdpStats = function () { var model = {}; model.header = this.readAdpStatsHeader(); model.state = this.readAdpStatsState(); model.uart = this.readAdpStatsUart(); model.usb = this.readAdpStatsUsb(); model.current = this.readBytes(4); model.com = this.readAdpStatsCom(); model.battery = this.readBytes(4); model.intern = this.readAdpStatsIntern(); return model; }; import_adapter_1.TapStreamReader.prototype.readAdpStatsHeader = function () { var model = {}; this.forwardBits(16); model.version = this.readAdpStatsVersion(); model.errorCode = this.readU1(); this.forwardBits(16); return model; }; import_adapter_1.TapStreamReader.prototype.readAdpStatsVersion = function () { var model = {}; model.major = this.readU1(); model.minor = this.readU1(); model.patch = this.readU1(); return model; }; import_adapter_1.TapStreamReader.prototype.readAdpStatsIntern = function () { var model = {}; model.time = this.readBytes(4); model.nbBoots = this.readBytes(4); model.nbShutdown = this.readBytes(2); model.nbAdpFault = this.readBytes(2); model.nbAdpMemFault = this.readBytes(2); model.nbAdpBusFault = this.readBytes(2); model.nbAdpUsageFault = this.readBytes(2); this.forwardBits(16); model.temperature = this.readBytes(4); return model; }; import_adapter_1.TapStreamReader.prototype.readAdpStatsState = function () { var model = {}; this.forwardBits(7); model.usbDisconnected = this.readBitsBoolean(1); this.forwardBits(24); return model; }; import_adapter_1.TapStreamReader.prototype.readAdpStatsUart = function () { var model = {}; model.nbPartityError = this.readU1(); model.nbNoiseError = this.readU1(); model.nbFrameError = this.readU1(); model.nbDmaError = this.readU1(); model.nbTxError = this.readU1(); model.nbRxError = this.readU1(); model.nbOverRun = this.readU1(); this.forwardBits(8); return model; }; import_adapter_1.TapStreamReader.prototype.readAdpStatsUsb = function () { var model = {}; model.nbFail = this.readU1(); model.nbTimeout = this.readU1(); model.nbError = this.readU1(); model.nbUnknownClass = this.readU1(); model.nbDisconnect = this.readU1(); model.nbOff = this.readU1(); this.forwardBits(16); return model; }; import_adapter_1.TapStreamReader.prototype.readAdpStatsCom = function () { var model = {}; model.txBufferOverRun = this.readU1(); model.rxBufferOverRun = this.readU1(); model.nbErrorSettings = this.readU1(); this.forwardBits(8); model.nbComAdp = this.readBytes(4); return model; }; import_adapter_1.TapStreamReader.prototype.readEncryptedIVCommand = function () { var model = {}; model.iv = this.readBytes(16); model.command = this.readBytesFull(); return model; }; import_adapter_1.TapStreamReader.prototype.readEncryptedIVResponse = function () { var model = {}; model.iv = this.readBytes(16); model.response = this.readBytesFull(); return model; }; // TapStreamWriter.prototype.write(model: Types) : TapStreamWriter{ // return this.writeTypes(model) // } import_adapter_1.TapStreamWriter.prototype.writeTypes = function (model) { return this; }; // TapStreamWriter.prototype.write(model: AclEntry) : TapStreamWriter{ // return this.writeAclEntry(model) // } import_adapter_1.TapStreamWriter.prototype.writeAclEntry = function (model) { this.forwardBits(3); this.writeBitsBoolean(model.create, 1); this.writeBitsBoolean(model.delete, 1); this.writeBitsBoolean(model.execute, 1); this.writeBitsBoolean(model.write, 1); this.writeBitsBoolean(model.read, 1); return this; }; // TapStreamWriter.prototype.write(model: MemoryInfo) : TapStreamWriter{ // return this.writeMemoryInfo(model) // } import_adapter_1.TapStreamWriter.prototype.writeMemoryInfo = function (model) { this.writeU4(model.address); this.writeU4(model.length); this.writeBitsInt(/*parseInt(VariableFormat[*/ model.format /*])*/, 8); return this; }; // TapStreamWriter.prototype.write(model: MemoryWriteInfo) : TapStreamWriter{ // return this.writeMemoryWriteInfo(model) // } import_adapter_1.TapStreamWriter.prototype.writeMemoryWriteInfo = function (model) { this.writeMemoryInfo(model.info); this.writeBytes(model.data); return this; }; // TapStreamWriter.prototype.write(model: ReadWriteRights) : TapStreamWriter{ // return this.writeReadWriteRights(model) // } import_adapter_1.TapStreamWriter.prototype.writeReadWriteRights = function (model) { this.writeU2(model.groupId); this.forwardBits(6); this.writeBitsBoolean(model.write, 1); this.writeBitsBoolean(model.read, 1); return this; }; // TapStreamWriter.prototype.write(model: DataLogOption) : TapStreamWriter{ // return this.writeDataLogOption(model) // } import_adapter_1.TapStreamWriter.prototype.writeDataLogOption = function (model) { this.forwardBits(6); this.writeBitsBoolean(model.security, 1); this.writeBitsBoolean(model.qos, 1); this.forwardBits(5); this.writeBitsBoolean(model.logOnChange, 1); this.writeBitsBoolean(model.rollingMode, 1); this.writeBitsBoolean(model.autorun, 1); return this; }; // TapStreamWriter.prototype.write(model: UartSettings) : TapStreamWriter{ // return this.writeUartSettings(model) // } import_adapter_1.TapStreamWriter.prototype.writeUartSettings = function (model) { this.writeU1(model.slv); this.forwardBits(3); this.writeBitsBoolean(model.ofs, 1); this.writeBitsInt(model.baudRate, 20); this.forwardBits(4); this.writeBitsInt(/*parseInt(UartSettings.PhysicalPort[*/ model.physicalPort /*])*/, 4); this.writeBitsInt(/*parseInt(UartSettings.StopBit[*/ model.stopBit /*])*/, 2); this.writeBitsInt(/*parseInt(UartSettings.BitParity[*/ model.bitParity /*])*/, 4); this.writeBitsInt(/*parseInt(UartSettings.DataBitsLength[*/ model.dataBitsLength /*])*/, 2); this.writeBitsInt(/*parseInt(UartSettings.HandshakeDelimiter[*/ model.handshakeDelimiter /*])*/, 4); this.writeBitsInt(/*parseInt(UartSettings.Handshake[*/ model.handshakeValue /*])*/, 4); this.writeU1(model.timeout); return this; }; // TapStreamWriter.prototype.write(model: ProtocolConfiguration) : TapStreamWriter{ // return this.writeProtocolConfiguration(model) // } import_adapter_1.TapStreamWriter.prototype.writeProtocolConfiguration = function (model) { this.writeU1(model.slv); this.forwardBits(3); this.writeBitsBoolean(model.ofs, 1); this.writeBitsInt(model.baudRate, 20); this.writeBitsBoolean(model.identification, 1); this.forwardBits(1); this.writeBitsBoolean(model.ledStatus, 1); this.forwardBits(1); this.writeBitsInt(/*parseInt(UartSettings.PhysicalPort[*/ model.physicalPort /*])*/, 4); this.writeBitsInt(/*parseInt(UartSettings.StopBit[*/ model.stopBit /*])*/, 2); this.writeBitsInt(/*parseInt(UartSettings.BitParity[*/ model.bitParity /*])*/, 4); this.writeBitsInt(/*parseInt(UartSettings.DataBitsLength[*/ model.dataBitsLength /*])*/, 2); this.writeBitsInt(/*parseInt(UartSettings.HandshakeDelimiter[*/ model.handshakeDelimiter /*])*/, 4); this.writeBitsInt(/*parseInt(UartSettings.Handshake[*/ model.handshakeValue /*])*/, 4); this.writeU1(model.timeout); this.writeProtocolConfigurationUsbSettings(model.usbSettings); return this; }; import_adapter_1.TapStreamWriter.prototype.writeProtocolConfigurationUsbSettings = function (model) { for (var _i = 0, _a = model.aliases; _i < _a.length; _i++) { var item = _a[_i]; this.writeProtocolConfigurationUsbAlias(item); } return this; }; import_adapter_1.TapStreamWriter.prototype.writeProtocolConfigurationUsbAlias = function (model) { this.writeBytes(model.pid, 2); this.writeBytes(model.vid, 2); this.writeU1(model.equ); return this; }; // TapStreamWriter.prototype.write(model: TapVersion) : TapStreamWriter{ // return this.writeTapVersion(model) // } import_adapter_1.TapStreamWriter.prototype.writeTapVersion = function (model) { this.writeU1(model.major); this.writeU1(model.minor); this.writeU2(model.patch); return this; }; // TapStreamWriter.prototype.write(model: Lwm2mTlv) : TapStreamWriter{ // return this.writeLwm2mTlv(model) // } import_adapter_1.TapStreamWriter.prototype.writeLwm2mTlv = function (model) { this.writeBitsInt(model.identifierType, 2); this.writeBitsBoolean(model.identifierLength, 1); this.writeBitsInt(model.lengthType, 2); this.writeBitsInt(model.other, 3); this.writeBytes(model.identifier, 1); this.writeU2(model.len); this.writeBytes(model.value); return this; }; // TapStreamWriter.prototype.write(model: InterfaceLock) : TapStreamWriter{ // return this.writeInterfaceLock(model) // } import_adapter_1.TapStreamWriter.prototype.writeInterfaceLock = function (model) { this.forwardBits(8); this.forwardBits(3); this.writeBitsBoolean(model.scramActivated, 1); this.writeBitsBoolean(model.hashPassword, 1); this.writeBitsBoolean(model.factoryReset, 1); this.writeBitsBoolean(model.resourceLogUid, 1); this.writeBitsBoolean(model.resourceFactory, 1); return this; }; // TapStreamWriter.prototype.write(model: LoginCredential) : TapStreamWriter{ // return this.writeLoginCredential(model) // } import_adapter_1.TapStreamWriter.prototype.writeLoginCredential = function (model) { this.writeStr(model.username, 16); this.writeStr(model.password, 16); return this; }; // TapStreamWriter.prototype.write(model: LoginCredentialHashed) : TapStreamWriter{ // return this.writeLoginCredentialHashed(model) // } import_adapter_1.TapStreamWriter.prototype.writeLoginCredentialHashed = function (model) { this.writeStr(model.username, 16); this.writeBytes(model.password, 16); return this; }; // TapStreamWriter.prototype.write(model: ScramLoginParams) : TapStreamWriter{ // return this.writeScramLoginParams(model) // } import_adapter_1.TapStreamWriter.prototype.writeScramLoginParams = function (model) { this.writeStr(model.username, 16); this.writeU4(model.clientNonce); return this; }; // TapStreamWriter.prototype.write(model: ScramLoginResponseBody) : TapStreamWriter{ // return this.writeScramLoginResponseBody(model) // } import_adapter_1.TapStreamWriter.prototype.writeScramLoginResponseBody = function (model) { this.writeU4(model.serverNonce); this.writeBytes(model.salt, 4); this.writeU4(model.iterationNumber); return this; }; // TapStreamWriter.prototype.write(model: TargetComStats) : TapStreamWriter{ // return this.writeTargetComStats(model) // } import_adapter_1.TapStreamWriter.prototype.writeTargetComStats = function (model) { this.writeU4(model.nbFailCom); this.writeU4(model.nbSuccessfulCom); return this; }; // TapStreamWriter.prototype.write(model: AvailableFunction) : TapStreamWriter{ // return this.writeAvailableFunction(model) // } import_adapter_1.TapStreamWriter.prototype.writeAvailableFunction = function (model) { this.forwardBits(6); this.writeBitsBoolean(model.debug, 1); this.writeBitsBoolean(model.dataLog, 1); return this; }; // TapStreamWriter.prototype.write(model: MultiRequest) : TapStreamWriter{ // return this.writeMultiRequest(model) // } import_adapter_1.TapStreamWriter.prototype.writeMultiRequest = function (model) { for (var _i = 0, _a = model.requests; _i < _a.length; _i++) { var item = _a[_i]; this.writeMultiRequestRequestItem(item); } return this; }; import_adapter_1.TapStreamWriter.prototype.writeMultiRequestRequestItem = function (model) { this.writeU2(model.requestLen); this.writeTapRequest(model.request); this.writeU1(model.expectedCodeRet); return this; }; // TapStreamWriter.prototype.write(model: MultiResponse) : TapStreamWriter{ // return this.writeMultiResponse(model) // } import_adapter_1.TapStreamWriter.prototype.writeMultiResponse = function (model) { for (var _i = 0, _a = model.responses; _i < _a.length; _i++) { var item = _a[_i]; this.writeMultiResponseResponseItem(item); } return this; }; import_adapter_1.TapStreamWriter.prototype.writeMultiResponseResponseItem = function (model) { this.writeU2(model.responseLen); this.writeTapResponse(model.response); return this; }; // TapStreamWriter.prototype.write(model: CrcCheckBody) : TapStreamWriter{ // return this.writeCrcCheckBody(model) // } import_adapter_1.TapStreamWriter.prototype.writeCrcCheckBody = function (model) { this.writeU4(model.address); this.writeU4(model.size); this.writeU4(model.crc); return this; }; // TapStreamWriter.prototype.write(model: SinglePacket) : TapStreamWriter{ // return this.writeSinglePacket(model) // } import_adapter_1.TapStreamWriter.prototype.writeSinglePacket = function (model) { this.writeU4(model.sendTime); this.writeSinglePacketOuterHeader(model.outerHeader); this.writeSinglePacketPayload(model.payload); return this; }; import_adapter_1.TapStreamWriter.prototype.writeSinglePacketOuterHeader = function (model) { this.writeU2(model.packetLength); this.writeU2(model.packetId); this.writeU4(model.configVersion); this.writeBitsInt(/*parseInt(SinglePacket.PacketType[*/ model.messageType /*])*/, 4); this.writeBitsBoolean(model.isExtended, 1); this.forwardBits(1); this.writeBitsBoolean(model.encryption, 1); this.writeBitsBoolean(model.ack, 1); this.writeU1(model.senderId); this.writeU2(model.salt); return this; }; import_adapter_1.TapStreamWriter.prototype.writeSinglePacketPayload = function (model) { this.writeU4(model.logTime); this.writeU2(model.dataSize); this.writeBytes(model.data, model.dataSize); this.writeFunction('padding', null, model.padding, (4 - ((model.dataSize + 10) % 4)) % 4); this.writeFunction('crc32', { "offset": 4 }, model.crc); return this; }; // TapStreamWriter.prototype.write(model: AclEntries) : TapStreamWriter{ // return this.writeAclEntries(model) // } import_adapter_1.TapStreamWriter.prototype.writeAclEntries = function (model) { for (var _i = 0, _a = model.items; _i < _a.length; _i++) { var item = _a[_i]; this.writeAclEntry(item); } return this; }; // TapStreamWriter.prototype.write(model: LoraConfig) : TapStreamWriter{ // return this.writeLoraConfig(model) // } import_adapter_1.TapStreamWriter.prototype.writeLoraConfig = function (model) { this.writeBitsBoolean(model.classA, 1); this.writeBitsBoolean(model.classB, 1); this.writeBitsBoolean(model.classC, 1); this.writeBitsBoolean(model.dataLoggingEnabled, 1); this.writeBitsBoolean(model.singlePacketEnabled, 1); return this; }; // TapStreamWriter.prototype.write(model: SinglePacketPart) : TapStreamWriter{ // return this.writeSinglePacketPart(model) // } import_adapter_1.TapStreamWriter.prototype.writeSinglePacketPart = function (model) { this.writeU2(model.len); this.writeU2(model.offset); this.writeBytes(model.data, model.len * 16); return this; }; // TapStreamWriter.prototype.write(model: ModbusOptions) : TapStreamWriter{ // return this.writeModbusOptions(model) // } import_adapter_1.TapStreamWriter.prototype.writeModbusOptions = function (model) { this.forwardBits(6); this.writeBitsInt(/*parseInt(ModbusOptions.ObjectType[*/ model.objectType /*])*/, 2); this.writeU1(model.slave); this.writeU2(model.address); this.writeU4(model.length); this.writeBitsInt(/*parseInt(VariableFormat[*/ model.format /*])*/, 8); return this; }; // TapStreamWriter.prototype.write(model: ModbusWriteOptions) : TapStreamWriter{ // return this.writeModbusWriteOptions(model) // } import_adapter_1.TapStreamWriter.prototype.writeModbusWriteOptions = function (model) { this.writeModbusOptions(model.options); this.writeBytes(model.data); return this; }; // TapStreamWriter.prototype.write(model: SinglePacketStoreInfo) : TapStreamWriter{ // return this.writeSinglePacketStoreInfo(model) // } import_adapter_1.TapStreamWriter.prototype.writeSinglePacketStoreInfo = function (model) { this.forwardBits(24); this.writeBitsInt(/*parseInt(SinglePacketStoreInfo.State[*/ model.state /*])*/, 8); return this; }; // TapStreamWriter.prototype.write(model: AdpControlIn) : TapStreamWriter{ // return this.writeAdpControlIn(model) // } import_adapter_1.TapStreamWriter.prototype.writeAdpControlIn = function (model) { this.writeBitsInt(/*parseInt(AdpControlIn.Command[*/ model.command /*])*/, 16); this.writeU2(model.param); return this; }; // TapStreamWriter.prototype.write(model: AdpControlOut) : TapStreamWriter{ // return this.writeAdpControlOut(model) // } import_adapter_1.TapStreamWriter.prototype.writeAdpControlOut = function (model) { this.writeBitsInt(/*parseInt(AdpControlOut.ResultCode[*/ model.resultCode /*])*/, 16); this.writeU2(model.param); return this; }; // TapStreamWriter.prototype.write(model: AdpStats) : TapStreamWriter{ // return this.writeAdpStats(model) // } import_adapter_1.TapStreamWriter.prototype.writeAdpStats = function (model) { this.writeAdpStatsHeader(model.header); this.writeAdpStatsState(model.state); this.writeAdpStatsUart(model.uart); this.writeAdpStatsUsb(model.usb); this.writeBytes(model.current, 4); this.writeAdpStatsCom(model.com); this.writeBytes(model.battery, 4); this.writeAdpStatsIntern(model.intern); return this; }; import_adapter_1.TapStreamWriter.prototype.writeAdpStatsHeader = function (model) { this.forwardBits(16); this.writeAdpStatsVersion(model.version); this.writeU1(model.errorCode); this.forwardBits(16); return this; }; import_adapter_1.TapStreamWriter.prototype.writeAdpStatsVersion = function (model) { this.writeU1(model.major); this.writeU1(model.minor); this.writeU1(model.patch); return this; }; import_adapter_1.TapStreamWriter.prototype.writeAdpStatsIntern = function (model) { this.writeBytes(model.time, 4); this.writeBytes(model.nbBoots, 4); this.writeBytes(model.nbShutdown, 2); this.writeBytes(model.nbAdpFault, 2); this.writeBytes(model.nbAdpMemFault, 2); this.writeBytes(model.nbAdpBusFault, 2); this.writeBytes(model.nbAdpUsageFault, 2); this.forwardBits(16); this.writeBytes(model.temperature, 4); return this; }; import_adapter_1.TapStreamWriter.prototype.writeAdpStatsState = function (model) { this.forwardBits(7); this.writeBitsBoolean(model.usbDisconnected, 1); this.forwardBits(24); return this; }; import_adapter_1.TapStreamWriter.prototype.writeAdpStatsUart = function (model) { this.writeU1(model.nbPartityError); this.writeU1(model.nbNoiseError); this.writeU1(model.nbFrameError); this.writeU1(model.nbDmaError); this.writeU1(model.nbTxError); this.writeU1(model.nbRxError); this.writeU1(model.nbOverRun); this.forwardBits(8); return this; }; import_adapter_1.TapStreamWriter.prototype.writeAdpStatsUsb = function (model) { this.writeU1(model.nbFail); this.writeU1(model.nbTimeout); this.writeU1(model.nbError); this.writeU1(model.nbUnknownClass); this.writeU1(model.nbDisconnect); this.writeU1(model.nbOff); this.forwardBits(16); return this; }; import_adapter_1.TapStreamWriter.prototype.writeAdpStatsCom = function (model) { this.writeU1(model.txBufferOverRun); this.writeU1(model.rxBufferOverRun); this.writeU1(model.nbErrorSettings); this.forwardBits(8); this.writeBytes(model.nbComAdp, 4); return this; }; // TapStreamWriter.prototype.write(model: EncryptedIVCommand) : TapStreamWriter{ // return this.writeEncryptedIVCommand(model) // } import_adapter_1.TapStreamWriter.prototype.writeEncryptedIVCommand = function (model) { this.writeBytes(model.iv, 16); this.writeBytes(model.command); return this; }; // TapStreamWriter.prototype.write(model: EncryptedIVResponse) : TapStreamWriter{ // return this.writeEncryptedIVResponse(model) // } import_adapter_1.TapStreamWriter.prototype.writeEncryptedIVResponse = function (model) { this.writeBytes(model.iv, 16); this.writeBytes(model.response); return this; };