16 578
правок
м |
|||
Строка 1713: | Строка 1713: | ||
name: /rpc/v1/wb-mqtt-serial/port/Load/testRPC/reply, | name: /rpc/v1/wb-mqtt-serial/port/Load/testRPC/reply, | ||
value: {"error":null,"id":1,"result":{"response":"0e030400002569df"}} | value: {"error":null,"id":1,"result":{"response":"0e030400002569df"}} | ||
</syntaxhighlight> | |||
== Получение SMS == | |||
В примере с периодом в 1 секунду выводится в лог вся информация о последнем сообщении. Полученные SMS будут в capturedOutput. Пример из [https://support.wirenboard.com/t/wb7-modem-rabota-s-sms-soobshheniyami/18159 темы на портале]. | |||
<syntaxhighlight lang="bash"> | |||
var period = 1000; | |||
setInterval(function() { | |||
runShellCommand("mmcli --modem wbc --messaging-list-sms --output-keyvalue | grep length | cut -f2 -d':'", { | |||
captureOutput: true, | |||
exitCallback: function(exitCode, capturedOutput) { | |||
if (exitCode === 0) { | |||
runShellCommand("mmcli --modem wbc --sms " + (parseInt(capturedOutput) - 1).toString(), { | |||
captureOutput: true, | |||
exitCallback: function(exitCode, capturedOutput) { | |||
if (exitCode === 0) { | |||
log(capturedOutput); | |||
return; | |||
} | |||
} | |||
}); | |||
return; | |||
} | |||
} | |||
}); | |||
}, period); | |||
</syntaxhighlight> | </syntaxhighlight> | ||