diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index 2f1fdd6056..3c23368847 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -59,6 +59,9 @@
"tab9": {
"message": "CLI"
},
+ "tab10": {
+ "message": "Logging"
+ },
"serialPortOpened": {
"message": "Serial port successfully opened with ID: $1"
diff --git a/main.html b/main.html
index cb3980945a..5d857a29ae 100644
--- a/main.html
+++ b/main.html
@@ -16,6 +16,7 @@
+
@@ -44,6 +45,7 @@
+
@@ -105,6 +107,7 @@
+
diff --git a/main.js b/main.js
index 64b88e807e..37af0a8a42 100644
--- a/main.js
+++ b/main.js
@@ -102,6 +102,9 @@ $(document).ready(function() {
case 'tab_cli':
tab_initialize_cli();
break;
+ case 'tab_logging':
+ tab_initialize_logging();
+ break;
}
});
}
diff --git a/tabs/logging.css b/tabs/logging.css
new file mode 100644
index 0000000000..6e3a0a82dd
--- /dev/null
+++ b/tabs/logging.css
@@ -0,0 +1,32 @@
+.tab-logging {
+}
+ .tab-logging .note {
+ padding: 5px;
+ border: 1px dashed silver;
+ }
+ .tab-logging .properties {
+ margin-top: 10px;
+ }
+ .tab-logging .buttons {
+ margin-top: 10px;
+ }
+ .tab-logging .buttons a {
+ display: block;
+ float: left;
+
+ margin-right: 10px;
+
+ height: 28px;
+ line-height: 28px;
+
+ padding: 0 15px 0 15px;
+
+ text-align: center;
+ font-weight: bold;
+
+ border: 1px solid silver;
+ background-color: #ececec;
+ }
+ .tab-logging .buttons a:hover {
+ background-color: #dedcdc;
+ }
diff --git a/tabs/logging.html b/tabs/logging.html
new file mode 100644
index 0000000000..8efe0dec4f
--- /dev/null
+++ b/tabs/logging.html
@@ -0,0 +1,14 @@
+
+
+ Data will be logged in this tab only , leaving this tab will cancel logging and application will return to its normal "configurator" operation.
+ Logged CSV data will respect properties order below, some of the properties will log more then 1 field, in that case please consult documentation or sourcecode
+ to find out the order and amount of fields per property.
+ You are free to select the global update period, data will be written into the log file every 1 second.
+
+
+
+
+
\ No newline at end of file
diff --git a/tabs/logging.js b/tabs/logging.js
new file mode 100644
index 0000000000..8e0fb8d250
--- /dev/null
+++ b/tabs/logging.js
@@ -0,0 +1,83 @@
+function tab_initialize_logging() {
+ ga_tracker.sendAppView('Logging');
+ GUI.active_tab = 'logging';
+
+ $('#content').load("./tabs/logging.html", process_html);
+
+ function process_html() {
+ // translate to user-selected language
+ localize();
+
+ // UI hooks
+ $('a.log_file').click(prepare_file);
+
+ $('a.logging').click(function() {
+ if (fileEntry.isFile) {
+ // TODO:
+ // grab enabled properties
+ // grab refresh rate
+ // start data polling timer
+ // start buffer flushing sequence & timer (keep fileWriter.readyState in mind)
+ }
+ });
+ }
+
+ // IO related methods
+ var fileEntry = null;
+ var fileWriter = null;
+
+ function prepare_file() {
+ // create or load the file
+ chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: 'bf_data_log', accepts: [{extensions: ['csv']}]}, function(entry) {
+ if (!entry) {
+ console.log('No file selected');
+ return;
+ }
+
+ fileEntry = entry;
+
+ // echo/console log path specified
+ chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
+ console.log('Log file path: ' + path);
+ });
+
+ // change file entry from read only to read/write
+ chrome.fileSystem.getWritableEntry(fileEntry, function(fileEntryWritable) {
+ // check if file is writable
+ chrome.fileSystem.isWritableEntry(fileEntryWritable, function(isWritable) {
+ if (isWritable) {
+ fileEntry = fileEntryWritable;
+
+ prepare_writer();
+ } else {
+ console.log('File appears to be read only, sorry.');
+ }
+ });
+ });
+ });
+ }
+
+ function prepare_writer() {
+ fileEntry.createWriter(function(writer) {
+ fileWriter = writer;
+
+ fileWriter.onerror = function(e) {
+ console.error(e);
+ };
+
+ fileWriter.onwriteend = function() {
+ // console.log('Data written');
+ };
+ }, function(e) {
+ console.error(e);
+ });
+ }
+
+ function append_to_file(data) {
+ if (fileWriter.position < fileWriter.length) {
+ fileWriter.seek(fileWriter.length);
+ }
+
+ fileWriter.write(new Blob([data + '\n'], {type: 'text/plain'}));
+ }
+}
\ No newline at end of file