{"version":3,"file":"SetDHTValue.cjs","names":["Request"],"sources":["../../generated/api/SetDHTValue.ts"],"sourcesContent":["import { ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetDHTValue(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      bBroadcast: boolean,\n      dht: number\n    ): Promise<void>;\n    trySetDHTValue(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      dht: number\n    ): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetDHTValue<Broadcast extends boolean>(\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: Broadcast,\n  dht: number\n): Request<Broadcast> {\n  const req = new Request([dht], bBroadcast, 'SetDHTValue');\n  req.destination = addr;\n  req.deviceType = 1;\n  req.port = portAddr;\n  req.rcvIndex = scanBoardAddr;\n  req.address = AddressMapping.DHTAddr;\n  return req;\n}\nSession.prototype.SetDHTValue = async function SetDHTValue(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: boolean,\n  dht: number\n): Promise<void> {\n  const req = createSetDHTValue(addr, portAddr, scanBoardAddr, bBroadcast, dht);\n  await this.connection.send(req);\n};\nSession.prototype.trySetDHTValue = async function trySetDHTValue(\n  this: Session,\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  dht: number\n): Promise<ErrorType | null> {\n  const req = createSetDHTValue(addr, portAddr, scanBoardAddr, false, dht);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;;AAoBA,SAAwB,kBACtB,MACA,UACA,eACA,YACA,KACoB;CACpB,MAAM,MAAM,IAAIA,wBAAQ,CAAC,GAAG,GAAG,YAAY,aAAa;CACxD,IAAI,cAAc;CAClB,IAAI,aAAa;CACjB,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI;CACJ,OAAO;AACT;AACA,wBAAQ,UAAU,cAAc,eAAe,YAE7C,MACA,UACA,eACA,YACA,KACe;CACf,MAAM,MAAM,kBAAkB,MAAM,UAAU,eAAe,YAAY,GAAG;CAC5E,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,wBAAQ,UAAU,iBAAiB,eAAe,eAEhD,MACA,UACA,eACA,KAC2B;CAC3B,MAAM,MAAM,kBAAkB,MAAM,UAAU,eAAe,OAAO,GAAG;CACvE,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}