{"version":3,"file":"SetGrayDepth.cjs","names":["Request"],"sources":["../../generated/api/SetGrayDepth.ts"],"sourcesContent":["import { encodeUIntLE, ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetGrayDepth(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      bBroadcast: boolean,\n      grayDepth: number\n    ): Promise<void>;\n    trySetGrayDepth(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      grayDepth: number\n    ): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetGrayDepth<Broadcast extends boolean>(\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: Broadcast,\n  grayDepth: number\n): Request<Broadcast> {\n  const $data = encodeUIntLE(grayDepth, AddressMapping.GrayDepthOccupancy);\n  const req = new Request($data, bBroadcast, 'SetGrayDepth');\n  req.destination = addr;\n  req.deviceType = 1;\n  req.port = portAddr;\n  req.rcvIndex = scanBoardAddr;\n  req.address = AddressMapping.GrayDepthAddr;\n  return req;\n}\nSession.prototype.SetGrayDepth = async function SetGrayDepth(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: boolean,\n  grayDepth: number\n): Promise<void> {\n  const req = createSetGrayDepth(addr, portAddr, scanBoardAddr, bBroadcast, grayDepth);\n  await this.connection.send(req);\n};\nSession.prototype.trySetGrayDepth = async function trySetGrayDepth(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  grayDepth: number\n): Promise<ErrorType | null> {\n  const req = createSetGrayDepth(addr, portAddr, scanBoardAddr, false, grayDepth);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;;AAoBA,SAAwB,mBACtB,MACA,UACA,eACA,YACA,WACoB;CAEpB,MAAM,MAAM,IAAIA,0DADW,YACC,GAAG,YAAY,cAAc;CACzD,IAAI,cAAc;CAClB,IAAI,aAAa;CACjB,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI;CACJ,OAAO;AACT;AACA,wBAAQ,UAAU,eAAe,eAAe,aAE9C,MACA,UACA,eACA,YACA,WACe;CACf,MAAM,MAAM,mBAAmB,MAAM,UAAU,eAAe,YAAY,SAAS;CACnF,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,wBAAQ,UAAU,kBAAkB,eAAe,gBAEjD,MACA,UACA,eACA,WAC2B;CAC3B,MAAM,MAAM,mBAAmB,MAAM,UAAU,eAAe,OAAO,SAAS;CAC9E,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}