{"version":3,"file":"SetMBI5252AutoReset.cjs","names":["Request"],"sources":["../../generated/api/SetMBI5252AutoReset.ts"],"sourcesContent":["import { ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetMBI5252AutoReset(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      bBroadcast: boolean,\n      mutiChipRamA: number[] | Buffer\n    ): Promise<void>;\n    trySetMBI5252AutoReset(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      mutiChipRamA: number[] | Buffer\n    ): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetMBI5252AutoReset<Broadcast extends boolean>(\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: Broadcast,\n  mutiChipRamA: number[] | Buffer\n): Request<Broadcast> {\n  if (mutiChipRamA.length !== 0) throw new TypeError(`Invalid buffer size: ${mutiChipRamA.length}`);\n  const req = new Request(mutiChipRamA, bBroadcast, 'SetMBI5252AutoReset');\n  req.destination = addr;\n  req.deviceType = 1;\n  req.port = portAddr;\n  req.rcvIndex = scanBoardAddr;\n  req.address = AddressMapping.MBI5252SetAutoResetAddr;\n  return req;\n}\nSession.prototype.SetMBI5252AutoReset = async function SetMBI5252AutoReset(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: boolean,\n  mutiChipRamA: number[] | Buffer\n): Promise<void> {\n  const req = createSetMBI5252AutoReset(addr, portAddr, scanBoardAddr, bBroadcast, mutiChipRamA);\n  await this.connection.send(req);\n};\nSession.prototype.trySetMBI5252AutoReset = async function trySetMBI5252AutoReset(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  mutiChipRamA: number[] | Buffer\n): Promise<ErrorType | null> {\n  const req = createSetMBI5252AutoReset(addr, portAddr, scanBoardAddr, false, mutiChipRamA);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;;AAoBA,SAAwB,0BACtB,MACA,UACA,eACA,YACA,cACoB;CACpB,IAAI,aAAa,WAAW,GAAG,MAAM,IAAI,UAAU,wBAAwB,aAAa,QAAQ;CAChG,MAAM,MAAM,IAAIA,wBAAQ,cAAc,YAAY,qBAAqB;CACvE,IAAI,cAAc;CAClB,IAAI,aAAa;CACjB,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI;CACJ,OAAO;AACT;AACA,wBAAQ,UAAU,sBAAsB,eAAe,oBAErD,MACA,UACA,eACA,YACA,cACe;CACf,MAAM,MAAM,0BAA0B,MAAM,UAAU,eAAe,YAAY,YAAY;CAC7F,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,wBAAQ,UAAU,yBAAyB,eAAe,uBAExD,MACA,UACA,eACA,cAC2B;CAC3B,MAAM,MAAM,0BAA0B,MAAM,UAAU,eAAe,OAAO,YAAY;CACxF,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}