AT command library
Library provides simple functionality for sending and receiving AT commands. This library is singleton, it has only one instance.
Initialize:
var atcmd = require('atcmd');
Send AT command
send(command, callback)
String command - an AT command without CR-LF
Function callback - it will be invoked when response for AT command be delivered.
Example
atcmd.send("ati", function(response){
if (response!=null) sys.println(response);
});
Listening for URC codes
urcReceived(urc)
String urc - catched URC string
Function will be invoked from system when some URC is incoming. Override it with your implementation.
Example
var sys = require("system");
var atcmd = require("atcmd");
atcmd.urcReceived = function (data) {
sys.println("M2MScript urc:");
sys.println(data);
}
atcmd.send("ati", function (response) {
if (response != null) {
sys.println(response);
}
});
sys.println("waitng for ati");