Commit dee2ba97ab01806e185fd42095dc842df0d7c5cf
1 parent
b8fc7b8781
Exists in
master
queryCOPS
Showing 2 changed files with 18 additions and 2 deletions Side-by-side Diff
lib/modem-commands.js
... | ... | @@ -18,6 +18,15 @@ function writeToPort(data) { |
18 | 18 | }); |
19 | 19 | } |
20 | 20 | |
21 | +exports.sleep = function sleep(ms) { | |
22 | + return new Promise((resolve) => { | |
23 | + setTimeout(() => { | |
24 | + resolve(); | |
25 | + }, ms || 0); | |
26 | + }); | |
27 | +}; | |
28 | + | |
29 | + | |
21 | 30 | exports.setPort = function setPort(val) { |
22 | 31 | port = val; |
23 | 32 | }; |
... | ... | @@ -34,3 +43,12 @@ exports.querySignalQuality = function querySignalQuality() { |
34 | 43 | resolve(true); |
35 | 44 | }); |
36 | 45 | }; |
46 | + | |
47 | +exports.queryCOPS = function querySignalQuality() { | |
48 | + return new Promise(async (resolve) => { | |
49 | + await mutex.lock(MUTEX_COMMAND, 'queryCOPS'); | |
50 | + await writeToPort('AT+COPS?\r'); | |
51 | + mutex.unlock(MUTEX_COMMAND, 'queryCOPS'); | |
52 | + resolve(true); | |
53 | + }); | |
54 | +}; |
modem-tester.js
... | ... | @@ -53,10 +53,8 @@ port = new SerialPort(config.modem.device, { baudRate: 115200 }, async (err) => |
53 | 53 | 'AT&FE0\r', |
54 | 54 | 'AT+CGSN\r', |
55 | 55 | 'AT+CIMI\r', |
56 | - 'AT+COPS?\r', | |
57 | 56 | ]; |
58 | 57 | |
59 | - | |
60 | 58 | const commandsCount = commands.length; |
61 | 59 | // eslint-disable-next-line no-plusplus |
62 | 60 | for (let i = 0; i < commandsCount; i++) { |