forked from pbardov/node-atol-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
77 lines (64 loc) · 1.64 KB
/
index.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const w = require('./bindings');
const fptr = new w.Fptr10();
console.log(fptr);
fptr.create();
const settings = fptr.getSettings();
console.log('getSettings', settings);
//RS232 connection:
settings.Port = 0; //ComPort communication
settings.ComFile = '/dev/ttyACM0'; //ComPort name
settings.BaudRate = 115200;
//USB connection:
// settings.Port = 1;
console.log('setSettings', fptr.setSettings(settings));
console.log('isOpened', fptr.isOpened());
console.log('open', fptr.open());
console.log('isOpened', fptr.isOpened());
fptr.processJson({type: 'getDeviceStatus'}, (err, result) => {
if (err) {
throw err;
}
console.log('getDeviceStatus', result);
});
console.log('findLastDocument', fptr.findLastDocument());
// try {
// console.log('fnReport', fptr.fnReport(1));
// } catch (e) {
// console.log('error', e.message, 'code', e.code, 'descr', e.description);
// }
// fptr.processJsonAsync({
// type: 'openShift',
//
// operator: {
// name: 'Иванов',
// vatin: '123654789507'
// },
//
// postItems: [
// {
// type: 'text',
// text: 'ОТКРЫТА НОВАЯ СМЕНА',
// alignment: 'center',
// doubleWidth: true
// }
// ]
// }, (err, result) => {
// if (err) {
// throw err;
// }
// console.log('openShift', result);
// });
fptr.processJsonAsync({
type: 'closeShift',
operator: {
name: 'Иванов',
vatin: '123654789507'
}
}, (err, result) => {
if (err) {
throw err;
}
console.log('closeShift', result);
});
console.log('close', fptr.close());
fptr.destroy();