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,289 @@
1
+ (function (exports) {
2
+
3
+ var device_model = {
4
+
5
+ time: 0,
6
+
7
+ temperature: 0,
8
+ temperature_setpoint: 0,
9
+ heater_status: 0,
10
+
11
+ coolant_valve: 0,
12
+
13
+ rotation: 0,
14
+ rotation_setpoint: 0,
15
+ rotation_status: 0,
16
+
17
+ lift: 0,
18
+ lift_setpoint: 0,
19
+ lift_status: 0,
20
+
21
+ status: ""
22
+
23
+ };
24
+
25
+ exports.init = function (eventbus) {
26
+
27
+ if (typeof String.prototype.startsWith != 'function') {
28
+ String.prototype.startsWith = function (str) {
29
+ return this.indexOf(str) == 0;
30
+ };
31
+ }
32
+
33
+ eventbus.on("device.initialized", function () {
34
+
35
+ });
36
+
37
+
38
+ eventbus.on("device.heartbeat", function () {
39
+
40
+ localeventbus.emit("device.command", {
41
+ "command": "get_params1"
42
+ });
43
+
44
+ localeventbus.emit("device.command", {
45
+ "command": "get_params2"
46
+ });
47
+
48
+ localeventbus.emit("device.command", {
49
+ "command": "get_params3"
50
+ });
51
+
52
+ eventbus.emit('ui.update', {
53
+ "component": "all",
54
+ "model": device_model
55
+ });
56
+
57
+ eventbus.emit('device.snapshot', device_model);
58
+
59
+ });
60
+
61
+
62
+ eventbus.on("device.command", function (data) {
63
+
64
+ if (data.command == "get_params1") {
65
+
66
+ eventbus.emit("serial.command", "pP");
67
+
68
+ }
69
+
70
+ if (data.command == "get_params2") {
71
+
72
+ eventbus.emit("serial.command", "pC");
73
+
74
+ }
75
+
76
+ if (data.command == "get_params3") {
77
+
78
+ eventbus.emit("serial.command", "pI");
79
+
80
+ }
81
+
82
+
83
+
84
+ if (data.command == "set_temperature_setpoint") {
85
+
86
+ eventbus.emit("serial.immediatecommand", "cRt "+data.value);
87
+
88
+ }
89
+
90
+ if (data.command == "set_rotation_setpoint") {
91
+
92
+ eventbus.emit("serial.immediatecommand", "cRr "+data.value);
93
+
94
+ }
95
+
96
+ if (data.command == "set_lift_setpoint") {
97
+
98
+ eventbus.emit("serial.immediatecommand", "cRq "+data.value);
99
+
100
+ }
101
+
102
+ if (data.command == "set_shaking_time") {
103
+
104
+ device_model.shaking_time = data.value;
105
+
106
+ eventbus.emit("serial.immediatecommand", "cRe "+data.value);
107
+
108
+ }
109
+
110
+
111
+ if (data.command == "start_heater") {
112
+
113
+ eventbus.emit("serial.immediatecommand", "dRh1");
114
+
115
+ }
116
+
117
+ if (data.command == "stop_heater") {
118
+
119
+ eventbus.emit("serial.immediatecommand", "dRh2");
120
+
121
+ }
122
+
123
+ if (data.command == "start_rotation") {
124
+
125
+ eventbus.emit("serial.immediatecommand", "dRr1");
126
+
127
+ }
128
+
129
+ if (data.command == "stop_rotation") {
130
+
131
+ eventbus.emit("serial.immediatecommand", "dRr2");
132
+
133
+ }
134
+
135
+ if (data.command == "set_coolant_on") {
136
+
137
+ device_model.coolant_valve = 1;
138
+
139
+ eventbus.emit("serial.immediatecommand", "dW1");
140
+
141
+ }
142
+
143
+ if (data.command == "set_coolant_off") {
144
+
145
+ device_model.coolant_valve = 0;
146
+
147
+ eventbus.emit("serial.immediatecommand", "dW0");
148
+
149
+ }
150
+
151
+ if (data.command == "start_lift_up") {
152
+
153
+ device_model.lift_status = 1;
154
+
155
+ eventbus.emit("serial.immediatecommand", "dHu1");
156
+
157
+ }
158
+
159
+ if (data.command == "stop_lift_up") {
160
+
161
+ device_model.lift_status = 0;
162
+
163
+ eventbus.emit("serial.immediatecommand", "dHu0");
164
+
165
+ }
166
+
167
+ if (data.command == "start_lift_down") {
168
+
169
+ device_model.lift_status = -1;
170
+
171
+ eventbus.emit("serial.immediatecommand", "dHd1");
172
+
173
+ }
174
+
175
+ if (data.command == "stop_lift_down") {
176
+
177
+ device_model.lift_status = 0;
178
+
179
+ eventbus.emit("serial.immediatecommand", "dHd0");
180
+
181
+ }
182
+
183
+ if (data.command == "stop") {
184
+
185
+ eventbus.emit("serial.immediatecommand", "dE");
186
+
187
+ }
188
+
189
+ });
190
+
191
+
192
+ eventbus.on("device.reply", function (lastmessage, data) {
193
+
194
+ if (lastmessage.startsWith('pP')) {
195
+
196
+
197
+ function pad(s,z){s=""+s;return s.length<z?pad("0"+s,z):s}
198
+
199
+ device_model.time = parseFloat(data.split(";")[0]);
200
+ device_model.temperature = parseFloat(data.split(";")[1]);
201
+ device_model.rotation_setpoint = parseFloat(data.split(";")[2]);
202
+ device_model.lift = parseFloat(data.split(";")[3]);
203
+
204
+ device_model.status = data.split(";")[4];
205
+
206
+ s = parseInt(data.split(";")[4][2], 16);
207
+
208
+ if (s == 0) {
209
+
210
+ device_model.heater_status = 0;
211
+ device_model.rotation_status = 0;
212
+
213
+ device_model.rotation = 0;
214
+
215
+ }
216
+
217
+ if (s == 4) {
218
+
219
+ device_model.heater_status = 0;
220
+ device_model.rotation_status = 1;
221
+
222
+ device_model.rotation = device_model.rotation_setpoint;
223
+
224
+ }
225
+
226
+ if (s == 8) {
227
+
228
+ device_model.heater_status = 1;
229
+ device_model.rotation_status = 0;
230
+
231
+ device_model.rotation = 0;
232
+
233
+ }
234
+
235
+ if (s == 14) {
236
+
237
+ device_model.heater_status = 1;
238
+ device_model.rotation_status = 1;
239
+
240
+ device_model.rotation = device_model.rotation_setpoint;
241
+
242
+ }
243
+
244
+ l1 = parseInt(data.split(";")[4][0], 16);
245
+ l2 = parseInt(data.split(";")[4][1], 16);
246
+
247
+ device_model.lift_status = 0;
248
+
249
+
250
+ if (l1 == 1) {
251
+
252
+ device_model.lift_status = -1;
253
+
254
+ }
255
+
256
+ if (l2 == 9) {
257
+
258
+ device_model.lift_status = 1;
259
+
260
+ }
261
+
262
+ eventbus.emit('device.assumeconnected');
263
+
264
+ }
265
+
266
+ if (lastmessage.startsWith('pC')) {
267
+
268
+ device_model.temperature_setpoint = parseFloat(data.split(";")[0]);
269
+ device_model.shaking_time = parseFloat(data.split(";")[1]);
270
+ device_model.lift_setpoint = parseFloat(data.split(";")[2]);
271
+
272
+
273
+ }
274
+
275
+ if (lastmessage.startsWith('pI')) {
276
+
277
+
278
+ }
279
+
280
+
281
+ });
282
+
283
+
284
+ eventbus.emit("device.initialized");
285
+
286
+ };
287
+
288
+
289
+ })(typeof exports == 'undefined' ? this['device'] = {} : exports);
@@ -0,0 +1,188 @@
1
+ (function (exports) {
2
+
3
+ var device_model_simulation = {
4
+
5
+ time: 0,
6
+
7
+ temperature: 0,
8
+ temperature_setpoint: 0,
9
+ heater_status: 0,
10
+
11
+ coolant_valve: 0,
12
+
13
+ rotation: 0,
14
+ rotation_setpoint: 0,
15
+ rotation_status: 0,
16
+
17
+ lift: 0,
18
+ lift_setpoint: 0,
19
+ lift_status: 0
20
+
21
+ };
22
+
23
+ exports.init = function (eventbus) {
24
+
25
+ setInterval(function () {
26
+
27
+
28
+ if (device_model_simulation.heater_status == 1) {
29
+
30
+ device_model_simulation.temperature = device_model_simulation.temperature_setpoint;
31
+
32
+ } else {
33
+
34
+ device_model_simulation.temperature = 21;
35
+
36
+ }
37
+
38
+
39
+ if (device_model_simulation.rotation_status == 1) {
40
+
41
+ device_model_simulation.rotation = device_model_simulation.rotation_setpoint;
42
+
43
+ time = time + 1;
44
+
45
+ } else {
46
+
47
+ device_model_simulation.rotation = 0;
48
+
49
+ time = 0;
50
+
51
+ }
52
+
53
+ if (device_model_simulation.lift_status == 1) {
54
+
55
+ if (device_model_simulation.lift < 10) {
56
+
57
+ device_model_simulation.lift = device_model_simulation.lift + 1;
58
+
59
+ }
60
+
61
+ } else if (device_model_simulation.lift_status == -1) {
62
+
63
+ if (device_model_simulation.lift > 0) {
64
+
65
+ device_model_simulation.lift = device_model_simulation.lift - 1;
66
+
67
+ }
68
+
69
+ }
70
+
71
+
72
+ eventbus.emit('ui.update', {
73
+ "component": "all",
74
+ "model": device_model_simulation
75
+ });
76
+
77
+ eventbus.emit('device.snapshot', device_model_simulation);
78
+
79
+
80
+ }, 1000);
81
+
82
+ eventbus.emit("serial.simulation");
83
+ eventbus.emit("serial.portopened");
84
+
85
+
86
+ eventbus.on("device.command", function (data) {
87
+
88
+ if (data.command == "set_temperature_setpoint") {
89
+
90
+ device_model_simulation.temperature_setpoint = data.value;
91
+
92
+ }
93
+
94
+ if (data.command == "set_rotation_setpoint") {
95
+
96
+ device_model_simulation.rotation_setpoint = data.value;
97
+
98
+ }
99
+
100
+ if (data.command == "set_lift_setpoint") {
101
+
102
+ device_model_simulation.lift_setpoint = data.value;
103
+
104
+ }
105
+
106
+ if (data.command == "set_shaking_time") {
107
+
108
+ device_model_simulation.shaking_time = data.value;
109
+
110
+ }
111
+
112
+
113
+ if (data.command == "start_heater") {
114
+
115
+ device_model_simulation.heater_status = 1;
116
+
117
+ }
118
+
119
+ if (data.command == "stop_heater") {
120
+
121
+ device_model_simulation.heater_status = 0;
122
+
123
+ }
124
+
125
+ if (data.command == "start_rotation") {
126
+
127
+ device_model_simulation.rotation_status = 1;
128
+
129
+ }
130
+
131
+ if (data.command == "stop_rotation") {
132
+
133
+ device_model_simulation.rotation_status = 0;
134
+
135
+ }
136
+
137
+ if (data.command == "set_coolant_on") {
138
+
139
+ device_model_simulation.coolant_valve = 1;
140
+
141
+ }
142
+
143
+ if (data.command == "set_coolant_off") {
144
+
145
+ device_model_simulation.coolant_valve = 0;
146
+
147
+ }
148
+
149
+ if (data.command == "start_lift_up") {
150
+
151
+ device_model_simulation.lift_status = 1;
152
+
153
+ }
154
+
155
+ if (data.command == "stop_lift_up") {
156
+
157
+ device_model_simulation.lift_status = 0;
158
+
159
+ }
160
+
161
+ if (data.command == "start_lift_down") {
162
+
163
+ device_model_simulation.lift_status = -1;
164
+
165
+ }
166
+
167
+ if (data.command == "stop_lift_down") {
168
+
169
+ device_model_simulation.lift_status = 0;
170
+
171
+ }
172
+
173
+ if (data.command == "stop") {
174
+
175
+ device_model_simulation.heater_status = 0;
176
+
177
+ device_model_simulation.rotation_status = 0;
178
+
179
+ device_model_simulation.lift_status = 0;
180
+
181
+ }
182
+
183
+
184
+ });
185
+
186
+ };
187
+
188
+ })(typeof exports == 'undefined' ? this['simulator'] = {} : exports);