{"version":3,"file":"ReadDeviceType.mjs","names":[],"sources":["../../generated/api/ReadDeviceType.ts"],"sourcesContent":["import { decodeUIntLE, Packet, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    ReadDeviceType(addr: number): Promise<number>;\n    tryReadDeviceType(addr: number): Promise<Packet | null>;\n  }\n}\nexport default function createReadDeviceType(addr: number): Request {\n  const req = new Request(AddressMapping.CompanyIdOccupancy, 'ReadDeviceType');\n  req.destination = addr;\n  req.address = AddressMapping.DeviceTypeAddr;\n  return req;\n}\nSession.prototype.ReadDeviceType = async function ReadDeviceType(\n  this: Session,\n  addr: number\n): Promise<number> {\n  const req = createReadDeviceType(addr);\n  return decodeUIntLE(await this.connection.send(req));\n};\nSession.prototype.tryReadDeviceType = async function tryReadDeviceType(\n  this: Session,\n  addr: number\n): Promise<Packet | null> {\n  const req = createReadDeviceType(addr);\n  return this.connection.trySend(req);\n};\n"],"mappings":";;;;AASA,SAAwB,qBAAqB,MAAuB;CAClE,MAAM,MAAM,IAAI,WAA2C,gBAAgB;CAC3E,IAAI,cAAc;CAClB,IAAI;CACJ,OAAO;AACT;AACA,QAAQ,UAAU,iBAAiB,eAAe,eAEhD,MACiB;CACjB,MAAM,MAAM,qBAAqB,IAAI;CACrC,OAAO,aAAa,MAAM,KAAK,WAAW,KAAK,GAAG,CAAC;AACrD;AACA,QAAQ,UAAU,oBAAoB,eAAe,kBAEnD,MACwB;CACxB,MAAM,MAAM,qBAAqB,IAAI;CACrC,OAAO,KAAK,WAAW,QAAQ,GAAG;AACpC"}