{"version":3,"file":"SetModuleWidth.cjs","names":["Request"],"sources":["../../generated/api/SetModuleWidth.ts"],"sourcesContent":["import { encodeUIntLE, ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetModuleWidth(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      bBroadcast: boolean,\n      moduleWidth: number\n    ): Promise<void>;\n    trySetModuleWidth(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      moduleWidth: number\n    ): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetModuleWidth<Broadcast extends boolean>(\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: Broadcast,\n  moduleWidth: number\n): Request<Broadcast> {\n  const $data = encodeUIntLE(moduleWidth, AddressMapping.ModuleWidthOccupancy);\n  const req = new Request($data, bBroadcast, 'SetModuleWidth');\n  req.destination = addr;\n  req.deviceType = 1;\n  req.port = portAddr;\n  req.rcvIndex = scanBoardAddr;\n  req.address = AddressMapping.ModuleWidthAddr;\n  return req;\n}\nSession.prototype.SetModuleWidth = async function SetModuleWidth(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: boolean,\n  moduleWidth: number\n): Promise<void> {\n  const req = createSetModuleWidth(addr, portAddr, scanBoardAddr, bBroadcast, moduleWidth);\n  await this.connection.send(req);\n};\nSession.prototype.trySetModuleWidth = async function trySetModuleWidth(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  moduleWidth: number\n): Promise<ErrorType | null> {\n  const req = createSetModuleWidth(addr, portAddr, scanBoardAddr, false, moduleWidth);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;;AAoBA,SAAwB,qBACtB,MACA,UACA,eACA,YACA,aACoB;CAEpB,MAAM,MAAM,IAAIA,0DADW,cACC,GAAG,YAAY,gBAAgB;CAC3D,IAAI,cAAc;CAClB,IAAI,aAAa;CACjB,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI;CACJ,OAAO;AACT;AACA,wBAAQ,UAAU,iBAAiB,eAAe,eAEhD,MACA,UACA,eACA,YACA,aACe;CACf,MAAM,MAAM,qBAAqB,MAAM,UAAU,eAAe,YAAY,WAAW;CACvF,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,wBAAQ,UAAU,oBAAoB,eAAe,kBAEnD,MACA,UACA,eACA,aAC2B;CAC3B,MAAM,MAAM,qBAAqB,MAAM,UAAU,eAAe,OAAO,WAAW;CAClF,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}