{"version":3,"file":"SetDoorSwitchDetection.mjs","names":[],"sources":["../../generated/api/SetDoorSwitchDetection.ts"],"sourcesContent":["import { encodeUIntLE, ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    SetDoorSwitchDetection(addr: number, bBroadcast: boolean, data: number): Promise<void>;\n    trySetDoorSwitchDetection(addr: number, data: number): Promise<ErrorType | null>;\n  }\n}\nexport default function createSetDoorSwitchDetection<Broadcast extends boolean>(\n  addr: number,\n  bBroadcast: Broadcast,\n  data: number\n): Request<Broadcast> {\n  const $data = encodeUIntLE(data, AddressMapping.IsDoorSwitchDetectionOccupancy);\n  const req = new Request($data, bBroadcast, 'SetDoorSwitchDetection');\n  req.destination = addr;\n  req.address = AddressMapping.IsDoorSwitchDetectionAddr;\n  return req;\n}\nSession.prototype.SetDoorSwitchDetection = async function SetDoorSwitchDetection(\n  this: Session,\n  addr: number,\n  bBroadcast: boolean,\n  data: number\n): Promise<void> {\n  const req = createSetDoorSwitchDetection(addr, bBroadcast, data);\n  await this.connection.send(req);\n};\nSession.prototype.trySetDoorSwitchDetection = async function trySetDoorSwitchDetection(\n  this: Session,\n  addr: number,\n  data: number\n): Promise<ErrorType | null> {\n  const req = createSetDoorSwitchDetection(addr, false, data);\n  return (await this.connection.trySend(req))?.ack ?? null;\n};\n"],"mappings":";;;;AASA,SAAwB,6BACtB,MACA,YACA,MACoB;CAEpB,MAAM,MAAM,IAAI,QADF,aAAa,OACC,GAAG,YAAY,wBAAwB;CACnE,IAAI,cAAc;CAClB,IAAI;CACJ,OAAO;AACT;AACA,QAAQ,UAAU,yBAAyB,eAAe,uBAExD,MACA,YACA,MACe;CACf,MAAM,MAAM,6BAA6B,MAAM,YAAY,IAAI;CAC/D,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACA,QAAQ,UAAU,4BAA4B,eAAe,0BAE3D,MACA,MAC2B;CAC3B,MAAM,MAAM,6BAA6B,MAAM,OAAO,IAAI;CAC1D,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}