aqhome-nodes: send heartbeat message to interface every 2mins.
e02 now expects this message. If for at least 10mins no such msg is received the USB interface is reset.
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <aqhome/msg/node/m_recvstats.h>
|
||||
#include <aqhome/msg/node/m_sendstats.h>
|
||||
#include <aqhome/msg/node/m_memstats.h>
|
||||
#include <aqhome/msg/node/m_heartbeat.h>
|
||||
#include <aqhome/data/value.h>
|
||||
|
||||
#include <gwenhywfar/args.h>
|
||||
@@ -811,6 +812,25 @@ void AQH_NodeServer_HandleTtyMsgs(AQH_OBJECT *o)
|
||||
|
||||
|
||||
|
||||
void AQH_NodeServer_SendHeartbeat(AQH_OBJECT *o)
|
||||
{
|
||||
AQH_NODE_SERVER *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQH_OBJECT, AQH_NODE_SERVER, o);
|
||||
if (xo && xo->ttyEndpoint) {
|
||||
AQH_MESSAGE *nodeMsg;
|
||||
time_t t;
|
||||
|
||||
t=time(0);
|
||||
nodeMsg=AQH_HeartbeatMessage_new(0xf0, 0x00, AQH_MSG_TYPE_HEARTBEAT, (uint32_t) t);
|
||||
AQH_Endpoint_AddMsgOut(xo->ttyEndpoint, nodeMsg);
|
||||
AQH_NodeServer_WriteTtyMsgToLogFile(o, nodeMsg, "sending");
|
||||
DBG_ERROR(NULL, "Forwarding node message %d to node", AQH_NodeMessage_GetMsgType(nodeMsg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _handleMsgFromTty(AQH_OBJECT *o, AQH_NODE_SERVER *xo, const AQH_MESSAGE *msg)
|
||||
{
|
||||
uint8_t code;
|
||||
|
||||
Reference in New Issue
Block a user