{"version":3,"file":"SetLowGrayCompensation.cjs","names":["Request"],"sources":["../../generated/api/SetLowGrayCompensation.ts"],"sourcesContent":["import { encodeUIntLE, ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetLowGrayCompensation(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      bBroadcast: boolean,\n      lowGrayCpt: number\n    ): Promise<void>;\n    trySetLowGrayCompensation(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      lowGrayCpt: number\n    ): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetLowGrayCompensation<Broadcast extends boolean>(\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: Broadcast,\n  lowGrayCpt: number\n): Request<Broadcast> {\n  const $data = encodeUIntLE(lowGrayCpt, AddressMapping.LowGrayCompensationOccupancy);\n  const req = new Request($data, bBroadcast, 'SetLowGrayCompensation');\n  req.destination = addr;\n  req.deviceType = 1;\n  req.port = portAddr;\n  req.rcvIndex = scanBoardAddr;\n  req.address = AddressMapping.LowGrayCompensationAddr;\n  return req;\n}\nSession.prototype.SetLowGrayCompensation = async function SetLowGrayCompensation(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: boolean,\n  lowGrayCpt: number\n): Promise<void> {\n  const req = createSetLowGrayCompensation(addr, portAddr, scanBoardAddr, bBroadcast, lowGrayCpt);\n  await this.connection.send(req);\n};\nSession.prototype.trySetLowGrayCompensation = async function trySetLowGrayCompensation(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  lowGrayCpt: number\n): Promise<ErrorType | null> {\n  const req = createSetLowGrayCompensation(addr, portAddr, scanBoardAddr, false, lowGrayCpt);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;;AAoBA,SAAwB,6BACtB,MACA,UACA,eACA,YACA,YACoB;CAEpB,MAAM,MAAM,IAAIA,0DADW,aACC,GAAG,YAAY,wBAAwB;CACnE,IAAI,cAAc;CAClB,IAAI,aAAa;CACjB,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI;CACJ,OAAO;AACT;AACA,wBAAQ,UAAU,yBAAyB,eAAe,uBAExD,MACA,UACA,eACA,YACA,YACe;CACf,MAAM,MAAM,6BAA6B,MAAM,UAAU,eAAe,YAAY,UAAU;CAC9F,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,wBAAQ,UAAU,4BAA4B,eAAe,0BAE3D,MACA,UACA,eACA,YAC2B;CAC3B,MAAM,MAAM,6BAA6B,MAAM,UAAU,eAAe,OAAO,UAAU;CACzF,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}