{"version":3,"file":"SetPortOfDVI.mjs","names":[],"sources":["../../generated/api/SetPortOfDVI.ts"],"sourcesContent":["import { ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetPortOfDVI(\n      addr: number,\n      bBroadcast: boolean,\n      dviIndex: number,\n      portIndex: number\n    ): Promise<void>;\n    trySetPortOfDVI(addr: number, dviIndex: number, portIndex: number): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetPortOfDVI<Broadcast extends boolean>(\n  addr: number,\n  bBroadcast: Broadcast,\n  dviIndex: number,\n  portIndex: number\n): Request<Broadcast> {\n  const req = new Request([dviIndex], bBroadcast, 'SetPortOfDVI');\n  req.destination = addr;\n  req.address = 0;\n  if (portIndex >= AddressMapping.New32PortOccupancy) {\n    req.address =\n      AddressMapping.DVIOfPortInfoNext32Addr +\n      AddressMapping.DVIOfPortInfoNext32Occupancy * (portIndex - AddressMapping.New32PortOccupancy);\n  } else {\n    req.address = AddressMapping.DVIOfPortInfoAddr + portIndex;\n  }\n  return req;\n}\nSession.prototype.SetPortOfDVI = async function SetPortOfDVI(\n  this: Session,\n  addr: number,\n  bBroadcast: boolean,\n  dviIndex: number,\n  portIndex: number\n): Promise<void> {\n  const req = createSetPortOfDVI(addr, bBroadcast, dviIndex, portIndex);\n  await this.connection.send(req);\n};\nSession.prototype.trySetPortOfDVI = async function trySetPortOfDVI(\n  this: Session,\n  addr: number,\n  dviIndex: number,\n  portIndex: number\n): Promise<ErrorType | null> {\n  const req = createSetPortOfDVI(addr, false, dviIndex, portIndex);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;AAcA,SAAwB,mBACtB,MACA,YACA,UACA,WACoB;CACpB,MAAM,MAAM,IAAI,QAAQ,CAAC,QAAQ,GAAG,YAAY,cAAc;CAC9D,IAAI,cAAc;CAClB,IAAI,UAAU;CACd,IAAI,iBACF,IAAI,0BAE6C;MAEjD,IAAI,qBAA6C;CAEnD,OAAO;AACT;AACA,QAAQ,UAAU,eAAe,eAAe,aAE9C,MACA,YACA,UACA,WACe;CACf,MAAM,MAAM,mBAAmB,MAAM,YAAY,UAAU,SAAS;CACpE,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,QAAQ,UAAU,kBAAkB,eAAe,gBAEjD,MACA,UACA,WAC2B;CAC3B,MAAM,MAAM,mBAAmB,MAAM,OAAO,UAAU,SAAS;CAC/D,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}