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