diff --git a/Debug/Prog1HaziKliens.exe b/Debug/Prog1HaziKliens.exe index 508c67432e2483aa49135f2f7e37e52533e5dfc6..1396a1da948f1cf31efd105eccb71dbf7ed0e839 100644 Binary files a/Debug/Prog1HaziKliens.exe and b/Debug/Prog1HaziKliens.exe differ diff --git a/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog b/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog index 73769607a73cfde685afba8fcec3c9404d008c0d..014d14f1b7b084d1c17a3edd0a27cd5f7efac5ae 100644 Binary files a/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog and b/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog differ diff --git a/Debug/Prog1HaziKliens.tlog/CL.read.1.tlog b/Debug/Prog1HaziKliens.tlog/CL.read.1.tlog index 771d65662a18f11c6292570ebe2d4ab651a21a36..b4ca9b52d670b5ec0cfc4d4e8b18e217d77dfddd 100644 Binary files a/Debug/Prog1HaziKliens.tlog/CL.read.1.tlog and b/Debug/Prog1HaziKliens.tlog/CL.read.1.tlog differ diff --git a/Debug/kliensfo.obj.enc b/Debug/kliensfo.obj.enc new file mode 100644 index 0000000000000000000000000000000000000000..1b5756114c1ec76e1972c6ecb42615eafcc8063b Binary files /dev/null and b/Debug/kliensfo.obj.enc differ diff --git a/Debug/offline/!Mosogep.sch.html b/Debug/offline/!Mosogep.sch.html new file mode 100644 index 0000000000000000000000000000000000000000..d1770219059543a9a50b18209685cffa81632434 --- /dev/null +++ b/Debug/offline/!Mosogep.sch.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<html class="gr__mosogep_sch_bme_hu"><head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> + <script async="" src="Mos%C3%B3g%C3%A9p.sch_elemei/analytics.js"></script><script src="Mos%C3%B3g%C3%A9p.sch_elemei/jQuery.js"></script> + <script src="Mos%C3%B3g%C3%A9p.sch_elemei/bootstrap.js"></script> + <script src="Mos%C3%B3g%C3%A9p.sch_elemei/main.js"></script> + <link rel="stylesheet" href="Mos%C3%B3g%C3%A9p.sch_elemei/bootstrap.css"> + <link rel="stylesheet" href="Mos%C3%B3g%C3%A9p.sch_elemei/bootstrap-theme.css"> + <link rel="stylesheet" href="Mos%C3%B3g%C3%A9p.sch_elemei/main.css"> + <title>Mosógép.sch</title> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/png" href="http://mosogep.sch.bme.hu/img/logo.png"> + </head> + <body data-gr-c-s-loaded="true"> + <script> + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', 'UA-62326239-1', 'auto'); + ga('send', 'pageview'); + + </script> + <div class="all"> + <div class="full container-fluid"> + <!--Fejléc--> + <div class="row"> + <div class="col-xs-12"> + <div class="head"> + <div class="logo"> + <img src="Mos%C3%B3g%C3%A9p.sch_elemei/sem_logo.png" alt="sem logó" height="50"> + </div> + <h1 class="pull-right">Mosógép.sch</h1> + </div> + </div> + </div> + <!--Szintek--> + <div class="row"><div class="col-xs-12 col-sm-6" id="f3"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">3. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Foglalt!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div><div class="col-xs-12 col-sm-6" id="f5"><div class="panel panel-info"><div class="panel-heading"><h4 class="panel-title">5. szint</h4></div><div class="panel-body"><span class="green-text"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Mosógép: Szabad!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div></div><div class="row"><div class="col-xs-12 col-sm-6" id="f6"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">6. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Nincs információ!</span><br><span></span><br></div></div></div><div class="col-xs-12 col-sm-6" id="f7"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">7. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Foglalt!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div></div><div class="row"><div class="col-xs-12 col-sm-6" id="f9"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">9. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Foglalt!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div><div class="col-xs-12 col-sm-6" id="f10"><div class="panel panel-success"><div class="panel-heading"><h4 class="panel-title">10. szint</h4></div><div class="panel-body"><span class="green-text"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Mosógép: Szabad!</span><br><span></span><br></div></div></div></div><div class="row"><div class="col-xs-12 col-sm-6" id="f11"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">11. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Foglalt!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div><div class="col-xs-12 col-sm-6" id="f13"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">13. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Foglalt!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div></div><div class="row"><div class="col-xs-12 col-sm-6" id="f15"><div class="panel panel-success"><div class="panel-heading"><h4 class="panel-title">15. szint</h4></div><div class="panel-body"><span class="green-text"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Mosógép: Szabad!</span><br><span class="green-text"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Szárító: Szabad!</span></div></div></div><div class="col-xs-12 col-sm-6" id="f16"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">16. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Nincs információ!</span><br><span></span><br></div></div></div></div><div class="row"><div class="col-xs-12 col-sm-6" id="f17"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">17. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Nincs információ!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Nincs információ!<br>Túl régen érkezett adat az eszköztől!</span></div></div></div></div> <!--Lábléc--> + <div class="row"> + <div class="col-xs-12"> + <div class="foot"> + <p> + Ha úgy látod, hogy hosszú ideig (több mint 5 perc) nem a valóságot írja az oldal, akkor írj a mosogep@sch címre<br> + Mosógép.sch by SEM<br> + Hosted by KSZK<br> + (Design and programming by SaintS 2015) + </p> + </div> + </div> + </div> + </div> + </div> + + +</body></html> \ No newline at end of file diff --git a/Debug/offline/b.html b/Debug/offline/bbbbbbbb.html similarity index 100% rename from Debug/offline/b.html rename to Debug/offline/bbbbbbbb.html diff --git a/Debug/offline/s.txt b/Debug/offline/c.html similarity index 100% rename from Debug/offline/s.txt rename to Debug/offline/c.html diff --git a/Debug/offline/ddddddddddd.html b/Debug/offline/ddddddddddd.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Debug/offline/e.html b/Debug/offline/e.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Debug/offline/test.txt b/Debug/offline/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Debug/vc140.idb b/Debug/vc140.idb index 97d3a275c6d0510d886fbbabefe0919cbc3c3e1f..e44e05751ddbd20db5cc138e1acba44a85bda0a5 100644 Binary files a/Debug/vc140.idb and b/Debug/vc140.idb differ diff --git a/KliensFo.c b/KliensFo.c index 6501d9936c4f0f662bf4ce2083ce3e187e13e377..68811d1ad6ceb5d1d56da80b8ed17910d7e584bb 100644 --- a/KliensFo.c +++ b/KliensFo.c @@ -8,7 +8,6 @@ #include <dirent.h> #include "3rdparty/mysql-connector-c-6.1.11-win32\include\mysql.h" #include "3rdparty\curl-7.56.0\builds\libcurl-vc-x86-release-dll-ipv6-sspi-winssl\include\curl\curl.h" - char IsNaN(float f) { return !(f >= -FLT_MAX); @@ -208,9 +207,9 @@ int EszkozokSzama = 0; void EszkozTombNoveles(int proba) { - if (proba > 3) + if (proba > 10) { - printf("Multiple errors during memory allocation!"); + printf("Multiple failures during memory allocation!\n"); return; } @@ -226,13 +225,14 @@ void EszkozTombNoveles(int proba) ++EszkozokSzama; // Make the array bigger EszkozokBuffer = realloc(Eszkozok, EszkozokSzama * sizeof(Eszkoz)); - if (!EszkozokBuffer) { --EszkozokSzama; EszkozTombNoveles(proba + 1); return; } + if (!EszkozokBuffer) { --EszkozokSzama; delay(10); EszkozTombNoveles(proba + 1); return; } Eszkozok = EszkozokBuffer; Eszkozok[EszkozokSzama - 1].OsszMukodes = 0; Eszkozok[EszkozokSzama - 1].OsszPihenes = 0; Eszkozok[EszkozokSzama - 1].OsszNincsadat = 0; + //printf_s("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"); // Clean up when you're done. //free(EszkozokBuffer); } @@ -279,189 +279,194 @@ void EszkozKiiro(Eszkoz eszk) printf(" -=>Logged time: %ds\n -->Active duration: %ds\n -->Inactive duration: %ds\n -->N/A duration: %ds\n\n", eszk.OsszLogHossz, eszk.OsszMukodes, eszk.OsszPihenes, eszk.OsszNincsadat); } -void Felugyelet() +void StatisztikaKeszitesKiiras() { - printf("MODE: Online Supervision\n"); - - // Allocation (let's suppose size contains some value discovered at runtime, - // e.g. obtained from some external source) + qsort(Eszkozok, EszkozokSzama, sizeof(Eszkoz), CompareEszkozEmelet); - Eszkozok = malloc(EszkozokSzama * sizeof(Eszkoz)); + float atlagMosogep = 0, atlagSzarito = 0, abszelterMosogep = 0, abszelterSzarito = 0; + int MosogepSzam = 0, SzaritoSzam = 0; - if (mysql_query(conn, "SELECT * FROM geplog") == 0) + int i; + for (i = 0; i < EszkozokSzama; ++i) { - res = mysql_store_result(conn); - - //int num_fields = mysql_num_fields(res); - printf("SQl query resulted in %d rows.\n\n", mysql_num_rows(res)); + Eszkozok[i].MukodesArany = (float)Eszkozok[i].OsszMukodes / (float)(Eszkozok[i].OsszMukodes + Eszkozok[i].OsszPihenes); + Eszkozok[i].OsszLogHossz = Eszkozok[i].OsszMukodes + Eszkozok[i].OsszPihenes + Eszkozok[i].OsszNincsadat; - int x; - while ((row = mysql_fetch_row(res))) + if (!IsNaN(Eszkozok[i].MukodesArany)) { - x = GetEszkozIndex(atoi(row[2]), atoi(row[1])); - - if (x == -1) + if (Eszkozok[i].Tipus == 1) { - EszkozTombNoveles(1); - x = EszkozokSzama - 1; - - Eszkozok[x].Emelet = atoi(row[2]); - Eszkozok[x].Tipus = atoi(row[1]); + ++MosogepSzam; + atlagMosogep += Eszkozok[i].MukodesArany; } + else if (Eszkozok[i].Tipus == 0) + { + ++SzaritoSzam; + atlagSzarito += Eszkozok[i].MukodesArany; - if (atoi(row[3]) == 0)//Inakt�v - Eszkozok[x].OsszPihenes += atoi(row[4]); - else if (atoi(row[3]) == 1)//Akt�v - Eszkozok[x].OsszMukodes += atoi(row[4]); - else //N/ - Eszkozok[x].OsszNincsadat += atoi(row[4]); - - //int n; - //// Print all columns - //for (n = 0; n < num_fields; n++) - //{ - // // Make sure row[i] is valid! - // if (row[n] != NULL) - // printf("%s ", row[n]); - // else - // printf("NULL"); - //} - //printf("\n"); + } } + } - // DON'T FORGET TO CLEAN RESULT AFTER YOU DON'T NEED IT - // ANYMORE - if (res != NULL) - mysql_free_result(res); - - qsort(Eszkozok, EszkozokSzama, sizeof(Eszkoz), CompareEszkozEmelet); - + if (MosogepSzam > 0) + atlagMosogep /= (float)MosogepSzam; - float atlagMosogep = 0, atlagSzarito = 0, abszelterMosogep = 0, abszelterSzarito = 0; - int MosogepSzam = 0, SzaritoSzam = 0; + if (SzaritoSzam > 0) + atlagSzarito /= (float)SzaritoSzam; - int i; - for (i = 0; i < EszkozokSzama; ++i) + for (i = 0; i < EszkozokSzama; ++i) + { + if (!IsNaN(Eszkozok[i].MukodesArany)) { - Eszkozok[i].MukodesArany = (float)Eszkozok[i].OsszMukodes / (float)(Eszkozok[i].OsszMukodes + Eszkozok[i].OsszPihenes); - Eszkozok[i].OsszLogHossz = Eszkozok[i].OsszMukodes + Eszkozok[i].OsszPihenes + Eszkozok[i].OsszNincsadat; - - if (!IsNaN(Eszkozok[i].MukodesArany)) + if (Eszkozok[i].Tipus == 1 && MosogepSzam > 0) { - if (Eszkozok[i].Tipus == 1) - { - ++MosogepSzam; - atlagMosogep += Eszkozok[i].MukodesArany; - } - else if (Eszkozok[i].Tipus == 0) - { - ++SzaritoSzam; - atlagSzarito += Eszkozok[i].MukodesArany; + abszelterMosogep += fabs(atlagMosogep - Eszkozok[i].MukodesArany); + } + else if (Eszkozok[i].Tipus == 0 && SzaritoSzam > 0) + { + abszelterSzarito += fabs(atlagSzarito - Eszkozok[i].MukodesArany); - } } } + } - if (MosogepSzam > 0) - atlagMosogep /= (float)MosogepSzam; + if (MosogepSzam > 0) + { - if (SzaritoSzam > 0) - atlagSzarito /= (float)SzaritoSzam; + abszelterMosogep /= (float)MosogepSzam; + printf("----------\n"); + printf("=Washing Machines:\n"); + printf("==Average Utilisation: %f%%\n", atlagMosogep * 100); + printf("==Average Absolute Deviation: %f%%\n", abszelterMosogep * 100); + printf("==Floors With Outstanding Values:\n"); for (i = 0; i < EszkozokSzama; ++i) { if (!IsNaN(Eszkozok[i].MukodesArany)) { - if (Eszkozok[i].Tipus == 1 && MosogepSzam > 0) - { - abszelterMosogep += fabs(atlagMosogep - Eszkozok[i].MukodesArany); - } - else if (Eszkozok[i].Tipus == 0 && SzaritoSzam > 0) + if (Eszkozok[i].Tipus == 1) { - abszelterSzarito += fabs(atlagSzarito - Eszkozok[i].MukodesArany); - + if (Eszkozok[i].MukodesArany > atlagMosogep + abszelterMosogep) + { + printf("===>>%d\n", Eszkozok[i].Emelet); + } } } } + printf("----------\n"); + } - if (MosogepSzam > 0) - { + if (SzaritoSzam > 0) + { - abszelterMosogep /= (float)MosogepSzam; + abszelterSzarito /= (float)SzaritoSzam; - printf("----------\n"); - printf("=Washing Machines:\n"); - printf("==Average Utilisation: %f%%\n", atlagMosogep * 100); - printf("==Average Absolute Deviation: %f%%\n", abszelterMosogep * 100); - printf("==Floors With Outstanding Values:\n"); - for (i = 0; i < EszkozokSzama; ++i) + printf("----------\n"); + printf("=Dryers:\n"); + printf("==Average Utilisation: %f%%\n", atlagSzarito * 100); + printf("==Average Absolute Deviation: %f%%\n", abszelterSzarito * 100); + printf("==Floors With Outstanding Values:\n"); + for (i = 0; i < EszkozokSzama; ++i) + { + if (!IsNaN(Eszkozok[i].MukodesArany)) { - if (!IsNaN(Eszkozok[i].MukodesArany)) + if (Eszkozok[i].Tipus == 0) { - if (Eszkozok[i].Tipus == 1) + if (Eszkozok[i].MukodesArany > atlagSzarito + abszelterSzarito) { - if (Eszkozok[i].MukodesArany > atlagMosogep + abszelterMosogep) - { - printf("==>>%d\n", Eszkozok[i].Emelet); - } + printf("===>>%d\n", Eszkozok[i].Emelet); } } } - printf("----------\n"); } + printf("----------\n"); + } - if (SzaritoSzam > 0) - { - abszelterSzarito /= (float)SzaritoSzam; + printf("\n-------------------------------------------------------\n"); + printf("=Washing Machines:\n"); + printf("-------------------------------------------------------\n"); + { + for (i = 0; i < EszkozokSzama; i++) + { + if (Eszkozok[i].Tipus == 1) + EszkozKiiro(Eszkozok[i]); - printf("----------\n"); - printf("=Dryers:\n"); - printf("==Average Utilisation: %f%%\n", atlagSzarito * 100); - printf("==Average Absolute Deviation: %f%%\n", abszelterSzarito * 100); - printf("==Floors With Outstanding Values:\n"); - for (i = 0; i < EszkozokSzama; ++i) - { - if (!IsNaN(Eszkozok[i].MukodesArany)) - { - if (Eszkozok[i].Tipus == 0) - { - if (Eszkozok[i].MukodesArany > atlagSzarito + abszelterSzarito) - { - printf("==>>%d\n", Eszkozok[i].Emelet); - } - } - } - } - printf("----------\n"); } printf("\n-------------------------------------------------------\n"); - printf("=Washing Machines:\n"); + printf("=Dryers:\n"); printf("-------------------------------------------------------\n"); + for (i = 0; i < EszkozokSzama; i++) { - for (i = 0; i < EszkozokSzama; i++) - { - if (Eszkozok[i].Tipus == 1) - EszkozKiiro(Eszkozok[i]); + if (Eszkozok[i].Tipus == 0) + EszkozKiiro(Eszkozok[i]); - } + } + } + + printf("\n >>>>>>>>>>> SCROLL TO THE TOP TO SEE THE REPORT! <<<<<<<<<<<\n\n\n"); +} + +void Felugyelet() +{ + printf("MODE: Online Supervision\n"); + + // Allocation (let's suppose size contains some value discovered at runtime, + // e.g. obtained from some external source) + + Eszkozok = malloc(0 * sizeof(Eszkoz)); + + + if (mysql_query(conn, "SELECT * FROM geplog") == 0) + { + res = mysql_store_result(conn); + + //int num_fields = mysql_num_fields(res); + printf("SQl query resulted in %d rows.\n\n", mysql_num_rows(res)); + int x; + while ((row = mysql_fetch_row(res))) + { + x = GetEszkozIndex(atoi(row[2]), atoi(row[1])); - printf("\n-------------------------------------------------------\n"); - printf("=Dryers:\n"); - printf("-------------------------------------------------------\n"); - for (i = 0; i < EszkozokSzama; i++) + if (x == -1) { - if (Eszkozok[i].Tipus == 0) - EszkozKiiro(Eszkozok[i]); + EszkozTombNoveles(1); + x = EszkozokSzama - 1; + Eszkozok[x].Emelet = atoi(row[2]); + Eszkozok[x].Tipus = atoi(row[1]); } + + if (atoi(row[3]) == 0)//Inakt�v + Eszkozok[x].OsszPihenes += atoi(row[4]); + else if (atoi(row[3]) == 1)//Akt�v + Eszkozok[x].OsszMukodes += atoi(row[4]); + else //N/ + Eszkozok[x].OsszNincsadat += atoi(row[4]); + + //int n; + //// Print all columns + //for (n = 0; n < num_fields; n++) + //{ + // // Make sure row[i] is valid! + // if (row[n] != NULL) + // printf("%s ", row[n]); + // else + // printf("NULL"); + //} + //printf("\n"); } - printf("\n >>>>>>>>>>> SCROLL TO THE TOP TO SEE THE REPORT! <<<<<<<<<<<\n\n\n"); + // DON'T FORGET TO CLEAN RESULT AFTER YOU DON'T NEED IT + // ANYMORE + if (res != NULL) + mysql_free_result(res); + + StatisztikaKeszitesKiiras(); //printf("\n"); //SELECT * FROM licenszek WHERE LicID = ? @@ -535,7 +540,7 @@ char *szambuff3; char *szambuff4; char *szambuff5; char *szambuff6; -void EnumString(struct string s) +void EnumString(struct string s, char OnlineMode /*0: Offline, M�s: Online*/) { int Emelet = -99999; int szamhossz; @@ -655,20 +660,42 @@ void EnumString(struct string s) if (logolj) { - l.Emelet = Emelet; - l.Hossz = logdelay; + if (OnlineMode) + { + l.Emelet = Emelet; + l.Hossz = logdelay; - delay(30); + delay(30); - printf("Creating row: %d %d %d %d -> ", l.Tipus, l.Emelet, l.Statusz, l.Hossz); - if (SqlInsert(l) == 0) - printf("Succeeded.\n"); + printf("Creating row: %d %d %d %d -> ", l.Tipus, l.Emelet, l.Statusz, l.Hossz); + if (SqlInsert(l) == 0) + printf("Succeeded.\n"); + else + printf("Failed.\n"); + } else - printf("Failed.\n"); + { + //printf_s("FSZMTEST\n"); + x = GetEszkozIndex(Emelet, l.Tipus); + if (x == -1) + { + EszkozTombNoveles(1); + x = EszkozokSzama - 1; + + Eszkozok[x].Emelet = Emelet; + Eszkozok[x].Tipus = l.Tipus; + } + + if (l.Statusz == 0)//Inakt�v + Eszkozok[x].OsszPihenes += 5 * 60; + else if (l.Statusz == 1)//Akt�v + Eszkozok[x].OsszMukodes += 5 * 60; + else //N/ + Eszkozok[x].OsszNincsadat += 5 * 60; + } } } - //free(szambuff); } @@ -699,7 +726,7 @@ void EgyLogKeszito() //x.len = 10000; xEgyLog.len = utf8_to_latin9(xEgyLog.ptr, sEgyLog.ptr, sEgyLog.len); printf("EgyLogKeszito() 2\n"); - EnumString(xEgyLog); + EnumString(xEgyLog, 1); //printf("%s\n", xEgyLog.ptr); //free(sEgyLog.ptr); @@ -785,11 +812,32 @@ int strend(const char *s, const char *t) return 0; // t was longer than s } +int GetHossz(char *p, int h) +{ + int i = 0; + for (; i < h; ++i) + { + if (p[i] == 0) + return i; + } + + return -1; +} + void OfflineMod() { - printf("MODE: Offline\n"); + FILE *f; + long fsize, fsizeelozo = 0; + char *fajltart = malloc(10); + char *olvasandofile = malloc(10); + + printf("MODE: Offline Analytics\n"); printf("\nCreating logs from '.\\offline\\*.html' files:\n\n"); + Eszkozok = malloc(0 * sizeof(Eszkoz)); + //init_string(&sEgyLog); + init_string(&xEgyLog); + DIR *dir; struct dirent *ent; if ((dir = opendir("offline")) != NULL) @@ -800,14 +848,49 @@ void OfflineMod() if (strend(ent->d_name, ".html")) { printf("FILE: '%s'\n", ent->d_name); + + olvasandofile = realloc(olvasandofile, 9 + ent->d_namlen); + strcpy(olvasandofile, "offline\\"); + strcat(olvasandofile, ent->d_name); + + f = fopen(olvasandofile, "rb"); + fseek(f, 0, SEEK_END); + fsize = ftell(f) + 1;//A f�jl k�dol�s�t�l f�gg�en lehet, hogy egy karaktert k�t byte reprezent�l + fseek(f, 0, SEEK_SET); //same as rewind(f); + + if(fsize > fsizeelozo) + fajltart = realloc(fajltart, fsize + 1); + fsizeelozo = fsize; + + delay(10); + fread(fajltart, fsize, 1, f); + fclose(f); + //sEgyLog.len = GetHossz(sEgyLog.ptr, sEgyLog.len); + fajltart[fsize - 1] = 0; + + xEgyLog.len = utf8_to_latin9(xEgyLog.ptr, fajltart, fsize); + + + EnumString(xEgyLog, 0); + + //sEgyLog.len = 0;//K�l�nben a k�vetkez� WebRequest ehhez (az el�z�h�z) �rn� hozz� az eredm�nyt + //free(sEgyLog.ptr); + //init_string(&sEgyLog); } //ent->d_name; } closedir(dir); + free(olvasandofile); + free(fajltart); + + //printf("XXXXXXX\n"); + StatisztikaKeszitesKiiras(); + //printf("YYYYY\n"); + } else { @@ -824,7 +907,7 @@ int main() { int mod = 0; - printf("Select mode:\n\n1: Offline - read '.\\offline\\*.html' files to create a local log. Every file is logged with 5min duration. After creating the log, the software shows the calculated supervision data immediately.\n\n2: Online Logging - Get HTTP Request from mosogep.sch.bme.hu/index.php and log into online database until the terminal is closed.\n\n3: Online Supervision - Calculate supervision data from online database.\n\nOther: Exit\n"); + printf("Select mode:\n\n1: Offline Analytics - read '.\\offline\\*.html' files to create a local log. Every file is logged as 5min duration. After creating the log, the software shows the calculated supervision data immediately.\n\n2: Online Logging - Get HTTP Request from mosogep.sch.bme.hu/index.php and log into online database until the terminal is closed.\n\n3: Online Supervision - Calculate supervision data from online database.\n\nOther: Exit\n"); scanf_s("%d", &mod); if (mod == 2 || mod == 3) diff --git a/Prog1Hazi.vcxproj b/Prog1Hazi.vcxproj index f0fe3a927d15099909cb72f0f0d57f47c13573d9..68421a2580818f2c30b4546f661babf18f6623cd 100644 --- a/Prog1Hazi.vcxproj +++ b/Prog1Hazi.vcxproj @@ -92,7 +92,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>$(ProjectDir)3rdparty\mysql-connector-c-6.1.11-win32\include;$(ProjectDir)3rdparty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> @@ -125,7 +125,7 @@ <Optimization>Disabled</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>$(ProjectDir)3rdparty\mysql-connector-c-6.1.11-win32\include;$(ProjectDir)3rdparty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> diff --git a/Release/Prog1HaziKliens.exe b/Release/Prog1HaziKliens.exe index 0af7e133d0f226faea478474289071601c642417..8eab90f2c744c17951e6f60a262b4858eb170bef 100644 Binary files a/Release/Prog1HaziKliens.exe and b/Release/Prog1HaziKliens.exe differ diff --git a/Release/Prog1HaziKliens.iobj b/Release/Prog1HaziKliens.iobj index 4c93130539ae1424d98b9473d5081e116c99938d..ef190150d1c305e9eaa00730318ea57f952c104d 100644 Binary files a/Release/Prog1HaziKliens.iobj and b/Release/Prog1HaziKliens.iobj differ diff --git a/Release/Prog1HaziKliens.ipdb b/Release/Prog1HaziKliens.ipdb index a1c22b48df9a40852afadedb3a16fd58667572f6..848145a7bcbbd400ab01e23169bd1963065d62ba 100644 Binary files a/Release/Prog1HaziKliens.ipdb and b/Release/Prog1HaziKliens.ipdb differ diff --git a/Release/Prog1HaziKliens.tlog/CL.command.1.tlog b/Release/Prog1HaziKliens.tlog/CL.command.1.tlog index b86d23597fb7c9d32fc97356284a16b1524e5842..2f95dc4561635e92cbf4568eaa010780ee35e301 100644 Binary files a/Release/Prog1HaziKliens.tlog/CL.command.1.tlog and b/Release/Prog1HaziKliens.tlog/CL.command.1.tlog differ diff --git a/Release/Prog1HaziKliens.tlog/CL.read.1.tlog b/Release/Prog1HaziKliens.tlog/CL.read.1.tlog index f48ea2c9deb2b0b4f342b2fa2af8b8f9a41dc90e..8ebf05d484143b0bf19c368c1085bcac26843abc 100644 Binary files a/Release/Prog1HaziKliens.tlog/CL.read.1.tlog and b/Release/Prog1HaziKliens.tlog/CL.read.1.tlog differ diff --git a/Release/Prog1HaziKliens.tlog/link.write.1.tlog b/Release/Prog1HaziKliens.tlog/link.write.1.tlog index 53b41c7ee8da7c44202f4c182a082e1cba8912fb..af42422abfb020a9f17c8087483d04336699c7b1 100644 Binary files a/Release/Prog1HaziKliens.tlog/link.write.1.tlog and b/Release/Prog1HaziKliens.tlog/link.write.1.tlog differ diff --git a/Release/offline/!Mosogep.sch.html b/Release/offline/!Mosogep.sch.html new file mode 100644 index 0000000000000000000000000000000000000000..d1770219059543a9a50b18209685cffa81632434 --- /dev/null +++ b/Release/offline/!Mosogep.sch.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<html class="gr__mosogep_sch_bme_hu"><head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> + <script async="" src="Mos%C3%B3g%C3%A9p.sch_elemei/analytics.js"></script><script src="Mos%C3%B3g%C3%A9p.sch_elemei/jQuery.js"></script> + <script src="Mos%C3%B3g%C3%A9p.sch_elemei/bootstrap.js"></script> + <script src="Mos%C3%B3g%C3%A9p.sch_elemei/main.js"></script> + <link rel="stylesheet" href="Mos%C3%B3g%C3%A9p.sch_elemei/bootstrap.css"> + <link rel="stylesheet" href="Mos%C3%B3g%C3%A9p.sch_elemei/bootstrap-theme.css"> + <link rel="stylesheet" href="Mos%C3%B3g%C3%A9p.sch_elemei/main.css"> + <title>Mosógép.sch</title> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/png" href="http://mosogep.sch.bme.hu/img/logo.png"> + </head> + <body data-gr-c-s-loaded="true"> + <script> + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', 'UA-62326239-1', 'auto'); + ga('send', 'pageview'); + + </script> + <div class="all"> + <div class="full container-fluid"> + <!--Fejléc--> + <div class="row"> + <div class="col-xs-12"> + <div class="head"> + <div class="logo"> + <img src="Mos%C3%B3g%C3%A9p.sch_elemei/sem_logo.png" alt="sem logó" height="50"> + </div> + <h1 class="pull-right">Mosógép.sch</h1> + </div> + </div> + </div> + <!--Szintek--> + <div class="row"><div class="col-xs-12 col-sm-6" id="f3"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">3. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Foglalt!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div><div class="col-xs-12 col-sm-6" id="f5"><div class="panel panel-info"><div class="panel-heading"><h4 class="panel-title">5. szint</h4></div><div class="panel-body"><span class="green-text"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Mosógép: Szabad!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div></div><div class="row"><div class="col-xs-12 col-sm-6" id="f6"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">6. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Nincs információ!</span><br><span></span><br></div></div></div><div class="col-xs-12 col-sm-6" id="f7"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">7. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Foglalt!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div></div><div class="row"><div class="col-xs-12 col-sm-6" id="f9"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">9. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Foglalt!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div><div class="col-xs-12 col-sm-6" id="f10"><div class="panel panel-success"><div class="panel-heading"><h4 class="panel-title">10. szint</h4></div><div class="panel-body"><span class="green-text"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Mosógép: Szabad!</span><br><span></span><br></div></div></div></div><div class="row"><div class="col-xs-12 col-sm-6" id="f11"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">11. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Foglalt!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div><div class="col-xs-12 col-sm-6" id="f13"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">13. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Foglalt!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Foglalt!</span></div></div></div></div><div class="row"><div class="col-xs-12 col-sm-6" id="f15"><div class="panel panel-success"><div class="panel-heading"><h4 class="panel-title">15. szint</h4></div><div class="panel-body"><span class="green-text"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Mosógép: Szabad!</span><br><span class="green-text"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Szárító: Szabad!</span></div></div></div><div class="col-xs-12 col-sm-6" id="f16"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">16. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Nincs információ!</span><br><span></span><br></div></div></div></div><div class="row"><div class="col-xs-12 col-sm-6" id="f17"><div class="panel panel-danger"><div class="panel-heading"><h4 class="panel-title">17. szint</h4></div><div class="panel-body"><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Mosógép: Nincs információ!</span><br><span class="red-text"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Szárító: Nincs információ!<br>Túl régen érkezett adat az eszköztől!</span></div></div></div></div> <!--Lábléc--> + <div class="row"> + <div class="col-xs-12"> + <div class="foot"> + <p> + Ha úgy látod, hogy hosszú ideig (több mint 5 perc) nem a valóságot írja az oldal, akkor írj a mosogep@sch címre<br> + Mosógép.sch by SEM<br> + Hosted by KSZK<br> + (Design and programming by SaintS 2015) + </p> + </div> + </div> + </div> + </div> + </div> + + +</body></html> \ No newline at end of file diff --git a/Release/offline/a.html b/Release/offline/a.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Release/offline/bbbbbbbb.html b/Release/offline/bbbbbbbb.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Release/offline/c.html b/Release/offline/c.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Release/offline/ddddddddddd.html b/Release/offline/ddddddddddd.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Release/offline/e.html b/Release/offline/e.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Release/offline/test.txt b/Release/offline/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391