-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
68 lines (50 loc) · 1.37 KB
/
test.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
'use nodent-promise';
'use nodent-es7'
'use strict'
const Sim = require('./sim')
const serialport = require('serialport')
const sleep = require('./util').sleep
// serialport.list((err, ports) => {
// console.log(ports)
//
// })
module.exports = async function main() {
const sim = new Sim('/dev/ttyAMA0')
sim.on('open', async () => {
// console.log('open')
var res = await sim.setEcho(false)
console.log('set echo res', res)
// res = await sim.getSignalQuality()
// console.log('signal quality', res)
// for (var i = 1; i < 7; i++) {
// res = await sim.readMsg(i)
// console.log('message', res)
// }
// res = await sim.readMsg(18)
// console.log(res)
sim.on('message', (msg) => {
console.log('know thats a msg', msg)
})
res = await sim.readFullMsg(20)
console.log('full message', res)
// sim.handlers.NEW_MSG('+CMTI: "SM",20', () => {
// sim.handlers.NEW_MSG('+CMTI: "SM",21')
// })
// res = await sim.checkTTS()
// await sleep(1000)
// console.log('cpin')
// await sim.send('AT+CPIN?')
// var res = await sim.test()
// console.log(res)
})
}
// process.on('SIGINT', () => {
// console.log("Caught interrupt signal")
// sim.port.close(() => {
// process.exit()
// })
// })
//
// sim.on('data', (data) => {
// console.log('sim data', data, data.length)
// })