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,96 @@
|
|
|
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
|
+
switch (parseInt(data.model.heater_status)) {
|
|
12
|
+
case 2:
|
|
13
|
+
$('#heatericon').removeClass('glyphicon-fire');
|
|
14
|
+
$('#heaterbutton').removeClass('active');
|
|
15
|
+
break;
|
|
16
|
+
|
|
17
|
+
case 1:
|
|
18
|
+
$('#heatericon').addClass('glyphicon-fire');
|
|
19
|
+
$('#heaterbutton').addClass('active');
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
switch (parseInt(data.model.stirrer_status)) {
|
|
24
|
+
case 2:
|
|
25
|
+
$('#stirrericon').removeClass('glyphicon-refresh');
|
|
26
|
+
$('#stirrerbutton').removeClass('active');
|
|
27
|
+
break;
|
|
28
|
+
|
|
29
|
+
case 1:
|
|
30
|
+
$('#stirrericon').addClass('glyphicon-refresh');
|
|
31
|
+
$('#stirrerbutton').addClass('active');
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
if (!$('#temperature_setpoint_input').hasClass("dontupdate")) {
|
|
37
|
+
$('#temperature_setpoint_input').val(data.model.temperature_setpoint);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!$('#rotation_setpoint_input').hasClass("dontupdate")) {
|
|
41
|
+
$('#rotation_setpoint_input').val(data.model.rotation_setpoint);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
exports.toggleHeater = function toggleHeater() {
|
|
53
|
+
if ($('#heaterbutton').hasClass('active')) {
|
|
54
|
+
localeventbus.emit("ui.command", {
|
|
55
|
+
"command": "stop_heater"
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
localeventbus.emit("ui.command", {
|
|
59
|
+
"command": "start_heater"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
exports.toggleStirrer = function toggleStirrer() {
|
|
66
|
+
if ($('#stirrerbutton').hasClass('active')) {
|
|
67
|
+
localeventbus.emit("ui.command", {
|
|
68
|
+
"command": "stop_stirrer"
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
localeventbus.emit("ui.command", {
|
|
72
|
+
"command": "start_stirrer"
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
exports.setTemperatureSetpoint = function setTemperatureSetpoint(val) {
|
|
79
|
+
|
|
80
|
+
localeventbus.emit("ui.command", {
|
|
81
|
+
"command": "set_temperature_setpoint",
|
|
82
|
+
"value": parseFloat(val)
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
exports.setRotationSetpoint = function setRotationSetpoint(val) {
|
|
88
|
+
|
|
89
|
+
localeventbus.emit("ui.command", {
|
|
90
|
+
"command": "set_rotation_setpoint",
|
|
91
|
+
"value": parseFloat(val)
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
})(typeof exports == 'undefined' ? this['ui'] = {} : exports);
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
(function (exports) {
|
|
2
|
+
|
|
3
|
+
var device_model = {
|
|
4
|
+
|
|
5
|
+
weight: '0.000[0]g',
|
|
6
|
+
autoprint: '0',
|
|
7
|
+
power: '1'
|
|
8
|
+
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.init = function (eventbus) {
|
|
12
|
+
|
|
13
|
+
if (typeof String.prototype.startsWith != 'function') {
|
|
14
|
+
String.prototype.startsWith = function (str) {
|
|
15
|
+
return this.indexOf(str) == 0;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
eventbus.on("device.initialized", function () {
|
|
20
|
+
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
eventbus.on("device.command", function (data) {
|
|
24
|
+
|
|
25
|
+
if (data.command == "power") {
|
|
26
|
+
|
|
27
|
+
eventbus.emit("serial.immediatecommand", "Q");
|
|
28
|
+
|
|
29
|
+
device_model.power = '' + data.value;
|
|
30
|
+
|
|
31
|
+
eventbus.emit('ui.update', {
|
|
32
|
+
"component": "all",
|
|
33
|
+
"model": device_model
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (data.command == "calibration") {
|
|
39
|
+
|
|
40
|
+
eventbus.emit("serial.immediatecommand", "CAL");
|
|
41
|
+
|
|
42
|
+
eventbus.emit('ui.update', {
|
|
43
|
+
"component": "all",
|
|
44
|
+
"model": device_model
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (data.command == "tare") {
|
|
50
|
+
|
|
51
|
+
eventbus.emit("serial.immediatecommand", "T");
|
|
52
|
+
|
|
53
|
+
eventbus.emit('ui.update', {
|
|
54
|
+
"component": "all",
|
|
55
|
+
"model": device_model
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (data.command == "print") {
|
|
61
|
+
|
|
62
|
+
eventbus.emit("serial.command", "D05");
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (data.command == "autoprint") {
|
|
67
|
+
|
|
68
|
+
if (data.value == "1") {
|
|
69
|
+
|
|
70
|
+
eventbus.emit("serial.immediatecommand", "D06");
|
|
71
|
+
|
|
72
|
+
device_model.autoprint = '1';
|
|
73
|
+
|
|
74
|
+
eventbus.emit('ui.update', {
|
|
75
|
+
"component": "all",
|
|
76
|
+
"model": device_model
|
|
77
|
+
});
|
|
78
|
+
} else {
|
|
79
|
+
eventbus.emit("serial.immediatecommand", "D09");
|
|
80
|
+
|
|
81
|
+
device_model.autoprint = '0';
|
|
82
|
+
|
|
83
|
+
eventbus.emit('ui.update', {
|
|
84
|
+
"component": "all",
|
|
85
|
+
"model": device_model
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (data.command == "reset") {
|
|
93
|
+
|
|
94
|
+
eventbus.emit("serial.immediatecommand", "R");
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
eventbus.on("device.reply", function (lastmessage, data) {
|
|
104
|
+
|
|
105
|
+
eventbus.emit('device.assumeconnected');
|
|
106
|
+
|
|
107
|
+
if (lastmessage.startsWith('heartbeat')) {
|
|
108
|
+
device_model.weight = data;
|
|
109
|
+
device_model.power = '1';
|
|
110
|
+
|
|
111
|
+
eventbus.emit('ui.update', {
|
|
112
|
+
"component": "all",
|
|
113
|
+
"model": device_model
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
eventbus.emit('device.snapshot', device_model);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
if (lastmessage.startsWith('D')) {
|
|
121
|
+
device_model.weight = data;
|
|
122
|
+
device_model.power = '1';
|
|
123
|
+
|
|
124
|
+
eventbus.emit('ui.update', {
|
|
125
|
+
"component": "all",
|
|
126
|
+
"model": device_model
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
eventbus.emit('device.snapshot', device_model);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
})(typeof exports == 'undefined' ? this['device'] = {} : exports);
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
(function (exports) {
|
|
2
|
+
|
|
3
|
+
var device_model_simulation = {
|
|
4
|
+
|
|
5
|
+
weight: "0.166[0]g",
|
|
6
|
+
autoprint: "0",
|
|
7
|
+
power: "1"
|
|
8
|
+
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function pad(num, size) {
|
|
12
|
+
var s = num + "";
|
|
13
|
+
while (s.length < size) s = "0" + s;
|
|
14
|
+
return s;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.init = function (eventbus) {
|
|
21
|
+
|
|
22
|
+
setInterval(function () {
|
|
23
|
+
|
|
24
|
+
if (device_model_simulation.power == "1") {
|
|
25
|
+
|
|
26
|
+
if (device_model_simulation.autoprint == "1") {
|
|
27
|
+
|
|
28
|
+
eventbus.emit("device.reply", "heartbeat", device_model_simulation.weight);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}, 3000);
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
eventbus.emit("serial.simulation");
|
|
37
|
+
eventbus.emit("serial.portopened");
|
|
38
|
+
|
|
39
|
+
if (typeof String.prototype.startsWith != 'function') {
|
|
40
|
+
String.prototype.startsWith = function (str) {
|
|
41
|
+
return this.indexOf(str) == 0;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
eventbus.on("serial.command", function (data) {
|
|
47
|
+
|
|
48
|
+
if (data.startsWith('D05')) {
|
|
49
|
+
|
|
50
|
+
w = Math.floor((Math.random() * 100) + 1)
|
|
51
|
+
|
|
52
|
+
// device_model_simulation.weight="0."+pad(w, 3)+"[0]g";
|
|
53
|
+
|
|
54
|
+
device_model_simulation.weight = "0.166[0]g";
|
|
55
|
+
|
|
56
|
+
eventbus.emit("device.reply", "heartbeat", device_model_simulation.weight);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
eventbus.on("serial.immediatecommand", function (data) {
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
if (data.startsWith('T')) {
|
|
66
|
+
|
|
67
|
+
device_model_simulation.weight = "0.000[0]g";
|
|
68
|
+
|
|
69
|
+
eventbus.emit("device.reply", "heartbeat", device_model_simulation.weight);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (data.startsWith('R')) {
|
|
73
|
+
|
|
74
|
+
device_model_simulation.weight = "0.000[0]g";
|
|
75
|
+
|
|
76
|
+
eventbus.emit("device.reply", "heartbeat", device_model_simulation.weight);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
if (data.startsWith('C')) {
|
|
81
|
+
|
|
82
|
+
device_model_simulation.weight = "0.000[0]g";
|
|
83
|
+
|
|
84
|
+
eventbus.emit("device.reply", "heartbeat", device_model_simulation.weight);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (data.startsWith('D06')) {
|
|
88
|
+
|
|
89
|
+
if (device_model_simulation.power == "1") {
|
|
90
|
+
|
|
91
|
+
device_model_simulation.autoprint = "1";
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
if (data.startsWith('D09')) {
|
|
98
|
+
|
|
99
|
+
if (device_model_simulation.power == "1") {
|
|
100
|
+
|
|
101
|
+
device_model_simulation.autoprint = "0";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (data.startsWith('Q')) {
|
|
106
|
+
if (device_model_simulation.power == "1") {
|
|
107
|
+
device_model_simulation.power = "0";
|
|
108
|
+
}
|
|
109
|
+
if (device_model_simulation.power == "0") {
|
|
110
|
+
device_model_simulation.power = "1";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
})(typeof exports == 'undefined' ? this['simulator'] = {} : exports);
|
|
@@ -0,0 +1,121 @@
|
|
|
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("iDisplay").innerHTML = data.model.weight;
|
|
20
|
+
|
|
21
|
+
switch (parseInt(data.model.autoprint)) {
|
|
22
|
+
case 0:
|
|
23
|
+
$('#autoprinticon').removeClass('icon-stop');
|
|
24
|
+
$('#autoprinticon').addClass('icon-play');
|
|
25
|
+
$('#autoprintbutton').removeClass('active');
|
|
26
|
+
break;
|
|
27
|
+
case 1:
|
|
28
|
+
$('#autoprinticon').removeClass('icon-play');
|
|
29
|
+
$('#autoprinticon').addClass('icon-stop');
|
|
30
|
+
$('#autoprintbutton').addClass('active');
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
switch (parseInt(data.model.power)) {
|
|
37
|
+
|
|
38
|
+
case 0:
|
|
39
|
+
$('#powericon').removeClass('icon-stop');
|
|
40
|
+
$('#powericon').addClass('icon-play');
|
|
41
|
+
$('#powerbutton').removeClass('active');
|
|
42
|
+
break;
|
|
43
|
+
case 1:
|
|
44
|
+
$('#powericon').removeClass('icon-play');
|
|
45
|
+
$('#powericon').addClass('icon-stop');
|
|
46
|
+
$('#powerbutton').addClass('active');
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// code for the calibaration thing i.e the calibration function is called
|
|
55
|
+
exports.calibration = function calibration() {
|
|
56
|
+
localeventbus.emit("ui.command", {
|
|
57
|
+
"command": "calibration"
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// code for changing the power status either on/off
|
|
62
|
+
exports.togglepower = function togglepower() {
|
|
63
|
+
|
|
64
|
+
var data = "";
|
|
65
|
+
|
|
66
|
+
if ($('#powerbutton').hasClass('active')) {
|
|
67
|
+
data = "0";
|
|
68
|
+
} else {
|
|
69
|
+
data = "1";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
localeventbus.emit("ui.command", {
|
|
73
|
+
"command": "power",
|
|
74
|
+
"value": data
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// code for changing to the tare button i.e tare function is called
|
|
80
|
+
exports.tare = function tare() {
|
|
81
|
+
localeventbus.emit("ui.command", {
|
|
82
|
+
"command": "tare"
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// code for changing to the print function i.e print function is called
|
|
88
|
+
exports.print = function print() {
|
|
89
|
+
|
|
90
|
+
localeventbus.emit("ui.command", {
|
|
91
|
+
"command": "print"
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// code for changing to the reset function i.e reset function is called
|
|
96
|
+
exports.reset = function reset() {
|
|
97
|
+
localeventbus.emit("ui.command", {
|
|
98
|
+
"command": "reset"
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// code for changing to the autoprint function i.e autoprint function is called
|
|
104
|
+
|
|
105
|
+
exports.toggleautoprint = function toggleautoprint() {
|
|
106
|
+
var data = "0";
|
|
107
|
+
if ($('#autoprintbutton').hasClass('active')) {
|
|
108
|
+
data = "0";
|
|
109
|
+
} else {
|
|
110
|
+
data = "1";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
localeventbus.emit("ui.command", {
|
|
114
|
+
"command": "autoprint",
|
|
115
|
+
"value": data
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
})(typeof exports == 'undefined' ? this['ui'] = {} : exports);
|