rickyc81

Untitled

Nov 19th, 2020
376
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. 7.000 ( Flags S14 -> 1-64 | Configuration S15 -> 1-25 )
  3. 7.020 ( Flags S14 -> 1-64 | Configuration S15 -> 1-25 )
  4. 7.030 ( Flags S14 -> 1-65 | Configuration S15 -> 1-25 )
  5. 10.02 ( Flags S14 -> 1-67 | Configuration S15 -> 1-26 )
  6. */
  7. const { remote } = require('electron');
  8. const { data } = require('jquery');
  9. const ipc = require('electron').ipcRenderer;
  10. const app = remote.app;
  11.  
  12. // STORE DATI
  13. const path = app.getPath('userData')+`/config.json`;
  14. let store = require(path);
  15. console.log("Store dati memorizzati -->" + store)
  16.  
  17. // BACKUP
  18. document.getElementById('btn-get-backup').addEventListener('click', (e) => {
  19.   getAllData()
  20. })
  21. // RESTORE
  22. document.querySelector('#restore-button').addEventListener('click', function(){
  23.   ipc.send("restore-backup")
  24. });
  25.  
  26. // PRELEVA L'INDICE dei FLAGS dal FIRMWARE del FISCALE
  27.  
  28. function getIndexFromFirmware(){
  29.   let arrayIndex = []
  30.   switch (store.configData["cpuRel"]) {
  31.  
  32.     case ("7.000"):
  33.       arrayIndex = [64, 25]
  34.         return arrayIndex
  35.     break;
  36.  
  37.     case ("7.020"):
  38.       arrayIndex = [64, 25]
  39.         return arrayIndex
  40.      break;
  41.  
  42.     case "7.030":
  43.       arrayIndex = [65, 25]
  44.         return arrayIndex
  45.     break;
  46.  
  47.     case ("10.02"||"10.01"):
  48.       arrayIndex = [67, 26]
  49.         return arrayIndex
  50.     break;
  51.  
  52.     case ("10.01"):
  53.       arrayIndex = [67, 26]
  54.         return arrayIndex
  55.     break;
  56.   }
  57. }
  58.  
  59. // OGGETTO CON I DATI DEL BACKUP SALVATO
  60. // SI POSSONO AGGIUNGERE ANCHE ALTRI PARAMETRI DA SALVARE
  61. const STORED_DATA = {
  62.   eft_pos_config: "",
  63.   flags: "",
  64.   config: "",
  65.   key: ""
  66. };
  67.  
  68. // PRELEVA IL SETTAGGIO DI EFT-POS CHIAVE S31
  69. async function getEftPos() {
  70.   ipc.send('eft-progress-bar', [1, "Backup"])
  71.   return new Promise((resolve, reject) => {
  72.  
  73.     const protocol = store.configData["protocol"];
  74.     const ipAddress = store.configData["ipAddress"];
  75.     const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  76.     const dataCommand = `<printerCommand> <directIO command="4231" data="" /> </printerCommand>`;
  77.  
  78.     const epos = new epson.fiscalPrint();
  79.  
  80.     epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  81.       if (result.success == true) {
  82.         console.log(`EFT_POS --> ${add_info.responseData}`)
  83.         //eftBar.animate(1)
  84.         ipc.send('set-value', 1)
  85.         resolve(add_info.responseData)
  86.       }
  87.     };
  88.     epos.onerror = (result) => {
  89.       if (!result.success) {
  90.         reject(result)
  91.       }
  92.     };
  93.     epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  94.   })
  95. }
  96.  
  97. /*
  98.  
  99. 7.000 ( Flags S14 -> 1-64 | Configuration S15 -> 1-25 )
  100. 7.020 ( Flags S14 -> 1-64 | Configuration S15 -> 1-25 )
  101. 7.030 ( Flags S14 -> 1-65 | Configuration S15 -> 1-25 )
  102. 10.02 ( Flags S14 -> 1-67 | Configuration S15 -> 1-26 )
  103.  
  104. */
  105.  
  106. // PRELEVA LA CHIAVE S14
  107.  
  108. async function getFlags() {
  109.   ipc.send('flags-progress-bar', [getIndexFromFirmware()[0], "Backup"])
  110.   //ipc.send('flags-progress-bar', getIndexFromFirmware()[0])
  111.   let flagsLenght = 0;
  112.   let data = []
  113.  
  114.   for (i = 1; i < (getIndexFromFirmware()[0])+1; i++) {
  115.     if ((i + "").length < 2) {
  116.       index = "0" + i
  117.     } else {
  118.       index = i.toString()
  119.     }
  120.     await getSingleFlagsPromise(index);
  121.   }
  122.  
  123.   function getSingleFlagsPromise(id) {
  124.  
  125.     return new Promise((resolve, reject) => {
  126.  
  127.       const protocol = store.configData["protocol"];
  128.       const ipAddress = store.configData["ipAddress"];
  129.       const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  130.       const dataCommand = `<printerCommand> <directIO command="4214" data="${id}" /> </printerCommand>`;
  131.       const epos = new epson.fiscalPrint();
  132.  
  133.       epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  134.         if (result.success) {
  135.           data.push(add_info.responseData)
  136.           flagsLenght++
  137.           ipc.send('set-value', (flagsLenght))
  138.           console.log(`FLAGS S14 --> ${index} --> ${add_info.responseData}`)
  139.           resolve(data)
  140.           //flagsBar.animate(FlagsLenght/getIndexFromFirmware()[0]);
  141.         }
  142.       };
  143.       epos.onerror = (result) => {
  144.         if (!result.success) {
  145.           console.log(result)
  146.           reject(result)
  147.         }
  148.       };
  149.       epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  150.     });
  151.   }
  152.   return Promise.resolve(data)
  153. }
  154.  
  155. /*
  156.  
  157. 7.000 ( Flags S14 -> 1-64 | Configuration S15 -> 1-25 )
  158. 7.020 ( Flags S14 -> 1-64 | Configuration S15 -> 1-25 )
  159. 7.030 ( Flags S14 -> 1-65 | Configuration S15 -> 1-25 )
  160. 10.02 ( Flags S14 -> 1-67 | Configuration S15 -> 1-26 )
  161.  
  162. */
  163.  
  164. // PRELEVA LA CHIAVE S15
  165.  
  166. async function getConfig() {
  167.   //console.log(getIndexFromFirmware())
  168.   ipc.send('config-progress-bar', [getIndexFromFirmware()[1], "Backup"])
  169.   //ipc.send('config-progress-bar', getIndexFromFirmware()[1] )
  170.   let getConfigLenght = 0;
  171.   let data = []
  172.  
  173.   for (i = 1; i < getIndexFromFirmware()[1]+1; i++) {
  174.     if ((i + "").length < 2) {
  175.       index = "0" + i
  176.     } else {
  177.       index = i.toString()
  178.     }
  179.     await getSingleConfigPromise(index)
  180.   }
  181.  
  182.   function getSingleConfigPromise(id) {
  183.  
  184.     return new Promise((resolve, reject) => {
  185.  
  186.       const protocol = store.configData["protocol"];
  187.       const ipAddress = store.configData["ipAddress"];
  188.       const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  189.       const dataCommand = `<printerCommand> <directIO command="4215" data="${id}" /> </printerCommand>`;
  190.       const epos = new epson.fiscalPrint();
  191.  
  192.       epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  193.         if (result.success) {
  194.           data.push(add_info.responseData)
  195.           getConfigLenght++
  196.           console.log(`CONFIG S15 --> ${index} --> ${add_info.responseData}`)
  197.           //configBar.animate(getConfigLenght/getIndexFromFirmware()[1]);
  198.           ipc.send('set-value', (getConfigLenght))
  199.           //ipc.send('progress', (getConfigLenght/26).toFixed(2));
  200.           resolve(data)
  201.         }
  202.       };
  203.       epos.onerror = (result) => {
  204.         if (!result.success) {
  205.           console.log(result)
  206.           reject(result)
  207.         }
  208.       };
  209.       epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  210.     });
  211.   }
  212.   return Promise.resolve(data)
  213. }
  214.  
  215. // PRELEVA TUTTI I TASTI CON LE RELATIVE FUNZIONI ASSOCIATE AI TASTI
  216.  
  217. async function getKeyboard() {
  218.   ipc.send('keyboard-progress-bar', [255, "Backup"])
  219.   let data = []
  220.   let keybarLength = 0;
  221.   for (i = 1; i < 256; i++) {
  222.     if ((i + "").length < 2) {
  223.       index = "00" + i
  224.     } else if ((i + "").length < 3) {
  225.       index = "0" + i
  226.     } else {
  227.       index = i.toString()
  228.     }
  229.     await getSingleKeyboardPromise(index)
  230.   }
  231.  
  232.   function getSingleKeyboardPromise(id) {
  233.    
  234.     return new Promise((resolve, reject) => {
  235.  
  236.       const protocol = store.configData["protocol"];
  237.       const ipAddress = store.configData["ipAddress"];
  238.       const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  239.       const dataCommand = `<printerCommand> <directIO command="4229" data="${id}" /> </printerCommand>`;
  240.       const epos = new epson.fiscalPrint();
  241.  
  242.       epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  243.         if (result.success) {
  244.           data.push(add_info.responseData)
  245.           keybarLength ++;
  246.           ipc.send('set-value', (keybarLength))
  247.           console.log(`KEY FUNCTION S29 --> ${index} --> ${add_info.responseData}`)
  248.           //keyBar.animate(keybarLength/255);
  249.          
  250.           resolve(data)
  251.         }
  252.       };
  253.       epos.onerror = (result) => {
  254.         if (!result.success) {
  255.           //console.log(result)
  256.           reject(result)
  257.         }
  258.       };
  259.       epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  260.     });
  261.   }
  262.   return Promise.resolve(data)
  263. }
  264.  
  265. // FUNZIONE DEL SALVATAGGIO DEI DATI, PRELEVA FIRMWARE, MATRICOLA E MODELLO E COMUNICA AL MAIN PROCESS DATI E INFO DEL FISCALE
  266. function saveFile() {
  267.   const DATA_FP_CONNECTED = {
  268.     cpuRel: store.configData.cpuRel,
  269.     matricola: store.configData.matricola,
  270.     modello: store.modello
  271.   }
  272.   ipc.send('save-backup', {STORED_DATA, DATA_FP_CONNECTED});
  273. }
  274.  
  275. // ATTENDI CHE TUTTE LE FUNZIONI RESTITUISCANO IL DATO RICHIESTO E CHIAMA LA FUNZIONE DI SALVATAGGIO E INVIO AL MAIN PROCESS
  276. async function getAllData() {
  277.   await getEftPos().then(data => STORED_DATA.eft_pos_config = data)
  278.   await getConfig().then(data => STORED_DATA.config = data)
  279.   await getFlags().then(data => STORED_DATA.flags = data)
  280.   await getKeyboard().then(data => STORED_DATA.key = data)
  281.   saveFile()
  282. }
  283.  
  284. ipc.on("data-to-restore", (event, arg) => {
  285.   setAllData(arg)
  286. })
  287.  
  288. async function setEftPos(eftConfig) {
  289.   ipc.send('eft-progress-bar', [1, "Programmazione"])
  290.   return new Promise((resolve, reject) => {
  291.  
  292.     const protocol = store.configData["protocol"];
  293.     const ipAddress = store.configData["ipAddress"];
  294.     const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  295.     const dataCommand = `<printerCommand> <directIO command="4031" data="${eftConfig}" /> </printerCommand>`;
  296.  
  297.     const epos = new epson.fiscalPrint();
  298.  
  299.     epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  300.       if (result.success == true) {
  301.         console.log(`Restore EFT-POS --> ${add_info.responseData}`)
  302.         //eftBar.animate(1)
  303.         ipc.send('set-value', 1)
  304.         resolve(add_info.responseData)
  305.       }
  306.     };
  307.     epos.onerror = (result) => {
  308.       if (!result.success) {
  309.         reject(result)
  310.       }
  311.     };
  312.     epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  313.   })
  314. }
  315.  
  316. async function setConfig(config) {
  317.   let setConfigLenght = 0;
  318.   ipc.send('config-progress-bar', [config.length, "Programmazione"])
  319.  
  320.   for (let index = 0; index < config.length; index++) {
  321.     await setConfigPromise(config[index])
  322.   }
  323.  
  324.   function setConfigPromise(setData) {
  325.     return new Promise((resolve, reject) => {
  326.  
  327.       const protocol = store.configData["protocol"];
  328.       const ipAddress = store.configData["ipAddress"];
  329.       const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  330.       const dataCommand = `<printerCommand> <directIO command="4015" data="${setData}" /> </printerCommand>`;
  331.       const epos = new epson.fiscalPrint();
  332.  
  333.       epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  334.         if (result.success) {
  335.  
  336.           setConfigLenght++
  337.           console.log(`Restore Config --> ${add_info.responseData}`)
  338.           ipc.send('set-value', setConfigLenght)
  339.          
  340.           resolve(result)
  341.         }
  342.       };
  343.       epos.onerror = (result) => {
  344.         if (!result.success) {
  345.           //console.log(result)
  346.           reject(result)
  347.         }
  348.       };
  349.       epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  350.     });
  351.   }
  352.   return Promise.resolve()
  353. }
  354.  
  355. async function setFlags(flags) {
  356.   let setFlagsLenght = 0;
  357.   console.log(flags.length)
  358.   ipc.send('flags-progress-bar', [flags.length, "Programmazione"])
  359.  
  360.   for (let index = 0; index < flags.length; index++) {
  361.     console.log(index)
  362.     if(index == 13) {
  363.       continue
  364.     }
  365.     await setFlagsPromise(flags[index])
  366.   }
  367.  
  368.   function setFlagsPromise(setData) {
  369.     return new Promise((resolve, reject) => {
  370.  
  371.       const protocol = store.configData["protocol"];
  372.       const ipAddress = store.configData["ipAddress"];
  373.       const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  374.       const dataCommand = `<printerCommand> <directIO command="4014" data="${setData}" /> </printerCommand>`;
  375.       const epos = new epson.fiscalPrint();
  376.  
  377.       epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  378.         if (result.success) {
  379.  
  380.           setFlagsLenght++
  381.           ipc.send('set-value', setFlagsLenght)
  382.           console.log(dataCommand)
  383.           //console.log(`Restore Flags --> ${add_info.responseData}`)
  384.           resolve(result)
  385.         }
  386.       };
  387.       epos.onerror = (result) => {
  388.         if (result.success == "false") {
  389.           console.log(result)
  390.           reject(result)
  391.         }
  392.       };
  393.       epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  394.     });
  395.   }
  396.   return Promise.resolve()
  397. }
  398.  
  399. async function setKeyboard(keys) {
  400.   let setKeysLenght = 0;
  401.   //console.log(keys.length)
  402.   ipc.send('keyboard-progress-bar', [keys.length, "Programmazione"])
  403.  
  404.   for (let index = 0; index < keys.length; index++) {
  405.     if(index == 117) {
  406.       continue
  407.     }
  408.     console.log(index)
  409. /*     if(index == 13) {
  410.       continue
  411.     } */
  412.     await setFlagsPromise(keys[index])
  413.   }
  414.  
  415.   function setFlagsPromise(setData) {
  416.     return new Promise((resolve, reject) => {
  417.  
  418.       const protocol = store.configData["protocol"];
  419.       const ipAddress = store.configData["ipAddress"];
  420.       const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  421.       const dataCommand = `<printerCommand> <directIO command="4029" data="${setData}" /> </printerCommand>`;
  422.       const epos = new epson.fiscalPrint();
  423.  
  424.       epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  425.         if (result.success) {
  426.  
  427.           setKeysLenght++
  428.           ipc.send('set-value', setKeysLenght)
  429.           console.log(dataCommand)
  430.           //console.log(`Restore Flags --> ${add_info.responseData}`)
  431.           resolve(result)
  432.         }
  433.       };
  434.       epos.onerror = (result) => {
  435.         if (result.success == "false") {
  436.           console.log(result)
  437.           reject(result)
  438.         }
  439.       };
  440.       epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  441.     });
  442.   }
  443.   return Promise.resolve()
  444. }
  445.  
  446. async function setAllData(data) {
  447.   const eft_pos_received = data.eft_pos_config;
  448.   const config_received = data.config;
  449.   const flags_received = data.flags;
  450.   const keys_received = data.key;
  451.  
  452. /* const flags_received = data.flags;
  453.   const key_received = data.key; */
  454.   await setEftPos(eft_pos_received)
  455.   await setConfig(config_received)
  456.   await setFlags(flags_received)
  457.   await setKeyboard(keys_received)
  458. /*  await setFlags()
  459.    */
  460.  
  461. }
  462.  
  463.  
  464.  
  465. /* async function setEftPos() {
  466.   ipc.send('eft-progress-bar', 1)
  467.   return new Promise((resolve, reject) => {
  468.  
  469.     const protocol = store.configData["protocol"];
  470.     const ipAddress = store.configData["ipAddress"];
  471.     const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  472.     const dataCommand = `<printerCommand> <directIO command="4231" data="" /> </printerCommand>`;
  473.  
  474.     const epos = new epson.fiscalPrint();
  475.  
  476.     epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  477.       if (result.success == true) {
  478.         console.log(`EFT_POS --> ${add_info.responseData}`)
  479.         //eftBar.animate(1)
  480.         ipc.send('set-value', 1)
  481.         resolve(add_info.responseData)
  482.       }
  483.     };
  484.     epos.onerror = (result) => {
  485.       if (!result.success) {
  486.         reject(result)
  487.       }
  488.     };
  489.     epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  490.   })
  491. }
  492.  
  493. async function setFlags() {
  494.   ipc.send('flags-progress-bar', getIndexFromFirmware()[0])
  495.   let FlagsLenght = 0;
  496.   let data = []
  497.  
  498.   for (i = 1; i < (getIndexFromFirmware()[0])+1; i++) {
  499.     if ((i + "").length < 2) {
  500.       index = "0" + i
  501.     } else {
  502.       index = i.toString()
  503.     }
  504.     await getSingleFlagsPromise(index);
  505.   }
  506.  
  507.   function getSingleFlagsPromise(id) {
  508.  
  509.     return new Promise((resolve, reject) => {
  510.  
  511.       const protocol = store.configData["protocol"];
  512.       const ipAddress = store.configData["ipAddress"];
  513.       const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  514.       const dataCommand = `<printerCommand> <directIO command="4214" data="${id}" /> </printerCommand>`;
  515.       const epos = new epson.fiscalPrint();
  516.  
  517.       epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  518.         if (result.success) {
  519.           data.push(add_info.responseData)
  520.           FlagsLenght++
  521.           ipc.send('set-value', (FlagsLenght))
  522.           console.log(`FLAGS S14 --> ${index} --> ${add_info.responseData}`)
  523.           resolve(data)
  524.           //flagsBar.animate(FlagsLenght/getIndexFromFirmware()[0]);
  525.         }
  526.       };
  527.       epos.onerror = (result) => {
  528.         if (!result.success) {
  529.           console.log(result)
  530.           reject(result)
  531.         }
  532.       };
  533.       epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  534.     });
  535.   }
  536.   return Promise.resolve(data)
  537. }
  538.  
  539. async function getConfig() {
  540.   //console.log(getIndexFromFirmware())
  541.   ipc.send('config-progress-bar', getIndexFromFirmware()[1] )
  542.   let getConfigLenght = 0;
  543.   let data = []
  544.  
  545.   for (i = 1; i < getIndexFromFirmware()[1]+1; i++) {
  546.     if ((i + "").length < 2) {
  547.       index = "0" + i
  548.     } else {
  549.       index = i.toString()
  550.     }
  551.     await getSingleConfigPromise(index)
  552.   }
  553.  
  554.   function setSingleConfigPromise(id) {
  555.  
  556.     return new Promise((resolve, reject) => {
  557.  
  558.       const protocol = store.configData["protocol"];
  559.       const ipAddress = store.configData["ipAddress"];
  560.       const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  561.       const dataCommand = `<printerCommand> <directIO command="4215" data="${id}" /> </printerCommand>`;
  562.       const epos = new epson.fiscalPrint();
  563.  
  564.       epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  565.         if (result.success) {
  566.           data.push(add_info.responseData)
  567.           getConfigLenght++
  568.           console.log(`CONFIG S15 --> ${index} --> ${add_info.responseData}`)
  569.           //configBar.animate(getConfigLenght/getIndexFromFirmware()[1]);
  570.           ipc.send('set-value', (getConfigLenght))
  571.           //ipc.send('progress', (getConfigLenght/26).toFixed(2));
  572.           resolve(data)
  573.         }
  574.       };
  575.       epos.onerror = (result) => {
  576.         if (!result.success) {
  577.           console.log(result)
  578.           reject(result)
  579.         }
  580.       };
  581.       epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  582.     });
  583.   }
  584.   return Promise.resolve(data)
  585. }
  586.  
  587. async function setKeyboard() {
  588.   ipc.send('keyboard-progress-bar')
  589.   let data = []
  590.   let keybarLength = 0;
  591.   for (i = 1; i < 256; i++) {
  592.     if ((i + "").length < 2) {
  593.       index = "00" + i
  594.     } else if ((i + "").length < 3) {
  595.       index = "0" + i
  596.     } else {
  597.       index = i.toString()
  598.     }
  599.     await getSingleKeyboardPromise(index)
  600.   }
  601.  
  602.   function getSingleKeyboardPromise(id) {
  603.    
  604.     return new Promise((resolve, reject) => {
  605.  
  606.       const protocol = store.configData["protocol"];
  607.       const ipAddress = store.configData["ipAddress"];
  608.       const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
  609.       const dataCommand = `<printerCommand> <directIO command="4229" data="${id}" /> </printerCommand>`;
  610.       const epos = new epson.fiscalPrint();
  611.  
  612.       epos.onreceive = (result, tag_names_array, add_info, res_add) => {
  613.         if (result.success) {
  614.           data.push(add_info.responseData)
  615.           keybarLength ++;
  616.           ipc.send('set-value', (keybarLength))
  617.           console.log(`KEY FUNCTION S29 --> ${index} --> ${add_info.responseData}`)
  618.           //keyBar.animate(keybarLength/255);
  619.          
  620.           resolve(data)
  621.         }
  622.       };
  623.       epos.onerror = (result) => {
  624.         if (!result.success) {
  625.           //console.log(result)
  626.           reject(result)
  627.         }
  628.       };
  629.       epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
  630.     });
  631.   }
  632.   return Promise.resolve(data)
  633. } */
RAW Paste Data