diff --git a/.github/workflows/master_phpserial.yml b/.github/workflows/master_phpserial.yml
new file mode 100644
index 000000000..12882e52f
--- /dev/null
+++ b/.github/workflows/master_phpserial.yml
@@ -0,0 +1,60 @@
+# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
+# More GitHub Actions for Azure: https://github.com/Azure/actions
+
+name: Build and deploy PHP app to Azure Web App - phpserial
+
+on:
+ push:
+ branches:
+ - master
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '8.2'
+
+ - name: Check if composer.json exists
+ id: check_files
+ uses: andstor/file-existence-action@v1
+ with:
+ files: 'composer.json'
+
+ - name: Run composer install if composer.json exists
+ if: steps.check_files.outputs.files_exists == 'true'
+ run: composer validate --no-check-publish && composer install --prefer-dist --no-progress
+
+ - name: Upload artifact for deployment job
+ uses: actions/upload-artifact@v2
+ with:
+ name: php-app
+ path: .
+
+ deploy:
+ runs-on: ubuntu-latest
+ needs: build
+ environment:
+ name: 'Production'
+ url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
+
+ steps:
+ - name: Download artifact from build job
+ uses: actions/download-artifact@v2
+ with:
+ name: php-app
+
+ - name: 'Deploy to Azure Web App'
+ uses: azure/webapps-deploy@v2
+ id: deploy-to-webapp
+ with:
+ app-name: 'phpserial'
+ slot-name: 'Production'
+ publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_3802BA5F7DB1469F8E6A590AF17D87FA }}
+ package: .
diff --git a/index.html b/index.html
new file mode 100644
index 000000000..4ee102a80
--- /dev/null
+++ b/index.html
@@ -0,0 +1,95 @@
+
+
+
+Page Title
+
+
+
+
+
+
+
+
+
+
diff --git a/index.php b/index.php
index 82966e27a..b1ffcccc0 100644
--- a/index.php
+++ b/index.php
@@ -1,3 +1,156 @@
Connect";
+ //echo ""
+ echo " ";
+
+
+ $tipoMsg = "113";
+
+ $tmp = "$tipoMsg~0008";
+/*
+ echo "\n";
+
+ echo "\n";
+
+}
+
+
+function hexToStr($hex){
+ $string='';
+ for ($i=0; $i < strlen($hex)-1; $i+=2){
+ $string .= chr(hexdec($hex[$i].$hex[$i+1]));
+ }
+ return $string;
+}
+
+
+if($_POST){
+
+
+ foreach ($_POST as $key => $value){
+ //echo "$key => $value";
+
+ $sel["$key"] = urldecode($value);
+ }
+
+
+ // $codeid = isset($sel['codeid'])?$sel['codeid']:null;
+ // $com = isset($sel['com'])?$sel['com']:null;
+ // $tipoMsg = isset($sel['tipoMsg'])?$sel['tipoMsg']:null;
+ // $risposta = isset($sel['risposta'])?$sel['risposta']:null;
+ $rispostaCom = isset($sel['rispostaCom'])?$sel['rispostaCom']:null;
+ //$richiesta = isset($sel['richiesta'])?$sel['richiesta']:null;
+ $pattern = '/^[a-fA-F0-9]{16,16}$/';
+
+ // $_SESSION['AWP']['id_ente_old']=isset($sel['idEnte'])?$sel['idEnte']:$_SESSION['AWP']['id_ente_old'];
+ // $_SESSION['AWP']['id_ver']=isset($sel['idVerifica'])?$sel['idVerifica']:$_SESSION['AWP']['id_ver'];
+
+ if($rispostaCom){
+
+ if($rispostaCom == 'prova' || $rispostaCom == null){
+
+ $rc="problemi con activex";
+ $fase = 4;
+ //$rc= getValue('help.txt',$fase);
+ }else{
+ //exit;
+ //$tmp1=explode('#',$richiesta);
+
+
+ $rispostaCom=hexToStr($rispostaCom);
+
+ $itemRis= explode('~',$rispostaCom);
+
+ // $data['CNTTOTIN'] = intval($itemRis[5]);
+ // $data['CNTTOTOT'] = intval($itemRis[6]);
+ // $data['CNTCL'] = intval($itemRis[7]);
+ // $data['CNTOT'] = intval($itemRis[9]);
+ // $data['CNTNP'] = intval($itemRis[10]);
+ // $data['CNTIN'] = intval($itemRis[8]);
+
+ // $message = 'CNTTOTIN:'. $data['CNTTOTIN'] .'
+ // CNTTOTOT:'. $data['CNTTOTOT'].'
+ // CNTCL:'. $data['CNTCL'] .'
+ // CNTOT:'. $data['CNTOT'] .'
+ // CNTNP:'. $data['CNTNP'] .'
+ // CNTIN:'. $data['CNTIN'] .'
';
+
+ //echo $message;
+
+
+ $response = "########################################
+ Id_messaggio: " . $itemRis[0] . "
+ L_messaggio: " . $itemRis[1] . "
+ DATA_Risposta: " . $itemRis[2] . "
+ CODEID: " . $itemRis[3] . "
+ ESITO: " . $itemRis[4] . "
+ Valore contatore CNTTOTIN: " . $itemRis[5] . "
+ Valore contatore CNTTOTOT: " . $itemRis[6] . "
+ Valore contatore CNTCL: " . $itemRis[7] . "
+ Valore contatore CNTIN: " . $itemRis[8] . "
+ Valore contatore CNTOT: " . $itemRis[9] . "
+ Valore contatore CNTNP: " . $itemRis[10] . "
+ ORA_Risposta: " . $itemRis[11] . "
+ Codice_autenticazione: " . $itemRis[12] . "
+ Esito_comunicazione: " . $itemRis[13] . "
+ ########################################
";
+
+ echo $response;
+
+ echo "\n";
+
+ //echo $rispostaCom;
+ //die();
+ }
+ }
+}
+
+
+
+?>
+
+
+
+
+Page Title
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jsSerialApi.js b/jsSerialApi.js
new file mode 100644
index 000000000..11e96db83
--- /dev/null
+++ b/jsSerialApi.js
@@ -0,0 +1,155 @@
+let port, ports, textEncoder, writer, writableStreamClosed = -1;
+
+function translateConvertedChar2ClearChar(inputString) {
+ var campoOut = "";
+ var byteOut = "";
+ var arr = new Array();
+ var campoWorking = inputString;
+
+ if (inputString == null || inputString == "") {
+ return campoOut;
+ }
+
+ for (i = 0; i < inputString.length; i++) {
+ codice = inputString.charCodeAt(i);
+ byteOut = d2h(codice);
+ byteOut = byteOut.toUpperCase();
+
+ if (byteOut == 1 || byteOut == 2 || byteOut == 3 || byteOut == 4 || byteOut == 5 || byteOut == 6 || byteOut == 7 || byteOut == 8 || byteOut == 9 || byteOut == 'A' || byteOut == 'B' || byteOut == 'C' || byteOut == 'D' || byteOut == 'E' || byteOut == 'F') {
+
+
+ byteOut = '0' + byteOut;
+
+ }
+ if (byteOut == 100) {
+ byteOut = '00';
+ }
+
+ campoOut = campoOut + byteOut;
+
+ arraylen = arr.push(byteOut);
+ }
+ return campoOut;
+}
+
+function sendData(){
+ let txt = document.getElementById("messaggio").value;
+ console.log("Messaggio: " + txt);
+ writeSerialData(txt)
+}
+
+
+navigator.serial.addEventListener('connect', e => {
+ alert("connected");
+});
+
+ // Richiedi l'accesso alla porta seriale
+async function requestSerialPort() {
+ if ("serial" in navigator) {
+ console.log("Web Serial API is supported.");
+ try {
+ port = await navigator.serial.requestPort();
+ await port.open({ baudRate: 19200 }); // Configura la velocità di baud rate appropriata
+ let settings = {};
+
+ if (localStorage.dtrOn == "true") settings.dataTerminalReady = true;
+ if (localStorage.rtsOn == "true") settings.requestToSend = true;
+ if (Object.keys(settings).length > 0) await port.setSignals(settings);
+
+ textEncoder = new TextEncoderStream();
+ writableStreamClosed = textEncoder.readable.pipeTo(port.writable);
+ writer = textEncoder.writable.getWriter();
+
+ return port;
+
+ } catch (error) {
+ console.error("Errore durante la richiesta della porta seriale:", error);
+ }
+ } else {
+ console.error("Web Serial API not supported.");
+ }
+}
+
+// Leggi dati dalla porta seriale
+async function readSerialData(port) {
+ const reader = port.readable.getReader();
+ let app = '';
+ let ricev = '';
+ while (true) {
+ try {
+ console.log("Inizio lettura");
+ const { value, done } = await reader.read();
+ console.log("Conferma lettura da porta: "+ done);
+ if (done) break;
+ console.log("");
+ let arr = value;
+
+ for (x = 0; x < arr.length; x++) {
+ if (arr[x] == 0) {
+ arr[x] = 256;
+ }
+ //conversione dei singoli byte da charcode a carattere
+ ricev = String.fromCharCode(arr[x]);
+ app = app + ricev;
+ }
+
+ console.log("Ricevuto:" + app);
+
+
+ let translate = translateConvertedChar2ClearChar(app);
+ console.log("translate: " + translate)
+ document.getElementById("rispostaCom").value=translate;
+ document.getElementById('form1').submit();
+ //------------------------------------------
+
+ } catch (error) {
+ console.error("Errore durante la lettura dati seriali:", error);
+ break;
+ }
+ }
+
+ reader.releaseLock();
+}
+
+// Scrivi dati sulla porta seriale
+async function writeSerialData(data) {
+ try {
+ await writer.write(data + "\n");
+ console.log("Dati seriali inviati con successo.");
+ } catch (error) {
+ console.error("Errore durante l'invio dati seriali:", error);
+ }
+}
+
+function stopSerialCommunication(){
+ writer.releaseLock();
+}
+
+// Esempio di utilizzo
+async function startSerialCommunication() {
+ port = await requestSerialPort();
+
+ if (port) {
+ console.log("Porta selezionata")
+ await readSerialData(port);
+ conaole.log("Lettura su porta selezionata!");
+ await writeSerialData(port, "Dati da inviare sulla porta seriale");
+ conaole.log("Scrittura su porta selezionata!");
+ }
+ else {
+ console.log("Porta non trovata!")
+ }
+}
+
+function h2d(h) { return parseInt(h, 16); }
+
+function d2h(d) { return d.toString(16); }
+
+const connBtn = document.getElementById('connectBtn');
+connBtn.addEventListener('click', () => {
+ connBtn.disabled = true;
+ const sendBtn = document.getElementById('sendBtn');
+ sendBtn.disabled = false;
+});
+
+