-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcommands.js
54 lines (51 loc) · 1.33 KB
/
commands.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const fs = require('fs');
module.exports = [
{
command: 'load <file>',
action: function(args, callback) {
try {
const name = args.file;
const gcode = fs.readFileSync(name, 'utf8');
const context = {};
callback(null, 'command', 'gcode:load', name, gcode, context, function(err, state) {
if (err) {
return;
}
// console.log(state);
});
} catch (err) {
callback(err);
}
}
},
{
command: 'unload',
action: function(args, callback) {
callback(null, 'command', 'gcode:unload');
}
},
{
command: 'start',
action: function(args, callback) {
callback(null, 'command', 'gcode:start');
}
},
{
command: 'stop',
action: function(args, callback) {
callback(null, 'command', 'gcode:stop');
}
},
{
command: 'pause',
action: function(args, callback) {
callback(null, 'command', 'gcode:pause');
}
},
{
command: 'resume',
action: function(args, callback) {
callback(null, 'command', 'gcode:resume');
}
}
];