{"version":3,"file":"MoveCorrectionFromSdramToMasterFlash.cjs","names":["Request"],"sources":["../../generated/api/MoveCorrectionFromSdramToMasterFlash.ts"],"sourcesContent":["import { ErrorType, Request, Session } from '@novastar/codec';\nimport AddressMapping from '../AddressMapping';\nimport { CoefTypeEnum } from '../CoefType';\n\ndeclare module '@novastar/codec' {\n  interface API {\n    MoveCorrectionFromSdramToMasterFlash(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      bBroadcast: boolean,\n      coef: CoefTypeEnum\n    ): Promise<void>;\n    tryMoveCorrectionFromSdramToMasterFlash(\n      addr: number,\n      portAddr: number,\n      scanBoardAddr: number,\n      coef: CoefTypeEnum\n    ): Promise<ErrorType | null>;\n  }\n}\nexport default function createMoveCorrectionFromSdramToMasterFlash<Broadcast extends boolean>(\n  addr: number,\n  portAddr: number,\n  scanBoardAddr: number,\n  bBroadcast: Broadcast,\n  coef: CoefTypeEnum\n): Request<Broadcast> {\n  const req = new Request(Buffer.alloc(1), bBroadcast, 'MoveCorrectionFromSdramToMasterFlash');\n  req.destination = addr;\n  req.deviceType = 1;\n  req.port = portAddr;\n  req.rcvIndex = scanBoardAddr;\n  req.address =\n    coef === CoefTypeEnum.MultiLayer\n      ? AddressMapping.Correction_RestitutionAddr_MultiLayer\n      : AddressMapping.Correction_RestitutionAddr;\n  return req;\n}\nSession.prototype.MoveCorrectionFromSdramToMasterFlash =\n  async function MoveCorrectionFromSdramToMasterFlash(\n    this: Session,\n    addr: number,\n    portAddr: number,\n    scanBoardAddr: number,\n    bBroadcast: boolean,\n    coef: CoefTypeEnum\n  ): Promise<void> {\n    const req = createMoveCorrectionFromSdramToMasterFlash(\n      addr,\n      portAddr,\n      scanBoardAddr,\n      bBroadcast,\n      coef\n    );\n    await this.connection.send(req);\n  };\nSession.prototype.tryMoveCorrectionFromSdramToMasterFlash =\n  async function tryMoveCorrectionFromSdramToMasterFlash(\n    this: Session,\n    addr: number,\n    portAddr: number,\n    scanBoardAddr: number,\n    coef: CoefTypeEnum\n  ): Promise<ErrorType | null> {\n    const req = createMoveCorrectionFromSdramToMasterFlash(\n      addr,\n      portAddr,\n      scanBoardAddr,\n      false,\n      coef\n    );\n    return (await this.connection.trySend(req))?.ack ?? null;\n  };\n"],"mappings":";;;;;;AAqBA,SAAwB,2CACtB,MACA,UACA,eACA,YACA,MACoB;CACpB,MAAM,MAAM,IAAIA,wBAAQ,OAAO,MAAM,CAAC,GAAG,YAAY,sCAAsC;CAC3F,IAAI,cAAc;CAClB,IAAI,aAAa;CACjB,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI,UACF;CAGF,OAAO;AACT;AACA,wBAAQ,UAAU,uCAChB,eAAe,qCAEb,MACA,UACA,eACA,YACA,MACe;CACf,MAAM,MAAM,2CACV,MACA,UACA,eACA,YACA,IACF;CACA,MAAM,KAAK,WAAW,KAAK,GAAG;AAChC;AACF,wBAAQ,UAAU,0CAChB,eAAe,wCAEb,MACA,UACA,eACA,MAC2B;CAC3B,MAAM,MAAM,2CACV,MACA,UACA,eACA,OACA,IACF;CACA,QAAQ,MAAM,KAAK,WAAW,QAAQ,GAAG,IAAI,OAAO;AACtD"}