diff --git a/.gitignore b/.gitignore index e270190393b5267811c1f2820f20eb598d89841d..bf364174b57f4e0f702b9777a846846a99115286 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +tmp/* +bin/smartdata/importers/ +bin/workflow/tutorial/ cassandra certmanager log diff --git a/api/login.html b/api/login.html new file mode 100644 index 0000000000000000000000000000000000000000..6ce006cc69dfd937f9a806ccb41ce8fdad48699a --- /dev/null +++ b/api/login.html @@ -0,0 +1,22 @@ +<html> +<head> +<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> +<script> + function doLogin() { + console.log("iniciando..."); + let xhr = new XMLHttpRequest(); + xhr.open("POST", "https://iot.lisha.ufsc.br/grafana/login"); + xhr.setRequestHeader("Accept", "application/json"); + xhr.setRequestHeader("Content-Type", "application/json"); + xhr.onload = () => { document.getElementById("grafana_frame").src = "https://iot.lisha.ufsc.br:3000/"; } + let data = '{ "user": "aqtech@lisha.ufsc.br", "password": "jP#55Mh@" } '; + xhr.send(data); + console.log('Enviou...'); + } +</script> +</head> +<body onload="doLogin();"> +<iframe src="" style="min-width:800px; min-height:900px;" id="grafana_frame" name="grafana_frame"></iframe> +</iframe> +</body> +</html> diff --git a/bin/smartdata/Backend.php b/bin/smartdata/Backend.php index fc4ab6e946da86b571788153558aacafd22ce2ff..346ea494bc4c7b56472706fea0cbac26741adee8 100644 --- a/bin/smartdata/Backend.php +++ b/bin/smartdata/Backend.php @@ -2869,7 +2869,7 @@ class Backend_V1_1 extends Backend_Common $sd = new StaticSmartData($series->unit,$value,$error,$conf,$x,$y,$z,$ts,$d); $smartdata[$pos++] = $sd; $sd_count += 1; - } + } $point_number += 1; $ts = $ts + $per; if ($sd_count > Config::config()::POINTS_LIMIT) { @@ -3165,7 +3165,7 @@ class Backend_V1_1 extends Backend_Common $x = $entry->get('x'); $y = $entry->get('y'); $z = $entry->get('z'); - $time = (string)$column['timestamp']->value(); //bigint + $time = (string)$column['timestamp']->value(); //bigint if (! $series->contains_point($x, $y, $z)) { continue; } @@ -3229,7 +3229,7 @@ class Backend_V1_1 extends Backend_Common break; } } - } else { + } else { if (!$downSample || ($point_number % $step) == 0) { $time = (string)$column['timestamp']->value(); //bigint if ($is_digital) { diff --git a/bin/smartdata/SmartAPI.php b/bin/smartdata/SmartAPI.php index 53ed90d760fc3f31bf5f75e6bc059192dbe016ea..939fc0ddaa850e4973354a24cf67736335a95fbc 100644 --- a/bin/smartdata/SmartAPI.php +++ b/bin/smartdata/SmartAPI.php @@ -71,7 +71,7 @@ namespace SmartData\SmartAPI else $return = $backend->query($series,$aggregator,$options); break; - case SmartData::MOBILE_VERSION: + case SmartData::MOBILE_VERSION: $return = $backend->track($series,$aggregator,$options); break; default: @@ -113,7 +113,6 @@ namespace SmartData\SmartAPI } else { throw new BadRequestException("Error parsing content request: invalid series"); } - return $return; } @@ -170,7 +169,7 @@ namespace SmartData\SmartAPI } } else { throw new InsertionFailedException("SmartData type not identified..."); - } + } } else { // Is Binary $backend = new Backend(); diff --git a/bin/smartdata/management/command.php b/bin/smartdata/management/command.php index 90647a5efb81587ba918036989e80a9f419b3e78..3d42f92dc38342c9ef644fe8929db88b7858aeb9 100755 --- a/bin/smartdata/management/command.php +++ b/bin/smartdata/management/command.php @@ -13,20 +13,21 @@ require_once './Console/CommandLine/Command.php'; final class Config { + const MYSQL_SEVERNAME = 'localhost'; const MYSQL_PORT = 3306; const MYSQL_DBNAME = 'smartdata_v1'; - const MYSQL_USERNAME = 'username'; - const MYSQL_PASSWORD = 'password'; + const MYSQL_USERNAME = 'smartdata'; + const MYSQL_PASSWORD = '1ol31lSh010mG9wY'; - const MYSQL_SUPERUSER = 'username'; - const MYSQL_SUPERPASS = 'password'; + const MYSQL_SUPERUSER = 'smartdata_admin'; + const MYSQL_SUPERPASS = '6wg5fbB5fOIuzXcW'; const CASSANDRA_SERVERNAME = 'localhost'; const CASSANDRA_PORT = 9042; - const CASSANDRA_SUPERUSER = 'username'; - const CASSANDRA_SUPERPASS = 'password'; + const CASSANDRA_SUPERUSER = 'cassandra'; + const CASSANDRA_SUPERPASS = 'Pdx#W63$B7-pNv'; //'K#dM841-lwx'; const CASSANDRA_KEYSPACE = 'smartdata_v1'; const CASSANDRA_MAX_ROW_SIZE = 2000000000; //%(Two billion - The max is 2^31) diff --git a/bin/workflow/tutorial/in1 b/bin/workflow/tutorial/in1 deleted file mode 100755 index 975f5204e0dfbb6762255d2747c2c00642883715..0000000000000000000000000000000000000000 --- a/bin/workflow/tutorial/in1 +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python3 -import sys -import json - -if __name__ == '__main__': - #+++++++++++++++++ DO NOT CHANGE THIS LINE +++++++++++++++++ - smartdata = json.loads(sys.argv[1]) # Load json from argv[1] - #+++++++++++++++++ DO NOT CHANGE THIS LINE +++++++++++++++++ - - - with open('in1.out', 'w') as file: - file.write(sys.argv[1]+"\n") - file.write(json.dumps(smartdata)+"\n") - # ... - # DO SOMETHING HERE - smartdata['smartdata']['value'] = 2*smartdata['smartdata']['value'] # example - # ... - with open('in1.out', 'a') as file: - file.write(json.dumps(smartdata)) - - - #+++++++++++++++++ DO NOT CHANGE THIS LINE +++++++++++++++++ - print(json.dumps(smartdata)) # Send smartdata back to PHP - #+++++++++++++++++ DO NOT CHANGE THIS LINE +++++++++++++++++ diff --git a/lib/workflow/python/s_curve.py b/lib/workflow/python/s_curve.py index 4d0f533d4673dcdf1de082fc29aeb93897ccaed6..41aaf23f81e3bc38734d3b4b85077e38b068073e 100644 --- a/lib/workflow/python/s_curve.py +++ b/lib/workflow/python/s_curve.py @@ -6,7 +6,7 @@ class S_Curve: self.max_speed = max_speed self.cut_out = cut_out self.max_power = max_power - self.slope = slope + self.slope = slope def s_curve_sigmoid(self, x): if(x <= self.cut_out) :