dial_a_device_node 0.0.153

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +674 -0
  5. data/README.md +94 -0
  6. data/Rakefile +1 -0
  7. data/app/assets/images/denver_summit.jpg +0 -0
  8. data/app/assets/images/eppendorf_innova_42.jpg +0 -0
  9. data/app/assets/images/heidolph.jpg +0 -0
  10. data/app/assets/images/ika_ret_control.jpg +0 -0
  11. data/app/assets/images/kern.jpg +0 -0
  12. data/app/assets/images/knf_rc900.jpg +0 -0
  13. data/app/assets/images/knf_sc920.jpg +0 -0
  14. data/app/assets/images/knf_simdos_02.jpg +0 -0
  15. data/app/assets/images/pce_balance.jpg +0 -0
  16. data/app/assets/images/purebeaglebone.jpg +0 -0
  17. data/app/assets/images/weathercape.jpg +0 -0
  18. data/app/assets/javascripts/dial_a_device_node/consolelogger.js +176 -0
  19. data/app/assets/javascripts/dial_a_device_node/deviceconnection.js +225 -0
  20. data/app/assets/javascripts/dial_a_device_node/devices/denver_summit.js +153 -0
  21. data/app/assets/javascripts/dial_a_device_node/devices/denver_summit_SIM.js +111 -0
  22. data/app/assets/javascripts/dial_a_device_node/devices/denver_summit_UI.js +121 -0
  23. data/app/assets/javascripts/dial_a_device_node/devices/eppendorf_innova_42.js +128 -0
  24. data/app/assets/javascripts/dial_a_device_node/devices/eppendorf_innova_42_SIM.js +66 -0
  25. data/app/assets/javascripts/dial_a_device_node/devices/eppendorf_innova_42_UI.js +46 -0
  26. data/app/assets/javascripts/dial_a_device_node/devices/heidolph.js +62 -0
  27. data/app/assets/javascripts/dial_a_device_node/devices/heidolph_SIM.js +24 -0
  28. data/app/assets/javascripts/dial_a_device_node/devices/heidolph_UI.js +17 -0
  29. data/app/assets/javascripts/dial_a_device_node/devices/ika_ret_control.js +192 -0
  30. data/app/assets/javascripts/dial_a_device_node/devices/ika_ret_control_SIM.js +233 -0
  31. data/app/assets/javascripts/dial_a_device_node/devices/ika_ret_control_UI.js +96 -0
  32. data/app/assets/javascripts/dial_a_device_node/devices/kern.js +137 -0
  33. data/app/assets/javascripts/dial_a_device_node/devices/kern_SIM.js +118 -0
  34. data/app/assets/javascripts/dial_a_device_node/devices/kern_UI.js +121 -0
  35. data/app/assets/javascripts/dial_a_device_node/devices/knf_rc900.js +289 -0
  36. data/app/assets/javascripts/dial_a_device_node/devices/knf_rc900_SIM.js +188 -0
  37. data/app/assets/javascripts/dial_a_device_node/devices/knf_rc900_UI.js +179 -0
  38. data/app/assets/javascripts/dial_a_device_node/devices/knf_sc920.js +309 -0
  39. data/app/assets/javascripts/dial_a_device_node/devices/knf_sc920_SIM.js +298 -0
  40. data/app/assets/javascripts/dial_a_device_node/devices/knf_sc920_UI.js +441 -0
  41. data/app/assets/javascripts/dial_a_device_node/devices/knf_simdos_02.js +283 -0
  42. data/app/assets/javascripts/dial_a_device_node/devices/knf_simdos_02_SIM.js +130 -0
  43. data/app/assets/javascripts/dial_a_device_node/devices/knf_simdos_02_UI.js +188 -0
  44. data/app/assets/javascripts/dial_a_device_node/devices/legacy_vnc.js +106 -0
  45. data/app/assets/javascripts/dial_a_device_node/devices/legacy_vnc_SIM.js +32 -0
  46. data/app/assets/javascripts/dial_a_device_node/devices/legacy_vnc_UI.js +26 -0
  47. data/app/assets/javascripts/dial_a_device_node/devices/pce_balance.js +111 -0
  48. data/app/assets/javascripts/dial_a_device_node/devices/pce_balance_SIM.js +80 -0
  49. data/app/assets/javascripts/dial_a_device_node/devices/pce_balance_UI.js +69 -0
  50. data/app/assets/javascripts/dial_a_device_node/devices/purebeaglebone.js +286 -0
  51. data/app/assets/javascripts/dial_a_device_node/devices/purebeaglebone_SIM.js +13 -0
  52. data/app/assets/javascripts/dial_a_device_node/devices/purebeaglebone_UI.js +256 -0
  53. data/app/assets/javascripts/dial_a_device_node/devices/weathercape.js +75 -0
  54. data/app/assets/javascripts/dial_a_device_node/devices/weathercape_SIM.js +33 -0
  55. data/app/assets/javascripts/dial_a_device_node/devices/weathercape_UI.js +42 -0
  56. data/app/assets/javascripts/dial_a_device_node/folderwatcher.js +43 -0
  57. data/app/assets/javascripts/dial_a_device_node/helper/WebSocket-Node-wrapper.js +36 -0
  58. data/app/assets/javascripts/dial_a_device_node/helper/XMLHttpRequest.js +579 -0
  59. data/app/assets/javascripts/dial_a_device_node/helper/agent.js +125 -0
  60. data/app/assets/javascripts/dial_a_device_node/helper/ajax.js +300 -0
  61. data/app/assets/javascripts/dial_a_device_node/helper/type.js +10 -0
  62. data/app/assets/javascripts/dial_a_device_node/php/comport.php +49 -0
  63. data/app/assets/javascripts/dial_a_device_node/php/php_serial.class.php +622 -0
  64. data/app/assets/javascripts/dial_a_device_node/systemstatus.js +124 -0
  65. data/app/assets/javascripts/dial_a_device_node/webconnection.js +197 -0
  66. data/app/assets/javascripts/dial_a_device_node/websocket_rails/abstract_connection.js.coffee +45 -0
  67. data/app/assets/javascripts/dial_a_device_node/websocket_rails/channel.js.coffee +70 -0
  68. data/app/assets/javascripts/dial_a_device_node/websocket_rails/event.js.coffee +42 -0
  69. data/app/assets/javascripts/dial_a_device_node/websocket_rails/http_connection.js.coffee +89 -0
  70. data/app/assets/javascripts/dial_a_device_node/websocket_rails/websocket_connection.js.coffee +37 -0
  71. data/app/assets/javascripts/dial_a_device_node/websocket_rails/websocket_rails.js.coffee +164 -0
  72. data/app/views/devices/ui/_denver_summit.html.erb +52 -0
  73. data/app/views/devices/ui/_eppendorf_innova_42.html.erb +72 -0
  74. data/app/views/devices/ui/_heidolph.html.erb +54 -0
  75. data/app/views/devices/ui/_ika_ret_control.html.erb +81 -0
  76. data/app/views/devices/ui/_kern.html.erb +52 -0
  77. data/app/views/devices/ui/_knf_rc900.html.erb +143 -0
  78. data/app/views/devices/ui/_knf_sc920.html.erb +194 -0
  79. data/app/views/devices/ui/_knf_simdos_02.html.erb +98 -0
  80. data/app/views/devices/ui/_pce_balance.html.erb +37 -0
  81. data/app/views/devices/ui/_purebeaglebone.html.erb +137 -0
  82. data/app/views/devices/ui/_weathercape.html.erb +313 -0
  83. data/beaglebonechip.js +57 -0
  84. data/dial-a-device-web.js +84 -0
  85. data/dial_a_device_node.gemspec +23 -0
  86. data/dial_a_device_node.js +419 -0
  87. data/lib/dial_a_device_node.rb +6 -0
  88. data/lib/dial_a_device_node/version.rb +3 -0
  89. data/package.json +35 -0
  90. data/start.js +40 -0
  91. metadata +161 -0
