{"version":3,"file":"SetCorrectionOnROELine.mjs","names":[],"sources":["../../generated/api/SetCorrectionOnROELine.ts"],"sourcesContent":["import { ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetCorrectionOnROELine(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      bBroadcast: boolean,\n      correctionInfo: number[] | Buffer\n    ): Promise<void>;\n    trySetCorrectionOnROELine(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      correctionInfo: number[] | Buffer\n    ): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetCorrectionOnROELine<Broadcast extends boolean>(\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: Broadcast,\n  correctionInfo: number[] | Buffer\n): Request<Broadcast> {\n  if (correctionInfo.length !== AddressMapping.CorrectionOnOccupancy)\n    throw new TypeError(`Invalid buffer size: ${correctionInfo.length}`);\n  const req = new Request(correctionInfo, bBroadcast, 'SetCorrectionOnROELine');\n  req.destination = addr;\n  req.deviceType = 1;\n  req.port = portAddr;\n  req.rcvIndex = scanBoardAddr;\n  req.address = AddressMapping.CorrectionOnAddr;\n  return req;\n}\nSession.prototype.SetCorrectionOnROELine = async function SetCorrectionOnROELine(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: boolean,\n  correctionInfo: number[] | Buffer\n): Promise<void> {\n  const req = createSetCorrectionOnROELine(\n    addr,\n    portAddr,\n    scanBoardAddr,\n    bBroadcast,\n    correctionInfo\n  );\n  await this.connection.send(req);\n};\nSession.prototype.trySetCorrectionOnROELine = async function trySetCorrectionOnROELine(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  correctionInfo: number[] | Buffer\n): Promise<ErrorType | null> {\n  const req = createSetCorrectionOnROELine(addr, portAddr, scanBoardAddr, false, correctionInfo);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;AAoBA,SAAwB,6BACtB,MACA,UACA,eACA,YACA,gBACoB;CACpB,IAAI,eAAe,cACjB,MAAM,IAAI,UAAU,wBAAwB,eAAe,QAAQ;CACrE,MAAM,MAAM,IAAI,QAAQ,gBAAgB,YAAY,wBAAwB;CAC5E,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,gBACe;CACf,MAAM,MAAM,6BACV,MACA,UACA,eACA,YACA,cACF;CACA,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,QAAQ,UAAU,4BAA4B,eAAe,0BAE3D,MACA,UACA,eACA,gBAC2B;CAC3B,MAAM,MAAM,6BAA6B,MAAM,UAAU,eAAe,OAAO,cAAc;CAC7F,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}