{"version":3,"file":"SetGclkUnitCycle.cjs","names":["Request"],"sources":["../../generated/api/SetGclkUnitCycle.ts"],"sourcesContent":["import { encodeUIntLE, ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetGclkUnitCycle(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      bBroadcast: boolean,\n      gclkUnitCycle: number\n    ): Promise<void>;\n    trySetGclkUnitCycle(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      gclkUnitCycle: number\n    ): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetGclkUnitCycle<Broadcast extends boolean>(\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: Broadcast,\n  gclkUnitCycle: number\n): Request<Broadcast> {\n  const $data = encodeUIntLE(gclkUnitCycle, AddressMapping.GclkUnitCycleOccupancy);\n  const req = new Request($data, bBroadcast, 'SetGclkUnitCycle');\n  req.destination = addr;\n  req.deviceType = 1;\n  req.port = portAddr;\n  req.rcvIndex = scanBoardAddr;\n  req.address = AddressMapping.GclkUnitCycleAddr;\n  return req;\n}\nSession.prototype.SetGclkUnitCycle = async function SetGclkUnitCycle(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: boolean,\n  gclkUnitCycle: number\n): Promise<void> {\n  const req = createSetGclkUnitCycle(addr, portAddr, scanBoardAddr, bBroadcast, gclkUnitCycle);\n  await this.connection.send(req);\n};\nSession.prototype.trySetGclkUnitCycle = async function trySetGclkUnitCycle(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  gclkUnitCycle: number\n): Promise<ErrorType | null> {\n  const req = createSetGclkUnitCycle(addr, portAddr, scanBoardAddr, false, gclkUnitCycle);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;;AAoBA,SAAwB,uBACtB,MACA,UACA,eACA,YACA,eACoB;CAEpB,MAAM,MAAM,IAAIA,0DADW,gBACC,GAAG,YAAY,kBAAkB;CAC7D,IAAI,cAAc;CAClB,IAAI,aAAa;CACjB,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI;CACJ,OAAO;AACT;AACA,wBAAQ,UAAU,mBAAmB,eAAe,iBAElD,MACA,UACA,eACA,YACA,eACe;CACf,MAAM,MAAM,uBAAuB,MAAM,UAAU,eAAe,YAAY,aAAa;CAC3F,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,wBAAQ,UAAU,sBAAsB,eAAe,oBAErD,MACA,UACA,eACA,eAC2B;CAC3B,MAAM,MAAM,uBAAuB,MAAM,UAAU,eAAe,OAAO,aAAa;CACtF,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}