Heavy work on IPC.
We will now have a broker (aqhome-data) which stores data and distributes value change messages among connected clients. aqhomed will connect to that broker and send its values there. aqhome-mqtt will also connect to the broker and send its values there. Other clients can later connect to check for changes and react according to rules.
This commit is contained in:
@@ -101,11 +101,11 @@ int AQH_Tool_AddDataPoint(GWEN_DB_NODE *dbGlobalArgs, int argc, char **argv)
|
||||
{
|
||||
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
|
||||
GWEN_ArgsType_Char, /* type */
|
||||
"timestamp", /* name */
|
||||
"timestamp", /* name */
|
||||
0, /* minnum */
|
||||
1, /* maxnum */
|
||||
"t", /* short option */
|
||||
"timestamp", /* long option */
|
||||
"timestamp", /* long option */
|
||||
I18S("Timestamp of the data (now if omitted)"),
|
||||
I18S("Timestamp of the data (now if omitted)")
|
||||
},
|
||||
@@ -120,6 +120,39 @@ int AQH_Tool_AddDataPoint(GWEN_DB_NODE *dbGlobalArgs, int argc, char **argv)
|
||||
I18S("Value to write"),
|
||||
I18S("Value to write")
|
||||
},
|
||||
{
|
||||
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
|
||||
GWEN_ArgsType_Char, /* type */
|
||||
"clientId", /* name */
|
||||
0, /* minnum */
|
||||
1, /* maxnum */
|
||||
"c", /* short option */
|
||||
"clientid", /* long option */
|
||||
I18S("Specify CLIENTID"),
|
||||
I18S("Specify CLIENTID")
|
||||
},
|
||||
{
|
||||
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
|
||||
GWEN_ArgsType_Char, /* type */
|
||||
"userId", /* name */
|
||||
0, /* minnum */
|
||||
1, /* maxnum */
|
||||
"u", /* short option */
|
||||
"userid", /* long option */
|
||||
I18S("Specify user id"),
|
||||
I18S("Specify user id")
|
||||
},
|
||||
{
|
||||
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
|
||||
GWEN_ArgsType_Char, /* type */
|
||||
"password", /* name */
|
||||
0, /* minnum */
|
||||
1, /* maxnum */
|
||||
"p", /* short option */
|
||||
"password", /* long option */
|
||||
I18S("Specify service password"),
|
||||
I18S("Specify service password")
|
||||
},
|
||||
{
|
||||
GWEN_ARGS_FLAGS_HELP | GWEN_ARGS_FLAGS_LAST, /* flags */
|
||||
GWEN_ArgsType_Int, /* type */
|
||||
@@ -209,7 +242,7 @@ int _doAddData(GWEN_DB_NODE *dbArgs)
|
||||
fprintf(stdout, "Sending AddData request\n");
|
||||
|
||||
|
||||
epTcp=Utils_SetupIpcEndpoint(dbArgs);
|
||||
epTcp=Utils_OpenConnection(dbArgs, 0, timeoutInSeconds);
|
||||
if (epTcp==NULL) {
|
||||
DBG_ERROR(NULL, "ERROR creating TCP connection");
|
||||
return 2;
|
||||
@@ -264,7 +297,7 @@ void _sendCommand(GWEN_MSG_ENDPOINT *epTcp, const char *valueName, const char *v
|
||||
arrayToSend[0]=timestampToSend;
|
||||
arrayToSend[1]=u.i;
|
||||
|
||||
msgOut=AQH_DataPointsDataIpcMsg_new(AQH_MSGTYPE_IPC_DATA_ADDDATAPOINTS_REQ, 0, 0, valueName, valueUnits, arrayToSend, 1);
|
||||
msgOut=AQH_DataPointsDataIpcMsg_new(AQH_MSGTYPE_IPC_DATA_UPDATEDATA, 0, 0, valueName, valueUnits, arrayToSend, 1);
|
||||
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user