aqhome: More work on endpoint system. Basically works.
This commit is contained in:
@@ -13,6 +13,11 @@
|
||||
#include "aqhome/msg_haveaddr.h"
|
||||
#include "aqhome/msg_denyaddr.h"
|
||||
|
||||
#include "aqhome/aqhome.h"
|
||||
#include "aqhome/msgendpointmanager.h"
|
||||
#include "aqhome/msgendpointtty.h"
|
||||
#include "aqhome/msgendpointlog.h"
|
||||
|
||||
#include <gwenhywfar/debug.h>
|
||||
#include <gwenhywfar/text.h>
|
||||
#include <gwenhywfar/gwentime.h>
|
||||
@@ -372,6 +377,42 @@ int testReadLoop()
|
||||
|
||||
|
||||
|
||||
int testEndpoints()
|
||||
{
|
||||
int rv;
|
||||
AQH_MSG_ENDPOINT_MGR *emgr;
|
||||
AQH_MSG_ENDPOINT *epTty;
|
||||
AQH_MSG_ENDPOINT *epLog;
|
||||
|
||||
rv=AQH_Init();
|
||||
if (rv<0) {
|
||||
}
|
||||
|
||||
emgr=AQH_MsgEndpointMgr_new(0xc0);
|
||||
epTty=AQH_MsgEndpointTty_new("/dev/ttyUSB0");
|
||||
if (epTty==NULL) {
|
||||
DBG_ERROR(NULL, "Error creating endpoint TTY");
|
||||
return 2;
|
||||
}
|
||||
AQH_MsgEndpointMgr_AddEndpoint(emgr, epTty);
|
||||
|
||||
epLog=AQH_MsgEndpointLog_new("endpoints.log");
|
||||
if (epLog==NULL) {
|
||||
DBG_ERROR(AQH_LOGDOMAIN, "Error creating endpoint LOG");
|
||||
return 2;
|
||||
}
|
||||
AQH_MsgEndpointMgr_AddEndpoint(emgr, epLog);
|
||||
|
||||
for (;;) {
|
||||
DBG_INFO(AQH_LOGDOMAIN, "Next loop");
|
||||
AQH_MsgEndpointMgr_LoopOnce(emgr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@@ -389,6 +430,9 @@ int main(int argc, char **argv)
|
||||
else if (strcasecmp(cmd, "rwtest")==0) {
|
||||
return testLoop();
|
||||
}
|
||||
else if (strcasecmp(cmd, "endpoint")==0) {
|
||||
return testEndpoints();
|
||||
}
|
||||
//return testRecv();
|
||||
//return testSend();
|
||||
return testLoop();
|
||||
|
||||
Reference in New Issue
Block a user