{
this.send(my_name + ': issue a trigger...\r\n');
dmccCommand("TRIGGER", true);
msg = 'done';
}
else if (inputString == "close")
{
this.close();
}
else if (inputString == "stop")
{
this.setTimer(0.0);
}
else if (inputString == "start")
{
this.setTimer(10.0);
}
else if (inputString == "switch")
{
this.onTimer = onTimeout2;
}
else if (inputString == "time")
{
today = new Date();
msg = today.getSeconds() * 1000 + today.getMilliseconds();
}
else
{
msg = "unknown command: " + replace_crlf(inputString);
}
num_send = this.send(my_name + ': ' + msg + "\r\n");
return inputString.length;
},
onUnexpectedData: function (inputString) {
this.expectFramed("#", ";\r\n", 128);
msg = replace_crlf(inputString);
num_send = this.send(my_name + ': ' + msg + "?\r\n");
return true;
},
onTimer: onTimeout
};
}
Generic use case: Heartbeat
Send out a periodic heartbeat message if reader is idle.
57
DataMan Application Development