{"version":3,"file":"SetDviWidth.cjs","names":["Request"],"sources":["../../generated/api/SetDviWidth.ts"],"sourcesContent":["import { encodeUIntLE, ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetDviWidth(addr: number, bBroadcast: boolean, dviWidth: number, index: number): Promise<void>;\n    trySetDviWidth(addr: number, dviWidth: number, index: number): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetDviWidth<Broadcast extends boolean>(\n  addr: number,\n  bBroadcast: Broadcast,\n  dviWidth: number,\n  index: number\n): Request<Broadcast> {\n  const $data = encodeUIntLE(dviWidth, AddressMapping.DviWidthOccupancy);\n  const req = new Request($data, bBroadcast, 'SetDviWidth');\n  req.destination = addr;\n  req.address = AddressMapping.DviWidthAddr + AddressMapping.DviOccupancy * index;\n  return req;\n}\nSession.prototype.SetDviWidth = async function SetDviWidth(\n  this: Session,\n  addr: number,\n  bBroadcast: boolean,\n  dviWidth: number,\n  index: number\n): Promise<void> {\n  const req = createSetDviWidth(addr, bBroadcast, dviWidth, index);\n  await this.connection.send(req);\n};\nSession.prototype.trySetDviWidth = async function trySetDviWidth(\n  this: Session,\n  addr: number,\n  dviWidth: number,\n  index: number\n): Promise<ErrorType | null> {\n  const req = createSetDviWidth(addr, false, dviWidth, index);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;;AASA,SAAwB,kBACtB,MACA,YACA,UACA,OACoB;CAEpB,MAAM,MAAM,IAAIA,0DADW,WACC,GAAG,YAAY,aAAa;CACxD,IAAI,cAAc;CAClB,IAAI,yBAAsE;CAC1E,OAAO;AACT;AACA,wBAAQ,UAAU,cAAc,eAAe,YAE7C,MACA,YACA,UACA,OACe;CACf,MAAM,MAAM,kBAAkB,MAAM,YAAY,UAAU,KAAK;CAC/D,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,wBAAQ,UAAU,iBAAiB,eAAe,eAEhD,MACA,UACA,OAC2B;CAC3B,MAAM,MAAM,kBAAkB,MAAM,OAAO,UAAU,KAAK;CAC1D,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}