{"version":3,"file":"SetMBI5252ChannelState.mjs","names":[],"sources":["../../generated/api/SetMBI5252ChannelState.ts"],"sourcesContent":["import { ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetMBI5252ChannelState(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      bBroadcast: boolean,\n      mutiChipRamA: number[] | Buffer\n    ): Promise<void>;\n    trySetMBI5252ChannelState(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      mutiChipRamA: number[] | Buffer\n    ): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetMBI5252ChannelState<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, 'SetMBI5252ChannelState');\n  req.destination = addr;\n  req.deviceType = 1;\n  req.port = portAddr;\n  req.rcvIndex = scanBoardAddr;\n  req.address = AddressMapping.MBI5252SetChannelStateAddr;\n  return req;\n}\nSession.prototype.SetMBI5252ChannelState = async function SetMBI5252ChannelState(\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 = createSetMBI5252ChannelState(addr, portAddr, scanBoardAddr, bBroadcast, mutiChipRamA);\n  await this.connection.send(req);\n};\nSession.prototype.trySetMBI5252ChannelState = async function trySetMBI5252ChannelState(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  mutiChipRamA: number[] | Buffer\n): Promise<ErrorType | null> {\n  const req = createSetMBI5252ChannelState(addr, portAddr, scanBoardAddr, false, mutiChipRamA);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;AAoBA,SAAwB,6BACtB,MACA,UACA,eACA,YACA,cACoB;CACpB,IAAI,aAAa,WAAW,GAAG,MAAM,IAAI,UAAU,wBAAwB,aAAa,QAAQ;CAChG,MAAM,MAAM,IAAI,QAAQ,cAAc,YAAY,wBAAwB;CAC1E,IAAI,cAAc;CAClB,IAAI,aAAa;CACjB,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI;CACJ,OAAO;AACT;AACA,QAAQ,UAAU,yBAAyB,eAAe,uBAExD,MACA,UACA,eACA,YACA,cACe;CACf,MAAM,MAAM,6BAA6B,MAAM,UAAU,eAAe,YAAY,YAAY;CAChG,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,QAAQ,UAAU,4BAA4B,eAAe,0BAE3D,MACA,UACA,eACA,cAC2B;CAC3B,MAAM,MAAM,6BAA6B,MAAM,UAAU,eAAe,OAAO,YAAY;CAC3F,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}