Commit ed3ac5f4254025590fe053b3b387a94c3f05b542

Authored by Adhidarma Hadiwinoto
1 parent e99b0fdd32
Exists in master

MODEM-TESTER: using writeToPortDelayed

Showing 1 changed file with 7 additions and 7 deletions Side-by-side Diff

... ... @@ -30,8 +30,8 @@ function writeToPort(data) {
30 30 });
31 31 }
32 32  
33   -async function writeToPortDelayed(data) {
34   - await sleep(500);
  33 +async function writeToPortDelayed(data, ms) {
  34 + await sleep(ms || 500);
35 35 const result = writeToPort(data);
36 36 return result;
37 37 }
... ... @@ -52,11 +52,11 @@ port = new SerialPort(config.modem.device, { baudRate: 115200 }, async (err) =>
52 52 }
53 53  
54 54 await writeToPortDelayed('AT\r');
55   - if (isNotBlacklistedCommand('CGSN')) await writeToPort('AT+CGSN\r');
56   - if (isNotBlacklistedCommand('CIMI')) await writeToPort('AT+CIMI\r');
57   - if (isNotBlacklistedCommand('CSQ')) await writeToPort('AT+CSQ\r');
58   - if (isNotBlacklistedCommand('COPS?')) await writeToPort('AT+COPS?\r');
59   - if (isNotBlacklistedCommand('CMGD')) await writeToPort('AT+CMGD=0,4\r');
  55 + if (isNotBlacklistedCommand('CGSN')) await writeToPortDelayed('AT+CGSN\r', 1000);
  56 + if (isNotBlacklistedCommand('CIMI')) await writeToPortDelayed('AT+CIMI\r', 1000);
  57 + if (isNotBlacklistedCommand('CSQ')) await writeToPortDelayed('AT+CSQ\r', 1000);
  58 + if (isNotBlacklistedCommand('COPS?')) await writeToPortDelayed('AT+COPS?\r', 1000);
  59 + if (isNotBlacklistedCommand('CMGD')) await writeToPortDelayed('AT+CMGD=0,4\r', 1000);
60 60 });
61 61  
62 62 port.pipe(parserCRLF);