{"version":3,"file":"SetGrayBit.mjs","names":[],"sources":["../../generated/api/SetGrayBit.ts"],"sourcesContent":["import { encodeUIntLE, ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetGrayBit(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      bBroadcast: boolean,\n      grayBit: number\n    ): Promise<void>;\n    trySetGrayBit(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      grayBit: number\n    ): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetGrayBit<Broadcast extends boolean>(\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: Broadcast,\n  grayBit: number\n): Request<Broadcast> {\n  const $data = encodeUIntLE(grayBit, AddressMapping.GrayBitOccupancy);\n  const req = new Request($data, bBroadcast, 'SetGrayBit');\n  req.destination = addr;\n  req.deviceType = 1;\n  req.port = portAddr;\n  req.rcvIndex = scanBoardAddr;\n  req.address = AddressMapping.GrayBitAddr;\n  return req;\n}\nSession.prototype.SetGrayBit = async function SetGrayBit(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: boolean,\n  grayBit: number\n): Promise<void> {\n  const req = createSetGrayBit(addr, portAddr, scanBoardAddr, bBroadcast, grayBit);\n  await this.connection.send(req);\n};\nSession.prototype.trySetGrayBit = async function trySetGrayBit(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  grayBit: number\n): Promise<ErrorType | null> {\n  const req = createSetGrayBit(addr, portAddr, scanBoardAddr, false, grayBit);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;AAoBA,SAAwB,iBACtB,MACA,UACA,eACA,YACA,SACoB;CAEpB,MAAM,MAAM,IAAI,QADF,aAAa,UACC,GAAG,YAAY,YAAY;CACvD,IAAI,cAAc;CAClB,IAAI,aAAa;CACjB,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI;CACJ,OAAO;AACT;AACA,QAAQ,UAAU,aAAa,eAAe,WAE5C,MACA,UACA,eACA,YACA,SACe;CACf,MAAM,MAAM,iBAAiB,MAAM,UAAU,eAAe,YAAY,OAAO;CAC/E,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,QAAQ,UAAU,gBAAgB,eAAe,cAE/C,MACA,UACA,eACA,SAC2B;CAC3B,MAAM,MAAM,iBAAiB,MAAM,UAAU,eAAe,OAAO,OAAO;CAC1E,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}