{"version":3,"file":"ReadCommunicationProtocol.cjs","names":["Request"],"sources":["../../generated/api/ReadCommunicationProtocol.ts"],"sourcesContent":["import { decodeUIntLE, Packet, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    ReadCommunicationProtocol(addr: number): Promise<number>;\n    tryReadCommunicationProtocol(addr: number): Promise<Packet | null>;\n  }\n}\nexport default function createReadCommunicationProtocol(addr: number): Request {\n  const req = new Request(\n    AddressMapping.CommunicationProtocolOccupancy,\n    'ReadCommunicationProtocol'\n  );\n  req.destination = addr;\n  req.address = AddressMapping.CommunicationProtocolAddr;\n  return req;\n}\nSession.prototype.ReadCommunicationProtocol = async function ReadCommunicationProtocol(\n  this: Session,\n  addr: number\n): Promise<number> {\n  const req = createReadCommunicationProtocol(addr);\n  return decodeUIntLE(await this.connection.send(req));\n};\nSession.prototype.tryReadCommunicationProtocol = async function tryReadCommunicationProtocol(\n  this: Session,\n  addr: number\n): Promise<Packet | null> {\n  const req = createReadCommunicationProtocol(addr);\n  return this.connection.trySend(req);\n};\n"],"mappings":";;;;;AASA,SAAwB,gCAAgC,MAAuB;CAC7E,MAAM,MAAM,IAAIA,2BAEd,2BACF;CACA,IAAI,cAAc;CAClB,IAAI;CACJ,OAAO;AACT;AACA,wBAAQ,UAAU,4BAA4B,eAAe,0BAE3D,MACiB;CACjB,MAAM,MAAM,gCAAgC,IAAI;CAChD,yCAAoB,MAAM,KAAK,WAAW,KAAK,GAAG,CAAC;AACrD;AACA,wBAAQ,UAAU,+BAA+B,eAAe,6BAE9D,MACwB;CACxB,MAAM,MAAM,gCAAgC,IAAI;CAChD,OAAO,KAAK,WAAW,QAAQ,GAAG;AACpC"}