{"version":3,"file":"SetContrastValue.mjs","names":[],"sources":["../../generated/api/SetContrastValue.ts"],"sourcesContent":["import { encodeUIntLE, ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetContrastValue(addr: number, bBroadcast: boolean, dht: number): Promise<void>;\n    trySetContrastValue(addr: number, dht: number): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetContrastValue<Broadcast extends boolean>(\n  addr: number,\n  bBroadcast: Broadcast,\n  dht: number\n): Request<Broadcast> {\n  const $data = encodeUIntLE(dht, AddressMapping.SenderContrastResultOccupancy);\n  const req = new Request($data, bBroadcast, 'SetContrastValue');\n  req.destination = addr;\n  req.address = AddressMapping.SenderContrastResultAddr;\n  return req;\n}\nSession.prototype.SetContrastValue = async function SetContrastValue(\n  this: Session,\n  addr: number,\n  bBroadcast: boolean,\n  dht: number\n): Promise<void> {\n  const req = createSetContrastValue(addr, bBroadcast, dht);\n  await this.connection.send(req);\n};\nSession.prototype.trySetContrastValue = async function trySetContrastValue(\n  this: Session,\n  addr: number,\n  dht: number\n): Promise<ErrorType | null> {\n  const req = createSetContrastValue(addr, false, dht);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;AASA,SAAwB,uBACtB,MACA,YACA,KACoB;CAEpB,MAAM,MAAM,IAAI,QADF,aAAa,MACC,GAAG,YAAY,kBAAkB;CAC7D,IAAI,cAAc;CAClB,IAAI;CACJ,OAAO;AACT;AACA,QAAQ,UAAU,mBAAmB,eAAe,iBAElD,MACA,YACA,KACe;CACf,MAAM,MAAM,uBAAuB,MAAM,YAAY,GAAG;CACxD,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,QAAQ,UAAU,sBAAsB,eAAe,oBAErD,MACA,KAC2B;CAC3B,MAAM,MAAM,uBAAuB,MAAM,OAAO,GAAG;CACnD,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}