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:
@@ -42,12 +42,12 @@
|
||||
|
||||
|
||||
|
||||
static void _writeValue(const AQH_VALUE *value, uint8_t *ptr);
|
||||
static void _writeValue(const AQH_VALUE *value, uint8_t *ptr, int useSystemName);
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_ValuesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_VALUE_LIST *valueList)
|
||||
GWEN_MSG *AQH_ValuesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_VALUE_LIST *valueList, int useSystemName)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
uint8_t *ptr;
|
||||
@@ -74,7 +74,7 @@ GWEN_MSG *AQH_ValuesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_VALU
|
||||
|
||||
value=AQH_Value_List_First(valueList);
|
||||
while(value) {
|
||||
_writeValue(value, ptr);
|
||||
_writeValue(value, ptr, useSystemName);
|
||||
ptr+=AQH_MSGDATA_VALUES_VALUES_SIZE;
|
||||
value=AQH_Value_List_Next(value);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ GWEN_MSG *AQH_ValuesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_VALU
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_ValuesDataIpcMsg_newForOneValue(uint16_t code, uint32_t flags, const AQH_VALUE *value)
|
||||
GWEN_MSG *AQH_ValuesDataIpcMsg_newForOneValue(uint16_t code, uint32_t flags, const AQH_VALUE *value, int useSystemName)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
uint8_t *ptr;
|
||||
@@ -106,21 +106,21 @@ GWEN_MSG *AQH_ValuesDataIpcMsg_newForOneValue(uint16_t code, uint32_t flags, con
|
||||
*(ptr++)=(count>>16) & 0xff;
|
||||
*(ptr++)=(count>>24) & 0xff;
|
||||
|
||||
_writeValue(value, ptr);
|
||||
_writeValue(value, ptr, useSystemName);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _writeValue(const AQH_VALUE *value, uint8_t *ptr)
|
||||
void _writeValue(const AQH_VALUE *value, uint8_t *ptr, int useSystemName)
|
||||
{
|
||||
uint64_t i64;
|
||||
const char *name;
|
||||
const char *units;
|
||||
|
||||
i64=AQH_Value_GetId(value);
|
||||
name=AQH_Value_GetName(value);
|
||||
name=useSystemName?AQH_Value_GetNameForSystem(value):AQH_Value_GetNameForDriver(value);
|
||||
units=AQH_Value_GetValueUnits(value);
|
||||
|
||||
*(ptr++)=i64 & 0xff;
|
||||
|
||||
Reference in New Issue
Block a user