@@ -0,0 +1,13 @@
1
+ (function (exports) {
2
+
3
+ var device_model_simulation = {
4
+
5
+
6
+ };
7
+
8
+ exports.init = function (eventbus) {
9
+
10
+
11
+ };
12
+
13
+ })(typeof exports == 'undefined' ? this['simulator'] = {} : exports);
@@ -0,0 +1,256 @@
1
+ (function (exports) {
2
+
3
+ var localeventbus;
4
+ var data;
5
+
6
+ exports.init = function (eventbus) {
7
+
8
+ localeventbus = eventbus;
9
+
10
+ if (typeof String.prototype.startsWith != 'function') {
11
+ String.prototype.startsWith = function (str) {
12
+ return this.indexOf(str) == 0;
13
+ };
14
+ }
15
+
16
+
17
+ eventbus.on("ui.update", function (data) {
18
+
19
+ switch (parseInt(data.model.usrled0)) {
20
+ case 0:
21
+ $('#usrled0button').removeClass('active');
22
+ break;
23
+ case 1:
24
+ $('#usrled0button').addClass('active');
25
+ break;
26
+ }
27
+
28
+ switch (parseInt(data.model.usrled1)) {
29
+ case 0:
30
+ $('#usrled1button').removeClass('active');
31
+ break;
32
+ case 1:
33
+ $('#usrled1button').addClass('active');
34
+ break;
35
+ }
36
+
37
+ switch (parseInt(data.model.usrled2)) {
38
+ case 0:
39
+ $('#usrled2button').removeClass('active');
40
+ break;
41
+ case 1:
42
+ $('#usrled2button').addClass('active');
43
+ break;
44
+ }
45
+
46
+ switch (parseInt(data.model.usrled3)) {
47
+ case 0:
48
+ $('#usrled3button').removeClass('active');
49
+ break;
50
+ case 1:
51
+ $('#usrled3button').addClass('active');
52
+ break;
53
+ }
54
+
55
+ if (data.model.lastserialmessage != "") {
56
+
57
+ $('#serialconsole').val($('#serialconsole').val() + data.model.lastserialmessage + "\n");
58
+
59
+ }
60
+
61
+ if (data.model.serialstatus == true) {
62
+
63
+ document.getElementById('serialconnect').style.display = "none";
64
+ document.getElementById('serialdisconnect').style.display = "";
65
+
66
+ document.getElementById("serialstatus").innerHTML = "(connected to "+data.model.serialport + " - "+data.model.serialbaud+" baud)";
67
+
68
+ } else {
69
+
70
+ document.getElementById('serialconnect').style.display = "";
71
+ document.getElementById('serialdisconnect').style.display = "none";
72
+
73
+ document.getElementById("serialstatus").innerHTML = "(closed)";
74
+ }
75
+
76
+ if (data.model.customui != "") {
77
+
78
+ document.getElementById('customui').innerHTML = data.model.customui;
79
+ }
80
+
81
+ });
82
+
83
+ };
84
+
85
+ exports.serialopen = function serialopen() {
86
+ localeventbus.emit("ui.command", {
87
+ "command": "serialopen"
88
+ });
89
+ };
90
+
91
+ exports.serialclose = function serialclose() {
92
+ localeventbus.emit("ui.command", {
93
+ "command": "serialclose"
94
+ });
95
+ };
96
+
97
+ exports.serialsetbaud = function serialsetbaud() {
98
+ localeventbus.emit("ui.command", {
99
+ "command": "serialsetbaud",
100
+ "value": $('#serialbaud').val()
101
+ });
102
+ };
103
+
104
+ exports.serialsetport = function serialsetport() {
105
+ localeventbus.emit("ui.command", {
106
+ "command": "serialsetport",
107
+ "value": $('#serialport').val()
108
+ });
109
+ };
110
+
111
+ exports.serialsetdatabit = function serialsetdatabit() {
112
+ localeventbus.emit("ui.command", {
113
+ "command": "serialsetdatabit",
114
+ "value": parseInt($('#serialdatabit').val())
115
+ });
116
+ };
117
+
118
+ exports.serialsetparity = function serialsetparity() {
119
+ localeventbus.emit("ui.command", {
120
+ "command": "serialsetparity",
121
+ "value": $('#serialparity').val()
122
+ });
123
+ };
124
+
125
+ exports.serialsetstopbit = function serialsetstopbit() {
126
+ localeventbus.emit("ui.command", {
127
+ "command": "serialsetstopbit",
128
+ "value": parseInt($('#serialstopbit').val())
129
+ });
130
+ };
131
+
132
+ exports.serialsetlinebreak = function serialsetlinebreak() {
133
+ localeventbus.emit("ui.command", {
134
+ "command": "serialsetlinebreak",
135
+ "value": $('#seriallinebreak').val()
136
+ });
137
+ };
138
+
139
+ exports.serialsetprefix = function serialsetprefix() {
140
+ localeventbus.emit("ui.command", {
141
+ "command": "serialsetprefix",
142
+ "value": $('#serialprefix').val()
143
+ });
144
+ };
145
+
146
+ exports.serialsetsuffix = function serialsetsuffix() {
147
+ localeventbus.emit("ui.command", {
148
+ "command": "serialsetsuffix",
149
+ "value": $('#serialsuffix').val()
150
+ });
151
+ };
152
+
153
+ exports.sendraw = function sendraw() {
154
+
155
+ var data = "";
156
+
157
+ data = $('#sendraw').val();
158
+
159
+ localeventbus.emit("ui.command", {
160
+ "command": "sendraw",
161
+ "value": data
162
+ });
163
+
164
+ };
165
+
166
+ exports.sendserial = function sendserial() {
167
+
168
+ var data = "";
169
+
170
+ data = $('#sendserial').val();
171
+
172
+ localeventbus.emit("ui.command", {
173
+ "command": "sendserial",
174
+ "value": data
175
+ });
176
+
177
+ };
178
+
179
+ exports.toggleusrled0 = function toggleusrled0() {
180
+
181
+ var data = "";
182
+
183
+ if ($('#usrled0button').hasClass('active')) {
184
+ data = "0";
185
+ } else {
186
+ data = "1";
187
+ }
188
+
189
+ localeventbus.emit("ui.command", {
190
+ "command": "setled",
191
+ "led": "USR0",
192
+ "value": data
193
+ });
194
+
195
+ };
196
+
197
+ exports.toggleusrled1 = function toggleusrled1() {
198
+
199
+ var data = "";
200
+
201
+ if ($('#usrled1button').hasClass('active')) {
202
+ data = "0";
203
+ } else {
204
+ data = "1";
205
+ }
206
+
207
+ localeventbus.emit("ui.command", {
208
+ "command": "setled",
209
+ "led": "USR1",
210
+ "value": data
211
+ });
212
+ };
213
+
214
+ exports.toggleusrled2 = function toggleusrled2() {
215
+
216
+ var data = "";
217
+
218
+ if ($('#usrled2button').hasClass('active')) {
219
+ data = "0";
220
+ } else {
221
+ data = "1";
222
+ }
223
+
224
+ localeventbus.emit("ui.command", {
225
+ "command": "setled",
226
+ "led": "USR2",
227
+ "value": data
228
+ });
229
+ };
230
+
231
+ exports.toggleusrled3 = function toggleusrled3() {
232
+
233
+ var data = "";
234
+
235
+ if ($('#usrled3button').hasClass('active')) {
236
+ data = "0";
237
+ } else {
238
+ data = "1";
239
+ }
240
+
241
+ localeventbus.emit("ui.command", {
242
+ "command": "setled",
243
+ "led": "USR3",
244
+ "value": data
245
+ });
246
+ };
247
+
248
+ exports.retrieveCustomUI = function retrieveCustomUI() {
249
+
250
+ localeventbus.emit("ui.command", {
251
+ "command": "retrievecustomui"
252
+ });
253
+ };
254
+
255
+
256
+ })(typeof exports == 'undefined' ? this['ui'] = {} : exports);
@@ -0,0 +1,75 @@
1
+ (function (exports) {
2
+
3
+ var device_model = {
4
+
5
+ temperature: 0,
6
+ pressure: 0,
7
+ humidity: 0,
8
+ lux: 0
9
+
10
+ };
11
+
12
+ exports.init = function (eventbus) {
13
+
14
+ if (typeof String.prototype.startsWith != 'function') {
15
+ String.prototype.startsWith = function (str) {
16
+ return this.indexOf(str) == 0;
17
+ };
18
+ }
19
+
20
+ eventbus.on("device.initialized", function () {
21
+
22
+ });
23
+
24
+
25
+ eventbus.on("device.heartbeat", function () {
26
+
27
+ var b = require('bonescript');
28
+
29
+ eventbus.emit('device.assumeconnected');
30
+
31
+ var pressureInput = '/sys/bus/i2c/devices/1-0077/pressure0_input';
32
+ var humidityInput = '/sys/bus/i2c/devices/1-0040/humidity1_input';
33
+ var temperatureInput0= '/sys/bus/i2c/devices/1-0077/temp0_input';
34
+ var luxInput= '/sys/bus/i2c/devices/1-0039/lux1_input';
35
+ var temperatureInput1= '/sys/bus/i2c/devices/1-0040/temp1_input';
36
+
37
+ function printPressure(x) {
38
+ device_model.pressure = x.data/100;
39
+
40
+ b.readTextFile(humidityInput, printHumidity);
41
+ }
42
+
43
+ function printHumidity(x){
44
+ device_model.humidity = x.data/1000;
45
+ b.readTextFile(temperatureInput0, printTemperature);
46
+ }
47
+
48
+ function printTemperature(x){
49
+ device_model.temperature = x.data/10;
50
+ b.readTextFile(luxInput, printLux);
51
+ }
52
+
53
+ function printLux(x){
54
+ device_model.lux = x.data*1;
55
+
56
+ eventbus.emit('ui.update', {
57
+ "component": "all",
58
+ "model": device_model
59
+ });
60
+
61
+ eventbus.emit('device.snapshot', device_model);
62
+
63
+ }
64
+
65
+ b.readTextFile(pressureInput, printPressure);
66
+
67
+ });
68
+
69
+
70
+ eventbus.emit("device.initialized");
71
+
72
+ };
73
+
74
+
75
+ })(typeof exports == 'undefined' ? this['device'] = {} : exports);
@@ -0,0 +1,33 @@
1
+ (function (exports) {
2
+
3
+ var device_model_simulation = {
4
+
5
+ temperature: 25.3,
6
+ pressure: 1013.3,
7
+ humidity: 50,
8
+ lux: 200
9
+
10
+ };
11
+
12
+ exports.init = function (eventbus) {
13
+
14
+
15
+ setInterval(function () {
16
+
17
+ eventbus.emit('ui.update', {
18
+ "component": "all",
19
+ "model": device_model_simulation
20
+ });
21
+
22
+ eventbus.emit('device.snapshot', device_model_simulation);
23
+
24
+
25
+ }, 1000);
26
+
27
+ eventbus.emit("serial.simulation");
28
+ eventbus.emit("serial.portopened");
29
+
30
+
31
+ };
32
+
33
+ })(typeof exports == 'undefined' ? this['simulator'] = {} : exports);
@@ -0,0 +1,42 @@
1
+ (function (exports) {
2
+
3
+ var localeventbus;
4
+ var data;
5
+
6
+ exports.init = function (eventbus) {
7
+
8
+ localeventbus = eventbus;
9
+
10
+ if (typeof String.prototype.startsWith != 'function') {
11
+ String.prototype.startsWith = function (str) {
12
+ return this.indexOf(str) == 0;
13
+ };
14
+ }
15
+
16
+
17
+ eventbus.on("ui.update", function (data) {
18
+
19
+ document.getElementById("temperature").innerHTML = data.model.temperature;
20
+
21
+ setTemperature(data.model.temperature);
22
+
23
+ document.getElementById("pressure").innerHTML = data.model.pressure;
24
+
25
+ setPressure(data.model.pressure);
26
+
27
+ document.getElementById("humidity").innerHTML = data.model.humidity;
28
+
29
+ setHumidity(data.model.humidity);
30
+
31
+ document.getElementById("lux").innerHTML = data.model.lux;
32
+
33
+ setLux(data.model.lux);
34
+
35
+ });
36
+
37
+ };
38
+
39
+
40
+
41
+
42
+ })(typeof exports == 'undefined' ? this['ui'] = {} : exports);
@@ -0,0 +1,43 @@
1
+ (function (exports) {
2
+
3
+
4
+ var fwroot;
5
+
6
+ var watcher;
7
+
8
+
9
+ exports.init = function (eventbus) {
10
+ localeventbus = eventbus;
11
+
12
+ localeventbus.on("folderwatcher.set_root", function (data) {
13
+
14
+ fwroot = data;
15
+
16
+ });
17
+
18
+
19
+
20
+ localeventbus.on("folderwatcher.start", function (data) {
21
+
22
+ var fs = require('fs');
23
+
24
+ fs.exists(fwroot, function(exists) {
25
+ if (exists) {
26
+
27
+ require('chokidar').watch(fwroot, {ignored: /[\/\\]\./, persistent: true}).on('all', function(event, path) {
28
+
29
+ localeventbus.emit("folderwatcher.event", event, path);
30
+
31
+ });
32
+
33
+ }
34
+ });
35
+
36
+
37
+
38
+ });
39
+
40
+
41
+ };
42
+
43
+ })(typeof exports == 'undefined' ? this['folderwatcher'] = {} : exports);