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.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +674 -0
- data/README.md +94 -0
- data/Rakefile +1 -0
- data/app/assets/images/denver_summit.jpg +0 -0
- data/app/assets/images/eppendorf_innova_42.jpg +0 -0
- data/app/assets/images/heidolph.jpg +0 -0
- data/app/assets/images/ika_ret_control.jpg +0 -0
- data/app/assets/images/kern.jpg +0 -0
- data/app/assets/images/knf_rc900.jpg +0 -0
- data/app/assets/images/knf_sc920.jpg +0 -0
- data/app/assets/images/knf_simdos_02.jpg +0 -0
- data/app/assets/images/pce_balance.jpg +0 -0
- data/app/assets/images/purebeaglebone.jpg +0 -0
- data/app/assets/images/weathercape.jpg +0 -0
- data/app/assets/javascripts/dial_a_device_node/consolelogger.js +176 -0
- data/app/assets/javascripts/dial_a_device_node/deviceconnection.js +225 -0
- data/app/assets/javascripts/dial_a_device_node/devices/denver_summit.js +153 -0
- data/app/assets/javascripts/dial_a_device_node/devices/denver_summit_SIM.js +111 -0
- data/app/assets/javascripts/dial_a_device_node/devices/denver_summit_UI.js +121 -0
- data/app/assets/javascripts/dial_a_device_node/devices/eppendorf_innova_42.js +128 -0
- data/app/assets/javascripts/dial_a_device_node/devices/eppendorf_innova_42_SIM.js +66 -0
- data/app/assets/javascripts/dial_a_device_node/devices/eppendorf_innova_42_UI.js +46 -0
- data/app/assets/javascripts/dial_a_device_node/devices/heidolph.js +62 -0
- data/app/assets/javascripts/dial_a_device_node/devices/heidolph_SIM.js +24 -0
- data/app/assets/javascripts/dial_a_device_node/devices/heidolph_UI.js +17 -0
- data/app/assets/javascripts/dial_a_device_node/devices/ika_ret_control.js +192 -0
- data/app/assets/javascripts/dial_a_device_node/devices/ika_ret_control_SIM.js +233 -0
- data/app/assets/javascripts/dial_a_device_node/devices/ika_ret_control_UI.js +96 -0
- data/app/assets/javascripts/dial_a_device_node/devices/kern.js +137 -0
- data/app/assets/javascripts/dial_a_device_node/devices/kern_SIM.js +118 -0
- data/app/assets/javascripts/dial_a_device_node/devices/kern_UI.js +121 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_rc900.js +289 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_rc900_SIM.js +188 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_rc900_UI.js +179 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_sc920.js +309 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_sc920_SIM.js +298 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_sc920_UI.js +441 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_simdos_02.js +283 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_simdos_02_SIM.js +130 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_simdos_02_UI.js +188 -0
- data/app/assets/javascripts/dial_a_device_node/devices/legacy_vnc.js +106 -0
- data/app/assets/javascripts/dial_a_device_node/devices/legacy_vnc_SIM.js +32 -0
- data/app/assets/javascripts/dial_a_device_node/devices/legacy_vnc_UI.js +26 -0
- data/app/assets/javascripts/dial_a_device_node/devices/pce_balance.js +111 -0
- data/app/assets/javascripts/dial_a_device_node/devices/pce_balance_SIM.js +80 -0
- data/app/assets/javascripts/dial_a_device_node/devices/pce_balance_UI.js +69 -0
- data/app/assets/javascripts/dial_a_device_node/devices/purebeaglebone.js +286 -0
- data/app/assets/javascripts/dial_a_device_node/devices/purebeaglebone_SIM.js +13 -0
- data/app/assets/javascripts/dial_a_device_node/devices/purebeaglebone_UI.js +256 -0
- data/app/assets/javascripts/dial_a_device_node/devices/weathercape.js +75 -0
- data/app/assets/javascripts/dial_a_device_node/devices/weathercape_SIM.js +33 -0
- data/app/assets/javascripts/dial_a_device_node/devices/weathercape_UI.js +42 -0
- data/app/assets/javascripts/dial_a_device_node/folderwatcher.js +43 -0
- data/app/assets/javascripts/dial_a_device_node/helper/WebSocket-Node-wrapper.js +36 -0
- data/app/assets/javascripts/dial_a_device_node/helper/XMLHttpRequest.js +579 -0
- data/app/assets/javascripts/dial_a_device_node/helper/agent.js +125 -0
- data/app/assets/javascripts/dial_a_device_node/helper/ajax.js +300 -0
- data/app/assets/javascripts/dial_a_device_node/helper/type.js +10 -0
- data/app/assets/javascripts/dial_a_device_node/php/comport.php +49 -0
- data/app/assets/javascripts/dial_a_device_node/php/php_serial.class.php +622 -0
- data/app/assets/javascripts/dial_a_device_node/systemstatus.js +124 -0
- data/app/assets/javascripts/dial_a_device_node/webconnection.js +197 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/abstract_connection.js.coffee +45 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/channel.js.coffee +70 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/event.js.coffee +42 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/http_connection.js.coffee +89 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/websocket_connection.js.coffee +37 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/websocket_rails.js.coffee +164 -0
- data/app/views/devices/ui/_denver_summit.html.erb +52 -0
- data/app/views/devices/ui/_eppendorf_innova_42.html.erb +72 -0
- data/app/views/devices/ui/_heidolph.html.erb +54 -0
- data/app/views/devices/ui/_ika_ret_control.html.erb +81 -0
- data/app/views/devices/ui/_kern.html.erb +52 -0
- data/app/views/devices/ui/_knf_rc900.html.erb +143 -0
- data/app/views/devices/ui/_knf_sc920.html.erb +194 -0
- data/app/views/devices/ui/_knf_simdos_02.html.erb +98 -0
- data/app/views/devices/ui/_pce_balance.html.erb +37 -0
- data/app/views/devices/ui/_purebeaglebone.html.erb +137 -0
- data/app/views/devices/ui/_weathercape.html.erb +313 -0
- data/beaglebonechip.js +57 -0
- data/dial-a-device-web.js +84 -0
- data/dial_a_device_node.gemspec +23 -0
- data/dial_a_device_node.js +419 -0
- data/lib/dial_a_device_node.rb +6 -0
- data/lib/dial_a_device_node/version.rb +3 -0
- data/package.json +35 -0
- data/start.js +40 -0
- metadata +161 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
(function (exports) {
|
|
2
|
+
|
|
3
|
+
exports.init = function (eventbus) {
|
|
4
|
+
|
|
5
|
+
eventbus.on("ui.update", function (data) {
|
|
6
|
+
|
|
7
|
+
g1.refresh(data.model.temperature);
|
|
8
|
+
|
|
9
|
+
g2.refresh(data.model.rotation);
|
|
10
|
+
|
|
11
|
+
g3.refresh(data.model.lift);
|
|
12
|
+
|
|
13
|
+
switch (parseInt(data.model.heater_status)) {
|
|
14
|
+
case 0:
|
|
15
|
+
$('#heatericon').removeClass('glyphicon-fire');
|
|
16
|
+
$('#heaterbutton').removeClass('active');
|
|
17
|
+
break;
|
|
18
|
+
|
|
19
|
+
case 1:
|
|
20
|
+
$('#heatericon').addClass('glyphicon-fire');
|
|
21
|
+
$('#heaterbutton').addClass('active');
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
switch (parseInt(data.model.rotation_status)) {
|
|
26
|
+
case 0:
|
|
27
|
+
$('#rotationicon').removeClass('glyphicon-refresh');
|
|
28
|
+
$('#rotationbutton').removeClass('active');
|
|
29
|
+
break;
|
|
30
|
+
|
|
31
|
+
case 1:
|
|
32
|
+
$('#rotationicon').addClass('glyphicon-refresh');
|
|
33
|
+
$('#rotationbutton').addClass('active');
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
if (!$('#temperature_setpoint_input').hasClass("dontupdate")) {
|
|
39
|
+
$('#temperature_setpoint_input').val(data.model.temperature_setpoint);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!$('#rotation_setpoint_input').hasClass("dontupdate")) {
|
|
43
|
+
$('#rotation_setpoint_input').val(data.model.rotation_setpoint);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!$('#lift_setpoint_input').hasClass("dontupdate")) {
|
|
47
|
+
$('#lift_setpoint_input').val(data.model.lift_setpoint);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
switch (parseInt(data.model.coolant_valve)) {
|
|
51
|
+
case 0:
|
|
52
|
+
$('#coolanticon').removeClass('glyphicon-star-empty');
|
|
53
|
+
$('#coolanticon').addClass('glyphicon-star');
|
|
54
|
+
$('#coolantbutton').removeClass('active');
|
|
55
|
+
break;
|
|
56
|
+
|
|
57
|
+
case 1:
|
|
58
|
+
$('#coolanticon').removeClass('glyphicon-star');
|
|
59
|
+
$('#coolanticon').addClass('glyphicon-star-empty');
|
|
60
|
+
$('#coolantbutton').addClass('active');
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
exports.toggleHeater = function toggleHeater() {
|
|
73
|
+
if ($('#heaterbutton').hasClass('active')) {
|
|
74
|
+
localeventbus.emit("ui.command", {
|
|
75
|
+
"command": "stop_heater"
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
localeventbus.emit("ui.command", {
|
|
79
|
+
"command": "start_heater"
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
exports.toggleRotation = function toggleRotation() {
|
|
86
|
+
if ($('#rotationbutton').hasClass('active')) {
|
|
87
|
+
localeventbus.emit("ui.command", {
|
|
88
|
+
"command": "stop_rotation"
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
localeventbus.emit("ui.command", {
|
|
92
|
+
"command": "start_rotation"
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.toggleCoolant = function toggleCoolant() {
|
|
99
|
+
if ($('#coolantbutton').hasClass('active')) {
|
|
100
|
+
localeventbus.emit("ui.command", {
|
|
101
|
+
"command": "set_coolant_off"
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
localeventbus.emit("ui.command", {
|
|
105
|
+
"command": "set_coolant_on"
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
exports.Stop = function Stop() {
|
|
112
|
+
|
|
113
|
+
localeventbus.emit("ui.command", {
|
|
114
|
+
"command": "stop"
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
exports.setTemperatureSetpoint = function setTemperatureSetpoint(val) {
|
|
121
|
+
|
|
122
|
+
localeventbus.emit("ui.command", {
|
|
123
|
+
"command": "set_temperature_setpoint",
|
|
124
|
+
"value": parseFloat(val)
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
exports.setRotationSetpoint = function setRotationSetpoint(val) {
|
|
130
|
+
|
|
131
|
+
localeventbus.emit("ui.command", {
|
|
132
|
+
"command": "set_rotation_setpoint",
|
|
133
|
+
"value": parseFloat(val)
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
exports.setLiftSetpoint = function setLiftSetpoint(val) {
|
|
139
|
+
|
|
140
|
+
localeventbus.emit("ui.command", {
|
|
141
|
+
"command": "set_lift_setpoint",
|
|
142
|
+
"value": parseFloat(val)
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
exports.liftUp = function liftUp() {
|
|
148
|
+
|
|
149
|
+
localeventbus.emit("ui.command", {
|
|
150
|
+
"command": "start_lift_up"
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
exports.liftUpStop = function liftUpStop() {
|
|
156
|
+
|
|
157
|
+
localeventbus.emit("ui.command", {
|
|
158
|
+
"command": "stop_lift_up"
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
exports.liftDown = function liftDown() {
|
|
164
|
+
|
|
165
|
+
localeventbus.emit("ui.command", {
|
|
166
|
+
"command": "start_lift_down"
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
exports.liftDownStop = function liftDownStop() {
|
|
172
|
+
|
|
173
|
+
localeventbus.emit("ui.command", {
|
|
174
|
+
"command": "stop_lift_down"
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
})(typeof exports == 'undefined' ? this['ui'] = {} : exports);
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
(function (exports) {
|
|
2
|
+
|
|
3
|
+
var device_model = {
|
|
4
|
+
|
|
5
|
+
runmode: 'n',
|
|
6
|
+
pressure: '0',
|
|
7
|
+
setpoint: '0',
|
|
8
|
+
power: '0',
|
|
9
|
+
ventilation: '0',
|
|
10
|
+
coolant: '0',
|
|
11
|
+
runtime: '0',
|
|
12
|
+
|
|
13
|
+
jashon: [{
|
|
14
|
+
"jso_time": "52",
|
|
15
|
+
"jso_pressure": "20",
|
|
16
|
+
"jso_coolant": "2"
|
|
17
|
+
}, {
|
|
18
|
+
"jso_time": "34",
|
|
19
|
+
"jso_pressure": "54",
|
|
20
|
+
"jso_coolant": "1"
|
|
21
|
+
}, {
|
|
22
|
+
"jso_time": "68",
|
|
23
|
+
"jso_pressure": "44",
|
|
24
|
+
"jso_coolant": "2"
|
|
25
|
+
}, {
|
|
26
|
+
"jso_time": "69",
|
|
27
|
+
"jso_pressure": "89",
|
|
28
|
+
"jso_coolant": "2"
|
|
29
|
+
}, {
|
|
30
|
+
"jso_time": "15",
|
|
31
|
+
"jso_pressure": "89",
|
|
32
|
+
"jso_coolant": "1"
|
|
33
|
+
}, {
|
|
34
|
+
"jso_time": "78",
|
|
35
|
+
"jso_pressure": "55",
|
|
36
|
+
"jso_coolant": "2"
|
|
37
|
+
}, {
|
|
38
|
+
"jso_time": "98",
|
|
39
|
+
"jso_pressure": "21",
|
|
40
|
+
"jso_coolant": "2"
|
|
41
|
+
}, {
|
|
42
|
+
"jso_time": "96",
|
|
43
|
+
"jso_pressure": "85",
|
|
44
|
+
"jso_coolant": "1"
|
|
45
|
+
}, {
|
|
46
|
+
"jso_time": "75",
|
|
47
|
+
"jso_pressure": "18",
|
|
48
|
+
"jso_coolant": "2"
|
|
49
|
+
}, {
|
|
50
|
+
"jso_time": "87",
|
|
51
|
+
"jso_pressure": "10",
|
|
52
|
+
"jso_coolant": "1"
|
|
53
|
+
}, {
|
|
54
|
+
"jso_time": "98",
|
|
55
|
+
"jso_pressure": "25",
|
|
56
|
+
"jso_coolant": "2"
|
|
57
|
+
}, {
|
|
58
|
+
"jso_time": "32",
|
|
59
|
+
"jso_pressure": "19",
|
|
60
|
+
"jso_coolant": "1"
|
|
61
|
+
}],
|
|
62
|
+
|
|
63
|
+
pressureunit: '0'
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
var datacurve = new Array();
|
|
68
|
+
|
|
69
|
+
exports.init = function (eventbus) {
|
|
70
|
+
|
|
71
|
+
if (typeof String.prototype.startsWith != 'function') {
|
|
72
|
+
String.prototype.startsWith = function (str) {
|
|
73
|
+
return this.indexOf(str) == 0;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
eventbus.on("device.initialized", function () {
|
|
78
|
+
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
eventbus.on("device.snapshot", function (param) {
|
|
83
|
+
|
|
84
|
+
if (device_model.runtime == "0.0") {
|
|
85
|
+
if (datacurve.length > 10) {
|
|
86
|
+
datacurve.shift();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var tm = (new Date()).getTime();
|
|
91
|
+
var pr = parseInt(param.pressure);
|
|
92
|
+
|
|
93
|
+
var datapoint = [tm, pr];
|
|
94
|
+
datacurve.push(datapoint);
|
|
95
|
+
|
|
96
|
+
eventbus.emit("ui.refreshdatacurve", datacurve);
|
|
97
|
+
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
eventbus.on("device.heartbeat", function () {
|
|
101
|
+
|
|
102
|
+
eventbus.emit("serial.command", "pP");
|
|
103
|
+
eventbus.emit("serial.command", "gM");
|
|
104
|
+
eventbus.emit("serial.command", "gUp");
|
|
105
|
+
eventbus.emit("serial.command", "gV");
|
|
106
|
+
eventbus.emit("serial.command", "gW");
|
|
107
|
+
|
|
108
|
+
eventbus.emit('ui.update', {
|
|
109
|
+
"component": "all",
|
|
110
|
+
"model": device_model
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
eventbus.emit('device.snapshot', device_model);
|
|
115
|
+
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
eventbus.on("device.command", function (data) {
|
|
121
|
+
|
|
122
|
+
if (data.command == "setrunmode") {
|
|
123
|
+
|
|
124
|
+
eventbus.emit("serial.command", "cM" + data.value)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (data.command == "setstartstop") {
|
|
128
|
+
|
|
129
|
+
eventbus.emit("serial.command", "d" + data.value)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (data.command == "setpressureunit") {
|
|
133
|
+
|
|
134
|
+
eventbus.emit("serial.command", "cUP" + data.value)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (data.command == "setventilation") {
|
|
138
|
+
|
|
139
|
+
eventbus.emit("serial.command", "dV" + data.value)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (data.command == "setcoolant") {
|
|
143
|
+
|
|
144
|
+
eventbus.emit("serial.command", "dW" + data.value)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (data.command == "setpower") {
|
|
148
|
+
|
|
149
|
+
eventbus.emit("serial.command", "cS" + data.value)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (data.command == "setsetpoint") {
|
|
153
|
+
|
|
154
|
+
eventbus.emit("serial.command", "cC" + data.value)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
eventbus.on("device.reply", function (lastmessage, data) {
|
|
161
|
+
|
|
162
|
+
if (lastmessage.startsWith('pP')) {
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
|
|
166
|
+
var re = ("" + data).split(';');
|
|
167
|
+
|
|
168
|
+
device_model.runtime = re[0].trim();
|
|
169
|
+
device_model.pressure = re[1].trim();
|
|
170
|
+
device_model.setpoint = re[2].trim();
|
|
171
|
+
device_model.power = re[3].trim();
|
|
172
|
+
|
|
173
|
+
} catch (e) {
|
|
174
|
+
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
eventbus.emit('device.assumeconnected');
|
|
178
|
+
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (lastmessage.startsWith('gM')) {
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
|
|
185
|
+
var re = ("" + data).split(';');
|
|
186
|
+
|
|
187
|
+
device_model.runmode = re[0].trim();
|
|
188
|
+
|
|
189
|
+
} catch (e) {
|
|
190
|
+
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (lastmessage.startsWith('gUp')) {
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
|
|
198
|
+
var re = ("" + data).split(';');
|
|
199
|
+
|
|
200
|
+
device_model.pressureunit = re[0].trim();
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
} catch (e) {
|
|
204
|
+
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (lastmessage.startsWith('gV')) {
|
|
209
|
+
|
|
210
|
+
try {
|
|
211
|
+
|
|
212
|
+
var re = ("" + data).split(';');
|
|
213
|
+
|
|
214
|
+
device_model.ventilation = re[0].trim();
|
|
215
|
+
|
|
216
|
+
} catch (e) {
|
|
217
|
+
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (lastmessage.startsWith('gW')) {
|
|
222
|
+
|
|
223
|
+
try {
|
|
224
|
+
|
|
225
|
+
var re = ("" + data).split(';');
|
|
226
|
+
|
|
227
|
+
device_model.coolant = re[0].trim();
|
|
228
|
+
|
|
229
|
+
} catch (e) {
|
|
230
|
+
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (lastmessage.startsWith('gFv')) {
|
|
235
|
+
|
|
236
|
+
var re = ("" + data).split(';');
|
|
237
|
+
|
|
238
|
+
if (re.length > 4) {
|
|
239
|
+
|
|
240
|
+
var x = re[0].trim();
|
|
241
|
+
device_model.jashon[x].jso_time = re[1].trim();
|
|
242
|
+
device_model.jashon[x].jso_pressure = re[2].trim();
|
|
243
|
+
device_model.jashon[x].jso_coolant = re[3].trim();
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
} else {
|
|
247
|
+
console.log('wrong reply gFv');
|
|
248
|
+
console.log(lastmessage);
|
|
249
|
+
console.log(data);
|
|
250
|
+
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (lastmessage.startsWith('cFd') || lastmessage.startsWith('cFc') || lastmessage.startsWith('cFs')) {
|
|
257
|
+
|
|
258
|
+
eventbus.emit('device.update.list', device_model);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
eventbus.on("device.update.list", function (device_model) {
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
for (index = 0; index < 12; index++) {
|
|
268
|
+
|
|
269
|
+
localeventbus.emit("device.update.row", index);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
eventbus.on("device.update.row", function (data) {
|
|
274
|
+
|
|
275
|
+
eventbus.emit("serial.command", "gFv" + data)
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
eventbus.on("device.set.function", function (temp_obj, o1, o2, o3) {
|
|
279
|
+
|
|
280
|
+
var main_i = parseInt(temp_obj);
|
|
281
|
+
var main_t = o1;
|
|
282
|
+
var main_p = o2;
|
|
283
|
+
var main_c = o3;
|
|
284
|
+
eventbus.emit("serial.command", "cFs " + main_i + ";" + main_t + ";" + main_p + ";" + main_c + ";");
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
eventbus.on("device.delAll.function", function (temp_obj_2) {
|
|
290
|
+
|
|
291
|
+
eventbus.emit("serial.command", "cFd " + temp_obj_2 + ";");
|
|
292
|
+
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
eventbus.on("device.del1.function", function (temp_obj_3) {
|
|
296
|
+
|
|
297
|
+
eventbus.emit("serial.command", "cFc " + temp_obj_3 + ";");
|
|
298
|
+
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
eventbus.emit("device.initialized");
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
})(typeof exports == 'undefined' ? this['device'] = {} : exports);
|