adapted to latest changes in gwen, more work on data and nodes servers.
This commit is contained in:
@@ -70,6 +70,7 @@
|
||||
hexfile
|
||||
data
|
||||
events
|
||||
client
|
||||
</subdirs>
|
||||
|
||||
|
||||
@@ -81,6 +82,7 @@
|
||||
aqhhexfile
|
||||
aqhdata
|
||||
aqhevents
|
||||
aqhclient
|
||||
</useTargets>
|
||||
|
||||
<libraries>
|
||||
|
||||
@@ -182,6 +182,93 @@ void AQH_MergeConfigFileIntoConfig(GWEN_DB_NODE *dbArgs, const char *destDbGroup
|
||||
|
||||
|
||||
|
||||
int AQH_ValueType_fromString(const char *s)
|
||||
{
|
||||
if (s) {
|
||||
if (strcasecmp(s, "sensor")==0)
|
||||
return AQH_ValueType_Sensor;
|
||||
else if (strcasecmp(s, "actor")==0)
|
||||
return AQH_ValueType_Actor;
|
||||
}
|
||||
return AQH_ValueType_Unknown;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *AQH_ValueType_toString(int i)
|
||||
{
|
||||
switch (i) {
|
||||
case AQH_ValueType_Sensor: return "sensor";
|
||||
case AQH_ValueType_Actor: return "actor";
|
||||
case AQH_ValueType_Unknown:
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int AQH_ValueDataType_fromString(const char *s)
|
||||
{
|
||||
if (s) {
|
||||
if (strcasecmp(s, "int")==0)
|
||||
return AQH_ValueDataType_Int;
|
||||
else if (strcasecmp(s, "dword")==0)
|
||||
return AQH_ValueDataType_Dword;
|
||||
else if (strcasecmp(s, "rational")==0)
|
||||
return AQH_ValueDataType_Rational;
|
||||
}
|
||||
return AQH_ValueDataType_Unknown;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *AQH_ValueDataType_toString(int i)
|
||||
{
|
||||
switch(i) {
|
||||
case AQH_ValueDataType_Int: return "int";
|
||||
case AQH_ValueDataType_Dword: return "dword";
|
||||
case AQH_ValueDataType_Rational: return "rational";
|
||||
case AQH_ValueDataType_Unknown:
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int AQH_ValueModality_fromString(const char *s)
|
||||
{
|
||||
if (s) {
|
||||
if (strcasecmp(s, "temperature")==0)
|
||||
return AQH_ValueModality_Temperature;
|
||||
else if (strcasecmp(s, "humidity")==0)
|
||||
return AQH_ValueModality_Humidity;
|
||||
else if (strcasecmp(s, "door")==0)
|
||||
return AQH_ValueModality_Door;
|
||||
else if (strcasecmp(s, "rgb")==0)
|
||||
return AQH_ValueModality_RGB;
|
||||
else if (strcasecmp(s, "rgbw")==0)
|
||||
return AQH_ValueModality_RGBW;
|
||||
}
|
||||
return AQH_ValueModality_Unknown;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *AQH_ValueModality_toString(int i)
|
||||
{
|
||||
switch(i) {
|
||||
case AQH_ValueModality_Temperature: return "temperature";
|
||||
case AQH_ValueModality_Humidity: return "humidity";
|
||||
case AQH_ValueModality_Door: return "door";
|
||||
case AQH_ValueModality_RGB: return "rgb";
|
||||
case AQH_ValueModality_RGBW: return "rgbw";
|
||||
case AQH_ValueModality_Unknown:
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,31 @@
|
||||
#include <gwenhywfar/buffer.h>
|
||||
|
||||
|
||||
enum {
|
||||
AQH_ValueType_Unknown=0,
|
||||
AQH_ValueType_Sensor,
|
||||
AQH_ValueType_Actor
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
AQH_ValueDataType_Unknown=0,
|
||||
AQH_ValueDataType_Int,
|
||||
AQH_ValueDataType_Dword,
|
||||
AQH_ValueDataType_Rational
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
AQH_ValueModality_Unknown=0,
|
||||
AQH_ValueModality_Temperature,
|
||||
AQH_ValueModality_Humidity,
|
||||
AQH_ValueModality_Door,
|
||||
AQH_ValueModality_RGB,
|
||||
AQH_ValueModality_RGBW
|
||||
};
|
||||
|
||||
|
||||
|
||||
AQHOME_API int AQH_Init(void);
|
||||
AQHOME_API void AQH_Fini(void);
|
||||
@@ -39,6 +64,15 @@ AQHOME_API GWEN_STRINGLIST *AQH_GetGlobalDataDirs(void);
|
||||
AQHOME_API GWEN_STRINGLIST *AQH_GetGlobalSysconfDirs(void);
|
||||
|
||||
|
||||
AQHOME_API int AQH_ValueType_fromString(const char *s);
|
||||
AQHOME_API const char *AQH_ValueType_toString(int i);
|
||||
|
||||
AQHOME_API int AQH_ValueDataType_fromString(const char *s);
|
||||
AQHOME_API const char *AQH_ValueDataType_toString(int i);
|
||||
|
||||
AQHOME_API int AQH_ValueModality_fromString(const char *s);
|
||||
AQHOME_API const char *AQH_ValueModality_toString(int i);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,16 +30,6 @@
|
||||
|
||||
<enums>
|
||||
|
||||
<enum id="AQH_VALUE_TYPE" prefix="AQH_ValueType_">
|
||||
<item name="sensor" value="0">
|
||||
<descr>sensor</descr>
|
||||
</item>
|
||||
<item name="actor" >
|
||||
<descr>actor</descr>
|
||||
</item>
|
||||
|
||||
</enum>
|
||||
|
||||
</enums>
|
||||
|
||||
|
||||
|
||||
@@ -24,32 +24,32 @@
|
||||
#define AQH_IPC_PROTOCOL_DATA_VERSION 1
|
||||
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_RESULT 0x001 /* AQH_ResultIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_RESULT 0x0001 /* AQH_ResultIpcMsg */
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_CONNECT_REQ 0x010 /* serviceName, userName, password */
|
||||
#define AQH_MSGTYPE_IPC_DATA_CONNECT_REQ 0x0010 /* serviceName, userName, password */
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_UPDATEDATA 0x100 /* AQH_MultiDataDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_DATACHANGED 0x200 /* AQH_MultiDataDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_UPDATEDATA 0x0100 /* AQH_MultiDataDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_DATACHANGED 0x0200 /* AQH_MultiDataDataIpcMsg */
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_SETDATA 0x300 /* AQH_SetDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_SETDATA 0x0300 /* AQH_SetDataIpcMsg */
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_ADDVALUE 0x400 /* AQH_AddValueDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_ADDVALUE 0x0400 /* AQH_AddValueDataIpcMsg */
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETDATA_REQ 0x500 /* AQH_GetDataDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETDATA_RSP 0x600 /* AQH_MultiDataDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETDATA_REQ 0x0500 /* AQH_GetDataDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETDATA_RSP 0x0600 /* AQH_MultiDataDataIpcMsg */
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETLASTDATA_REQ 0x700 /* AQH_GetDataDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETLASTDATA_RSP 0x800 /* AQH_MultiDataDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETLASTDATA_REQ 0x0700 /* AQH_GetDataDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETLASTDATA_RSP 0x0800 /* AQH_MultiDataDataIpcMsg */
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETVALUES_REQ 0x900 /* GWEN_IpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETVALUES_RSP 0xa00 /* AQH_ValuesDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETVALUES_REQ 0x0900 /* GWEN_IpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETVALUES_RSP 0x0a00 /* AQH_ValuesDataIpcMsg */
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETDEVICES_REQ 0xb00 /* GWEN_IpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETDEVICES_RSP 0xc00 /* AQH_DevicesDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETDEVICES_REQ 0x0b00 /* GWEN_IpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_GETDEVICES_RSP 0x0c00 /* AQH_DevicesDataIpcMsg */
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_MODDEVICE_REQ 0xd00 /* AQH_DevicesDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_MODDEVICE_REQ 0x0d00 /* AQH_DevicesDataIpcMsg */
|
||||
|
||||
#define AQH_MSGTYPE_IPC_DATA_ANNOUNCEVALUE 0xe00 /* AQH_ValuesDataIpcMsg */
|
||||
#define AQH_MSGTYPE_IPC_DATA_ANNOUNCEVALUE 0x0e00 /* AQH_ValuesDataIpcMsg */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_ConnectDataIpcMsg_new(uint16_t code, const char *clientId, const char *userId, const char *password, uint32_t flags)
|
||||
GWEN_MSG *AQH_ConnectDataIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const char *clientId, const char *userId, const char *password, uint32_t flags)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
GWEN_BUFFER *buf;
|
||||
@@ -41,7 +43,7 @@ GWEN_MSG *AQH_ConnectDataIpcMsg_new(uint16_t code, const char *clientId, const c
|
||||
GWEN_Tag16_WriteStringTagToBuffer(AQH_MSGDATA_CONNECT_TAGS_PASSWORD, password, buf);
|
||||
GWEN_Tag16_WriteUint32TagToBuffer(AQH_MSGDATA_CONNECT_TAGS_FLAGS, flags, buf);
|
||||
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code,
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, msgId, refMsgId,
|
||||
GWEN_Buffer_GetUsedBytes(buf), (const uint8_t*) GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
return msg;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_ConnectDataIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const char *clientId,
|
||||
const char *userId, const char *password,
|
||||
uint32_t flags);
|
||||
|
||||
@@ -34,86 +34,38 @@
|
||||
|
||||
|
||||
|
||||
#define AQH_MSGDATA_DATAPOINTS_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_DATAPOINTS_OFFS_VALUES)
|
||||
|
||||
|
||||
static void _writeQword(uint64_t i64, uint8_t *ptr);
|
||||
#define AQH_MSGDATA_DATAPOINTS_PAYLOADSIZE (AQH_MSGDATA_DATAPOINTS_OFFS_VALUES)
|
||||
#define AQH_MSGDATA_DATAPOINTS_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_DATAPOINTS_PAYLOADSIZE)
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_DataPointsDataIpcMsg_new(uint16_t code, uint32_t flags,
|
||||
GWEN_MSG *AQH_DataPointsDataIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId, uint32_t flags,
|
||||
uint64_t valueId, const char *valueName, const char *units,
|
||||
const uint64_t *i64Ptr, int numOfDataPoints)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
uint8_t *ptr;
|
||||
int payloadSize;
|
||||
int i;
|
||||
|
||||
payloadSize=AQH_MSGDATA_DATAPOINTS_OFFS_VALUES+(numOfDataPoints*16);
|
||||
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, payloadSize, NULL);
|
||||
ptr=GWEN_Msg_GetBuffer(msg)+GWEN_MSGIPC_OFFS_PAYLOAD;
|
||||
*(ptr++)=flags & 0xff;
|
||||
*(ptr++)=(flags>>8) & 0xff;
|
||||
*(ptr++)=(flags>>16) & 0xff;
|
||||
*(ptr++)=(flags>>24) & 0xff;
|
||||
|
||||
*(ptr++)=numOfDataPoints & 0xff;
|
||||
*(ptr++)=(numOfDataPoints>>8) & 0xff;
|
||||
*(ptr++)=(numOfDataPoints>>16) & 0xff;
|
||||
*(ptr++)=(numOfDataPoints>>24) & 0xff;
|
||||
|
||||
_writeQword(valueId, ptr);
|
||||
ptr+=8;
|
||||
|
||||
|
||||
if (valueName) {
|
||||
strncpy((char*) ptr, valueName, AQH_MSGDATA_DATAPOINTS_SIZE_VALUENAME-1);
|
||||
ptr[AQH_MSGDATA_DATAPOINTS_SIZE_VALUENAME-1]=0;
|
||||
}
|
||||
else
|
||||
memset(ptr, 0, AQH_MSGDATA_DATAPOINTS_SIZE_VALUENAME);
|
||||
ptr+=AQH_MSGDATA_DATAPOINTS_SIZE_VALUENAME;
|
||||
|
||||
if (units) {
|
||||
strncpy((char*) ptr, units, AQH_MSGDATA_DATAPOINTS_SIZE_VALUEUNITS-1);
|
||||
ptr[AQH_MSGDATA_DATAPOINTS_SIZE_VALUEUNITS-1]=0;
|
||||
}
|
||||
else
|
||||
memset(ptr, 0, AQH_MSGDATA_DATAPOINTS_SIZE_VALUEUNITS);
|
||||
ptr+=AQH_MSGDATA_DATAPOINTS_SIZE_VALUEUNITS;
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, msgId, refMsgId, 0, NULL);
|
||||
GWEN_Msg_AddUint32(msg, flags);
|
||||
GWEN_Msg_AddUint32(msg, numOfDataPoints);
|
||||
GWEN_Msg_AddUint64(msg, valueId);
|
||||
|
||||
GWEN_Msg_AddStringWithTrailingNull(msg, valueName, AQH_MSGDATA_DATAPOINTS_SIZE_VALUENAME, 0);
|
||||
GWEN_Msg_AddStringWithTrailingNull(msg, units, AQH_MSGDATA_DATAPOINTS_SIZE_VALUEUNITS, 0);
|
||||
|
||||
for (i=0; i<numOfDataPoints; i++) {
|
||||
_writeQword(*i64Ptr, ptr);
|
||||
i64Ptr++;
|
||||
ptr+=8;
|
||||
|
||||
_writeQword(*i64Ptr, ptr);
|
||||
i64Ptr++;
|
||||
ptr+=8;
|
||||
GWEN_Msg_AddUint64(msg, *(i64Ptr++)); /* timestamp */
|
||||
GWEN_Msg_AddUint64(msg, *(i64Ptr++)); /* value */
|
||||
}
|
||||
GWEN_IpcMsg_AdjustMsgSize(msg);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _writeQword(uint64_t i64, uint8_t *ptr)
|
||||
{
|
||||
*(ptr++)=i64 & 0xff;
|
||||
*(ptr++)=(i64>>8) & 0xff;
|
||||
*(ptr++)=(i64>>16) & 0xff;
|
||||
*(ptr++)=(i64>>24) & 0xff;
|
||||
*(ptr++)=(i64>>32) & 0xff;
|
||||
*(ptr++)=(i64>>40) & 0xff;
|
||||
*(ptr++)=(i64>>48) & 0xff;
|
||||
*(ptr++)=(i64>>56) & 0xff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint32_t AQH_DataPointsDataIpcMsg_GetFlags(const GWEN_MSG *msg)
|
||||
{
|
||||
return GWEN_Msg_GetUint32At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_DATAPOINTS_OFFS_FLAGS, 0);
|
||||
@@ -204,7 +156,8 @@ void AQH_DataPointsDataIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbu
|
||||
|
||||
valueName=AQH_DataPointsDataIpcMsg_GetValueName(msg);
|
||||
GWEN_Buffer_AppendArgs(dbuf,
|
||||
"DATAPOINTS (code=%d, proto=%d, proto version=%d, flags=0x%08x, valueName=%s, values=%d)\n",
|
||||
"DATAPOINTS %s (code=%d, proto=%d, proto version=%d, flags=0x%08x, valueName=%s, values=%d)\n",
|
||||
sText?sText:"",
|
||||
GWEN_IpcMsg_GetCode(msg),
|
||||
GWEN_IpcMsg_GetProtoId(msg),
|
||||
GWEN_IpcMsg_GetProtoVersion(msg),
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_DataPointsDataIpcMsg_new(uint16_t code, uint32_t flags,
|
||||
AQHOME_API GWEN_MSG *AQH_DataPointsDataIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t flags,
|
||||
uint64_t valueId, const char *valueName, const char *units,
|
||||
const uint64_t *i64Ptr, int numOfDataPoints);
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
GWEN_MSG *AQH_DevicesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_DEVICE_LIST *deviceList)
|
||||
GWEN_MSG *AQH_DevicesDataIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t flags, const AQH_DEVICE_LIST *deviceList)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
GWEN_BUFFER *buf;
|
||||
@@ -56,7 +57,7 @@ GWEN_MSG *AQH_DevicesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_DEV
|
||||
return NULL;
|
||||
}
|
||||
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code,
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, msgId, refMsgId,
|
||||
GWEN_Buffer_GetUsedBytes(buf), (const uint8_t*) GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
return msg;
|
||||
@@ -64,7 +65,8 @@ GWEN_MSG *AQH_DevicesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_DEV
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_DevicesDataIpcMsg_newForOneDevice(uint16_t code, uint32_t flags, const AQH_DEVICE *device)
|
||||
GWEN_MSG *AQH_DevicesDataIpcMsg_newForOneDevice(uint16_t code, uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t flags, const AQH_DEVICE *device)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
GWEN_BUFFER *buf;
|
||||
@@ -79,7 +81,7 @@ GWEN_MSG *AQH_DevicesDataIpcMsg_newForOneDevice(uint16_t code, uint32_t flags, c
|
||||
return NULL;
|
||||
}
|
||||
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code,
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, msgId, refMsgId,
|
||||
GWEN_Buffer_GetUsedBytes(buf), (const uint8_t*) GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
return msg;
|
||||
|
||||
@@ -27,8 +27,10 @@
|
||||
#define AQH_MSGDATA_DEVICES_TAGS_DEVICE 0xc2
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_DevicesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_DEVICE_LIST *deviceList);
|
||||
AQHOME_API GWEN_MSG *AQH_DevicesDataIpcMsg_newForOneDevice(uint16_t code, uint32_t flags, const AQH_DEVICE *device);
|
||||
AQHOME_API GWEN_MSG *AQH_DevicesDataIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t flags, const AQH_DEVICE_LIST *deviceList);
|
||||
AQHOME_API GWEN_MSG *AQH_DevicesDataIpcMsg_newForOneDevice(uint16_t code, uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t flags, const AQH_DEVICE *device);
|
||||
|
||||
AQHOME_API void AQH_DevicesDataIpcMsg_Parse(GWEN_MSG *msg, int doCopy);
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_GetDataDataIpcMsg_new(uint16_t code, const char *valueName, uint64_t tsBegin, uint64_t tsEnd, uint64_t num)
|
||||
GWEN_MSG *AQH_GetDataDataIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const char *valueName, uint64_t tsBegin, uint64_t tsEnd, uint64_t num)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
GWEN_BUFFER *buf;
|
||||
@@ -39,7 +41,7 @@ GWEN_MSG *AQH_GetDataDataIpcMsg_new(uint16_t code, const char *valueName, uint64
|
||||
GWEN_Tag16_WriteUint64TagToBuffer(AQH_MSGDATA_GETDATA_TAGS_END, tsEnd, buf);
|
||||
GWEN_Tag16_WriteUint64TagToBuffer(AQH_MSGDATA_GETDATA_TAGS_NUM, num, buf);
|
||||
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code,
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, msgId, refMsgId,
|
||||
GWEN_Buffer_GetUsedBytes(buf), (const uint8_t*) GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
return msg;
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_GetDataDataIpcMsg_new(uint16_t code, const char *valueName, uint64_t tsBegin, uint64_t tsEnd, uint64_t num);
|
||||
AQHOME_API GWEN_MSG *AQH_GetDataDataIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const char *valueName, uint64_t tsBegin, uint64_t tsEnd, uint64_t num);
|
||||
|
||||
AQHOME_API void AQH_GetDataDataIpcMsg_Parse(GWEN_MSG *msg, int doCopy);
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_MultiDataDataIpcMsg_new(uint16_t code, const AQH_VALUE *value, const uint64_t *i64Ptr, int numOfDataPoints)
|
||||
GWEN_MSG *AQH_MultiDataDataIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const AQH_VALUE *value, const uint64_t *i64Ptr, int numOfDataPoints)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
GWEN_BUFFER *buf;
|
||||
@@ -45,7 +47,7 @@ GWEN_MSG *AQH_MultiDataDataIpcMsg_new(uint16_t code, const AQH_VALUE *value, con
|
||||
if (i64Ptr && numOfDataPoints)
|
||||
GWEN_Tag16_WriteTagToBuffer(AQH_MSGDATA_MULTIDATA_TAGS_DATA, (const uint8_t*)i64Ptr, numOfDataPoints*2*sizeof(uint64_t), buf);
|
||||
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code,
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, msgId, refMsgId,
|
||||
GWEN_Buffer_GetUsedBytes(buf), (const uint8_t*) GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
return msg;
|
||||
@@ -53,7 +55,9 @@ GWEN_MSG *AQH_MultiDataDataIpcMsg_new(uint16_t code, const AQH_VALUE *value, con
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_MultiDataDataIpcMsg_newForOne(uint16_t code, const AQH_VALUE *value, uint64_t timeStamp, double dataPoint)
|
||||
GWEN_MSG *AQH_MultiDataDataIpcMsg_newForOne(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const AQH_VALUE *value, uint64_t timeStamp, double dataPoint)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
GWEN_BUFFER *buf;
|
||||
@@ -75,7 +79,7 @@ GWEN_MSG *AQH_MultiDataDataIpcMsg_newForOne(uint16_t code, const AQH_VALUE *valu
|
||||
arrayToSend[1]=u.i;
|
||||
GWEN_Tag16_WriteTagToBuffer(AQH_MSGDATA_MULTIDATA_TAGS_DATA, (const uint8_t*) arrayToSend, 2*sizeof(uint64_t), buf);
|
||||
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code,
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, msgId, refMsgId,
|
||||
GWEN_Buffer_GetUsedBytes(buf), (const uint8_t*) GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
return msg;
|
||||
|
||||
@@ -22,8 +22,12 @@
|
||||
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_MultiDataDataIpcMsg_new(uint16_t code, const AQH_VALUE *value, const uint64_t *i64Ptr, int numOfDataPoints);
|
||||
AQHOME_API GWEN_MSG *AQH_MultiDataDataIpcMsg_newForOne(uint16_t code, const AQH_VALUE *value, uint64_t timeStamp, double dataPoint);
|
||||
AQHOME_API GWEN_MSG *AQH_MultiDataDataIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const AQH_VALUE *value, const uint64_t *i64Ptr, int numOfDataPoints);
|
||||
AQHOME_API GWEN_MSG *AQH_MultiDataDataIpcMsg_newForOne(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const AQH_VALUE *value, uint64_t timeStamp, double dataPoint);
|
||||
|
||||
AQHOME_API void AQH_MultiDataDataIpcMsg_Parse(GWEN_MSG *msg, int doCopy);
|
||||
AQHOME_API AQH_VALUE *AQH_MultiDataDataIpcMsg_ReadValue(const GWEN_MSG *msg);
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
GWEN_MSG *AQH_SetDataIpcMsg_new(uint16_t code, const AQH_VALUE *value, const char *data)
|
||||
GWEN_MSG *AQH_SetDataIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const AQH_VALUE *value, const char *data)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
GWEN_BUFFER *buf;
|
||||
@@ -58,7 +60,7 @@ GWEN_MSG *AQH_SetDataIpcMsg_new(uint16_t code, const AQH_VALUE *value, const cha
|
||||
GWEN_Tag16_WriteStringTagToBuffer(AQH_MSGDATA_SET_TAGS_DATA, data, buf);
|
||||
|
||||
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code,
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, msgId, refMsgId,
|
||||
GWEN_Buffer_GetUsedBytes(buf), (const uint8_t*) GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
return msg;
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
#define AQH_MSGDATA_SET_TAGS_DATA 0x02
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_SetDataIpcMsg_new(uint16_t code, const AQH_VALUE *value, const char *data);
|
||||
AQHOME_API GWEN_MSG *AQH_SetDataIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const AQH_VALUE *value, const char *data);
|
||||
AQHOME_API void AQH_SetDataIpcMsg_Parse(GWEN_MSG *msg, int doCopy);
|
||||
AQHOME_API AQH_VALUE *AQH_SetDataIpcMsg_ReadValue(const GWEN_MSG *msg);
|
||||
AQHOME_API char *AQH_SetDataIpcMsg_ReadData(const GWEN_MSG *msg);
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
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 msgId, uint32_t refMsgId,
|
||||
uint32_t flags, const AQH_VALUE_LIST *valueList)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
GWEN_BUFFER *buf;
|
||||
@@ -56,7 +58,7 @@ GWEN_MSG *AQH_ValuesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_VALU
|
||||
return NULL;
|
||||
}
|
||||
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code,
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, msgId, refMsgId,
|
||||
GWEN_Buffer_GetUsedBytes(buf), (const uint8_t*) GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
return msg;
|
||||
@@ -64,7 +66,9 @@ 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 msgId, uint32_t refMsgId,
|
||||
uint32_t flags, const AQH_VALUE *value)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
GWEN_BUFFER *buf;
|
||||
@@ -79,7 +83,7 @@ GWEN_MSG *AQH_ValuesDataIpcMsg_newForOneValue(uint16_t code, uint32_t flags, con
|
||||
return NULL;
|
||||
}
|
||||
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code,
|
||||
msg=AQH_Tag16IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, msgId, refMsgId,
|
||||
GWEN_Buffer_GetUsedBytes(buf), (const uint8_t*) GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
return msg;
|
||||
|
||||
@@ -27,8 +27,12 @@
|
||||
#define AQH_MSGDATA_VALUES_TAGS_VALUE 0xc2
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_ValuesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_VALUE_LIST *valueList);
|
||||
AQHOME_API GWEN_MSG *AQH_ValuesDataIpcMsg_newForOneValue(uint16_t code, uint32_t flags, const AQH_VALUE *value);
|
||||
AQHOME_API GWEN_MSG *AQH_ValuesDataIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t flags, const AQH_VALUE_LIST *valueList);
|
||||
AQHOME_API GWEN_MSG *AQH_ValuesDataIpcMsg_newForOneValue(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t flags, const AQH_VALUE *value);
|
||||
|
||||
AQHOME_API void AQH_ValuesDataIpcMsg_Parse(GWEN_MSG *msg, int doCopy);
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ int _startConnect(GWEN_MSG_ENDPOINT *ep, GWEN_MSG_ENDPOINT *epChild)
|
||||
return rv;
|
||||
}
|
||||
msg=AQH_ConnectDataIpcMsg_new(AQH_MSGTYPE_IPC_DATA_CONNECT_REQ,
|
||||
GWEN_MsgEndpoint_GetNextMessageId(epChild), 0,
|
||||
AQH_IpcEndpoint_GetServiceName(epChild),
|
||||
AQH_IpcEndpoint_GetUserName(epChild),
|
||||
AQH_IpcEndpoint_GetPassword(epChild),
|
||||
|
||||
@@ -26,61 +26,35 @@
|
||||
#define AQH_MSGDATA_QWORDS_OFFS_VALUES 8 /* 8 byte */
|
||||
|
||||
|
||||
#define AQH_MSGDATA_QWORDS_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_QWORDS_OFFS_VALUES)
|
||||
|
||||
|
||||
static void _writeQword(uint64_t i64, uint8_t *ptr);
|
||||
#define AQH_MSGDATA_QWORDS_PAYLOADSIZE (AQH_MSGDATA_QWORDS_OFFS_VALUES)
|
||||
#define AQH_MSGDATA_QWORDS_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_QWORDS_PAYLOADSIZE)
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_QwordsIpcMsg_new(uint8_t protoId, uint8_t protoVer, uint16_t code, uint32_t flags, const uint64_t *i64Ptr, int count)
|
||||
GWEN_MSG *AQH_QwordsIpcMsg_new(uint8_t protoId, uint8_t protoVer, uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t flags, const uint64_t *i64Ptr, int count)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
uint8_t *ptr;
|
||||
int payloadSize;
|
||||
int i;
|
||||
|
||||
payloadSize=AQH_MSGDATA_QWORDS_OFFS_VALUES+(count*8);
|
||||
payloadSize=AQH_MSGDATA_QWORDS_PAYLOADSIZE+(count*8);
|
||||
|
||||
msg=GWEN_IpcMsg_new(protoId, protoVer, code, payloadSize, NULL);
|
||||
ptr=GWEN_Msg_GetBuffer(msg)+GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_QWORDS_OFFS_VALUES;
|
||||
msg=GWEN_IpcMsg_new(protoId, protoVer, code, msgId, refMsgId, payloadSize, NULL);
|
||||
GWEN_Msg_AddUint32(msg, flags);
|
||||
GWEN_Msg_AddUint32(msg, count);
|
||||
|
||||
*(ptr++)=flags & 0xff;
|
||||
*(ptr++)=(flags>>8) & 0xff;
|
||||
*(ptr++)=(flags>>16) & 0xff;
|
||||
*(ptr++)=(flags>>24) & 0xff;
|
||||
|
||||
*(ptr++)=count & 0xff;
|
||||
*(ptr++)=(count>>8) & 0xff;
|
||||
*(ptr++)=(count>>16) & 0xff;
|
||||
*(ptr++)=(count>>24) & 0xff;
|
||||
|
||||
for(i=0; i<count; i++) {
|
||||
_writeQword(*i64Ptr, ptr);
|
||||
ptr+=8;
|
||||
i64Ptr++;
|
||||
}
|
||||
for(i=0; i<count; i++)
|
||||
GWEN_Msg_AddUint64(msg, *(i64Ptr++));
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _writeQword(uint64_t i64, uint8_t *ptr)
|
||||
{
|
||||
*(ptr++)=i64 & 0xff;
|
||||
*(ptr++)=(i64>>8) & 0xff;
|
||||
*(ptr++)=(i64>>16) & 0xff;
|
||||
*(ptr++)=(i64>>24) & 0xff;
|
||||
*(ptr++)=(i64>>32) & 0xff;
|
||||
*(ptr++)=(i64>>40) & 0xff;
|
||||
*(ptr++)=(i64>>48) & 0xff;
|
||||
*(ptr++)=(i64>>56) & 0xff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint32_t AQH_QwordsIpcMsg_GetFlags(const GWEN_MSG *msg)
|
||||
{
|
||||
return GWEN_Msg_GetUint32At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_QWORDS_OFFS_FLAGS, 0);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_QwordsIpcMsg_new(uint8_t protoId, uint8_t protoVer, uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t flags, const uint64_t *i64Ptr, int count);
|
||||
|
||||
AQHOME_API uint32_t AQH_QwordsIpcMsg_GetFlags(const GWEN_MSG *msg);
|
||||
|
||||
@@ -26,24 +26,21 @@
|
||||
|
||||
#define AQH_MSGIPC_RESULT_OFFS_RESULTCODE 0 /* 4 bytes */
|
||||
|
||||
//#define AQH_MSGIPC_RESULT_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_RESULT_OFFS_RESULTCODE+4)
|
||||
#define AQH_MSGIPC_RESULT_MINSIZE (AQH_MSGIPC_RESULT_OFFS_RESULTCODE+4)
|
||||
#define AQH_MSGIPC_RESULT_PAYLOADSIZE (AQH_MSGIPC_RESULT_OFFS_RESULTCODE+4)
|
||||
#define AQH_MSGIPC_RESULT_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_RESULT_PAYLOADSIZE)
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_ResultIpcMsg_new(uint16_t code, uint32_t resultCode)
|
||||
GWEN_MSG *AQH_ResultIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId, uint32_t resultCode)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
uint8_t *ptr;
|
||||
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_RESULT_ID, AQH_IPC_PROTOCOL_RESULT_VERSION, code, AQH_MSGIPC_RESULT_MINSIZE, NULL);
|
||||
ptr=GWEN_Msg_GetBuffer(msg);
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_RESULT_OFFS_RESULTCODE+0]=resultCode & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_RESULT_OFFS_RESULTCODE+1]=(resultCode>>8) & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_RESULT_OFFS_RESULTCODE+2]=(resultCode>>16) & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_RESULT_OFFS_RESULTCODE+3]=(resultCode>>24) & 0xff;
|
||||
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_RESULT_ID, AQH_IPC_PROTOCOL_RESULT_VERSION, code,
|
||||
msgId, refMsgId,
|
||||
AQH_MSGIPC_RESULT_PAYLOADSIZE, NULL);
|
||||
GWEN_Msg_AddUint32(msg, resultCode);
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -62,11 +59,13 @@ void AQH_ResultIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const
|
||||
{
|
||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSGIPC_RESULT_MINSIZE) {
|
||||
GWEN_Buffer_AppendArgs(dbuf,
|
||||
"ERROR (code=%d, proto=%d, proto version=%d, error=%d)\n",
|
||||
"ERROR (code=%d, proto=%d, proto version=%d, error=%d, msgId=%d, refMsgId=%d)\n",
|
||||
GWEN_IpcMsg_GetCode(msg),
|
||||
GWEN_IpcMsg_GetProtoId(msg),
|
||||
GWEN_IpcMsg_GetProtoVersion(msg),
|
||||
AQH_ResultIpcMsg_GetResultCode(msg));
|
||||
AQH_ResultIpcMsg_GetResultCode(msg),
|
||||
GWEN_IpcMsg_GetMsgId(msg),
|
||||
GWEN_IpcMsg_GetRefMsgId(msg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#define AQH_MSG_IPC_ERROR_NOTFOUND 7
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_ResultIpcMsg_new(uint16_t code, uint32_t resultCode);
|
||||
AQHOME_API GWEN_MSG *AQH_ResultIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId, uint32_t resultCode);
|
||||
AQHOME_API uint32_t AQH_ResultIpcMsg_GetResultCode(const GWEN_MSG *msg);
|
||||
AQHOME_API void AQH_ResultIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||
|
||||
|
||||
@@ -36,11 +36,13 @@ GWEN_INHERIT(GWEN_MSG, AQH_MSG_IPC_TAG16);
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_Tag16IpcMsg_new(uint8_t protoId, uint8_t protoVer, uint16_t code, uint32_t payloadLen, const uint8_t *payload)
|
||||
GWEN_MSG *AQH_Tag16IpcMsg_new(uint8_t protoId, uint8_t protoVer, uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t payloadLen, const uint8_t *payload)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
|
||||
msg=GWEN_IpcMsg_new(protoId, protoVer, code, payloadLen, payload);
|
||||
msg=GWEN_IpcMsg_new(protoId, protoVer, code, msgId, refMsgId, payloadLen, payload);
|
||||
AQH_Tag16IpcMsg_Extend(msg);
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
#include <gwenhywfar/tag16.h>
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_Tag16IpcMsg_new(uint8_t protoId, uint8_t protoVer, uint16_t code, uint32_t payloadLen, const uint8_t *payload);
|
||||
AQHOME_API GWEN_MSG *AQH_Tag16IpcMsg_new(uint8_t protoId, uint8_t protoVer, uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t payloadLen, const uint8_t *payload);
|
||||
AQHOME_API void AQH_Tag16IpcMsg_ExtendAndParse(GWEN_MSG *msg, int doCopy);
|
||||
|
||||
AQHOME_API void AQH_Tag16IpcMsg_Extend(GWEN_MSG *msg);
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
#define AQH_IPC_PROTOCOL_NODES_VERSION 1
|
||||
|
||||
|
||||
#define AQH_MSGTYPE_IPC_NODES_RESULT 0x001
|
||||
#define AQH_MSGTYPE_IPC_NODES_RESULT 0xf001
|
||||
|
||||
#define AQH_MSGTYPE_IPC_NODES_FORWARD 0x100
|
||||
#define AQH_MSGTYPE_IPC_NODES_VALUE 0x200
|
||||
#define AQH_MSGTYPE_IPC_NODES_PING 0x300
|
||||
#define AQH_MSGTYPE_IPC_NODES_SETACCMSGGRPS 0x400
|
||||
#define AQH_MSGTYPE_IPC_NODES_GETDEVICES_REQ 0x500
|
||||
#define AQH_MSGTYPE_IPC_NODES_GETDEVICES_RSP 0x600
|
||||
#define AQH_MSGTYPE_IPC_NODES_FORWARD 0xf100
|
||||
#define AQH_MSGTYPE_IPC_NODES_VALUE 0xf200
|
||||
#define AQH_MSGTYPE_IPC_NODES_PING 0xf300
|
||||
#define AQH_MSGTYPE_IPC_NODES_SETACCMSGGRPS 0xf400
|
||||
#define AQH_MSGTYPE_IPC_NODES_GETDEVICES_REQ 0xf500
|
||||
#define AQH_MSGTYPE_IPC_NODES_GETDEVICES_RSP 0xf600
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -30,9 +30,11 @@
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_ForwardIpcMsg_new(uint16_t code, const uint8_t *ptr, uint32_t len)
|
||||
GWEN_MSG *AQH_ForwardIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
const uint8_t *ptr, uint32_t len)
|
||||
{
|
||||
return GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, len, ptr);
|
||||
return GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, msgId, refMsgId, len, ptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_ForwardIpcMsg_new(uint16_t code, const uint8_t *ptr, uint32_t len);
|
||||
AQHOME_API GWEN_MSG *AQH_ForwardIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId, const uint8_t *ptr, uint32_t len);
|
||||
AQHOME_API const uint8_t *AQH_ForwardIpcMsg_GetMsgPtr(const GWEN_MSG *msg);
|
||||
AQHOME_API uint32_t AQH_ForwardIpcMsg_GetMsgLen(const GWEN_MSG *msg);
|
||||
AQHOME_API GWEN_MSG *AQH_ForwardIpcMsg_GetCopyOfNodeMsg(const GWEN_MSG *msg);
|
||||
|
||||
@@ -23,14 +23,16 @@
|
||||
#include <gwenhywfar/msg_ipc.h>
|
||||
|
||||
|
||||
#define AQH_MSGIPC_GETDEVICES_REQ_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD)
|
||||
#define AQH_MSGIPC_GETDEVICES_REQ_PAYLOADSIZE 0
|
||||
#define AQH_MSGIPC_GETDEVICES_REQ_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_REQ_PAYLOADSIZE)
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_GetDevicesRequestIpcMsg_new(uint16_t code)
|
||||
GWEN_MSG *AQH_GetDevicesRequestIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId)
|
||||
{
|
||||
return GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_GETDEVICES_REQ_MINSIZE, NULL);
|
||||
return GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code,
|
||||
msgId, refMsgId, AQH_MSGIPC_GETDEVICES_REQ_PAYLOADSIZE, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,10 +41,13 @@ void AQH_GetDevicesRequestIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *
|
||||
{
|
||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSGIPC_GETDEVICES_REQ_MINSIZE) {
|
||||
GWEN_Buffer_AppendArgs(dbuf,
|
||||
"GET_DEVICES REQ (code=%d, proto=%d, proto version=%d)\n",
|
||||
"GET_DEVICES REQ %s (code=%d, proto=%d, proto version=%d, msgId=%d, refMsgId=%d)\n",
|
||||
sText?sText:"",
|
||||
GWEN_IpcMsg_GetCode(msg),
|
||||
GWEN_IpcMsg_GetProtoId(msg),
|
||||
GWEN_IpcMsg_GetProtoVersion(msg));
|
||||
GWEN_IpcMsg_GetProtoVersion(msg),
|
||||
GWEN_IpcMsg_GetMsgId(msg),
|
||||
GWEN_IpcMsg_GetRefMsgId(msg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <gwenhywfar/buffer.h>
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_GetDevicesRequestIpcMsg_new(uint16_t code);
|
||||
AQHOME_API GWEN_MSG *AQH_GetDevicesRequestIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId);
|
||||
|
||||
AQHOME_API void AQH_GetDevicesRequestIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||
|
||||
|
||||
@@ -42,39 +42,31 @@
|
||||
#define AQH_MSGIPC_GETDEVICES_RSP_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_IO+2)
|
||||
|
||||
|
||||
static void _addU16t(uint8_t **pPtr, uint16_t i);
|
||||
static void _addU32t(uint8_t **pPtr, uint32_t i);
|
||||
static void _addU64t(uint8_t **pPtr, uint64_t i);
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_GetDevicesResponseIpcMsg_new(uint16_t code, uint8_t flags, const AQH_NODE_INFO *ni)
|
||||
GWEN_MSG *AQH_GetDevicesResponseIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId, uint8_t flags, const AQH_NODE_INFO *ni)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
uint8_t *ptr;
|
||||
const GWEN_TIMESTAMP *t;
|
||||
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_GETDEVICES_RSP_MINSIZE, NULL);
|
||||
ptr=GWEN_Msg_GetBuffer(msg)+GWEN_MSGIPC_OFFS_PAYLOAD;
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, msgId, refMsgId, 0, NULL);
|
||||
GWEN_Msg_AddUint8(msg, flags & 0xff);
|
||||
GWEN_Msg_AddUint8(msg, AQH_NodeInfo_GetBusAddress(ni));
|
||||
GWEN_Msg_AddUint32(msg, AQH_NodeInfo_GetUid(ni));
|
||||
|
||||
*(ptr++)=flags & 0xff;
|
||||
|
||||
*(ptr++)=AQH_NodeInfo_GetBusAddress(ni);
|
||||
_addU32t(&ptr, AQH_NodeInfo_GetUid(ni));
|
||||
|
||||
_addU32t(&ptr, AQH_NodeInfo_GetManufacturer(ni));
|
||||
_addU16t(&ptr, AQH_NodeInfo_GetDeviceType(ni));
|
||||
_addU16t(&ptr, AQH_NodeInfo_GetDeviceVersion(ni));
|
||||
_addU32t(&ptr, AQH_NodeInfo_GetFirmwareVersion(ni));
|
||||
GWEN_Msg_AddUint32(msg, AQH_NodeInfo_GetManufacturer(ni));
|
||||
GWEN_Msg_AddUint16(msg, AQH_NodeInfo_GetDeviceType(ni));
|
||||
GWEN_Msg_AddUint16(msg, AQH_NodeInfo_GetDeviceVersion(ni));
|
||||
GWEN_Msg_AddUint32(msg, AQH_NodeInfo_GetFirmwareVersion(ni));
|
||||
t=AQH_NodeInfo_GetTimestampLastChange(ni);
|
||||
_addU64t(&ptr, t?((uint64_t)GWEN_Timestamp_toInt64(t)):0L);
|
||||
GWEN_Msg_AddUint64(msg, t?((uint64_t)GWEN_Timestamp_toInt64(t)):0L);
|
||||
|
||||
_addU16t(&ptr, AQH_NodeInfo_GetStatsPacketsOut(ni));
|
||||
_addU16t(&ptr, AQH_NodeInfo_GetStatsPacketsIn(ni));
|
||||
_addU16t(&ptr, AQH_NodeInfo_GetStatsCollisions(ni));
|
||||
_addU16t(&ptr, AQH_NodeInfo_GetStatsBusy(ni));
|
||||
_addU16t(&ptr, AQH_NodeInfo_GetStatsCrcErrors(ni));
|
||||
_addU16t(&ptr, AQH_NodeInfo_GetStatsIoErrors(ni));
|
||||
GWEN_Msg_AddUint16(msg, AQH_NodeInfo_GetStatsPacketsOut(ni));
|
||||
GWEN_Msg_AddUint16(msg, AQH_NodeInfo_GetStatsPacketsIn(ni));
|
||||
GWEN_Msg_AddUint16(msg, AQH_NodeInfo_GetStatsCollisions(ni));
|
||||
GWEN_Msg_AddUint16(msg, AQH_NodeInfo_GetStatsBusy(ni));
|
||||
GWEN_Msg_AddUint16(msg, AQH_NodeInfo_GetStatsCrcErrors(ni));
|
||||
GWEN_Msg_AddUint16(msg, AQH_NodeInfo_GetStatsIoErrors(ni));
|
||||
GWEN_IpcMsg_AdjustMsgSize(msg);
|
||||
|
||||
return msg;
|
||||
}
|
||||
@@ -132,11 +124,7 @@ uint32_t AQH_GetDevicesResponseIpcMsg_GetFirmwareVersion(const GWEN_MSG *msg)
|
||||
|
||||
int64_t AQH_GetDevicesResponseIpcMsg_GetTimestamp(const GWEN_MSG *msg)
|
||||
{
|
||||
uint64_t v;
|
||||
|
||||
v=(uint64_t) GWEN_Msg_GetUint32At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_LASTCHG, 0);
|
||||
v|=((uint64_t)GWEN_Msg_GetUint32At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_LASTCHG+4, 0))<<32;
|
||||
return (int64_t) v;
|
||||
return GWEN_Msg_GetUint64At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_LASTCHG, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -199,49 +187,3 @@ void AQH_GetDevicesResponseIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _addU16t(uint8_t **pPtr, uint16_t i)
|
||||
{
|
||||
uint8_t *ptr=*pPtr;
|
||||
|
||||
*(ptr++)=i & 0xff;
|
||||
*(ptr++)=(i>>8) & 0xff;
|
||||
*pPtr=ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _addU32t(uint8_t **pPtr, uint32_t i)
|
||||
{
|
||||
uint8_t *ptr=*pPtr;
|
||||
|
||||
*(ptr++)=i & 0xff;
|
||||
*(ptr++)=(i>>8) & 0xff;
|
||||
*(ptr++)=(i>>16) & 0xff;
|
||||
*(ptr++)=(i>>24) & 0xff;
|
||||
*pPtr=ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _addU64t(uint8_t **pPtr, uint64_t i)
|
||||
{
|
||||
uint8_t *ptr=*pPtr;
|
||||
|
||||
*(ptr++)=i & 0xff;
|
||||
*(ptr++)=(i>>8) & 0xff;
|
||||
*(ptr++)=(i>>16) & 0xff;
|
||||
*(ptr++)=(i>>24) & 0xff;
|
||||
*(ptr++)=(i>>32) & 0xff;
|
||||
*(ptr++)=(i>>40) & 0xff;
|
||||
*(ptr++)=(i>>48) & 0xff;
|
||||
*(ptr++)=(i>>56) & 0xff;
|
||||
*pPtr=ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
#define AQH_MSGIPC_GETDEVICES_RSP_FLAGS_LAST 0x01
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_GetDevicesResponseIpcMsg_new(uint16_t code, uint8_t flags, const AQH_NODE_INFO *ni);
|
||||
AQHOME_API GWEN_MSG *AQH_GetDevicesResponseIpcMsg_new(uint16_t code,
|
||||
uint32_t msgId, uint32_t refMsgId,
|
||||
uint8_t flags, const AQH_NODE_INFO *ni);
|
||||
|
||||
AQHOME_API uint8_t AQH_GetDevicesResponseIpcMsg_GetFlags(const GWEN_MSG *msg);
|
||||
AQHOME_API uint8_t AQH_GetDevicesResponseIpcMsg_GetBusAddress(const GWEN_MSG *msg);
|
||||
|
||||
@@ -25,17 +25,20 @@
|
||||
|
||||
#define AQH_MSGIPC_PING_OFFS_DESTADDR 0 /* 1 bytes */
|
||||
|
||||
#define AQH_MSGIPC_PING_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+1)
|
||||
#define AQH_MSGIPC_PING_PAYLOADSIZE 1
|
||||
#define AQH_MSGIPC_PING_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_PING_PAYLOADSIZE)
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_PingIpcMsg_new(uint16_t code, uint8_t destAddr)
|
||||
GWEN_MSG *AQH_PingIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId, uint8_t destAddr)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
uint8_t *ptr;
|
||||
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_PING_MINSIZE, NULL);
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code,
|
||||
msgId, refMsgId,
|
||||
AQH_MSGIPC_PING_PAYLOADSIZE, NULL);
|
||||
ptr=GWEN_Msg_GetBuffer(msg);
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_PING_OFFS_DESTADDR]=destAddr & 0xff;
|
||||
|
||||
@@ -55,7 +58,8 @@ void AQH_PingIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const c
|
||||
{
|
||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSGIPC_PING_MINSIZE) {
|
||||
GWEN_Buffer_AppendArgs(dbuf,
|
||||
"PING (code=%d, proto=%d, proto version=%d, dest addr=%02x)\n",
|
||||
"PING %s (code=%d, proto=%d, proto version=%d, dest addr=%02x)\n",
|
||||
sText?sText:"",
|
||||
GWEN_IpcMsg_GetCode(msg),
|
||||
GWEN_IpcMsg_GetProtoId(msg),
|
||||
GWEN_IpcMsg_GetProtoVersion(msg),
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <gwenhywfar/buffer.h>
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_PingIpcMsg_new(uint16_t code, uint8_t destAddr);
|
||||
AQHOME_API GWEN_MSG *AQH_PingIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId, uint8_t destAddr);
|
||||
|
||||
AQHOME_API uint8_t AQH_PingIpcMsg_GetDestAddr(const GWEN_MSG *msg);
|
||||
|
||||
|
||||
@@ -25,23 +25,21 @@
|
||||
|
||||
#define AQH_MSGIPC_SETACCEPTEDMSGGRPS_OFFS_GROUPS 0 /* 4 bytes */
|
||||
|
||||
#define AQH_MSGIPC_SETACCEPTEDMSGGRPS_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+4)
|
||||
#define AQH_MSGIPC_SETACCEPTEDMSGGRPS_PAYLOADSIZE (AQH_MSGIPC_SETACCEPTEDMSGGRPS_OFFS_GROUPS+4)
|
||||
#define AQH_MSGIPC_SETACCEPTEDMSGGRPS_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_SETACCEPTEDMSGGRPS_PAYLOADSIZE)
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_SetAcceptedMsgGroupsIpcMsg_new(uint16_t code, uint32_t groups)
|
||||
GWEN_MSG *AQH_SetAcceptedMsgGroupsIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId, uint32_t groups)
|
||||
{
|
||||
GWEN_MSG *msg;
|
||||
uint8_t *ptr;
|
||||
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_SETACCEPTEDMSGGRPS_MINSIZE, NULL);
|
||||
ptr=GWEN_Msg_GetBuffer(msg);
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_SETACCEPTEDMSGGRPS_OFFS_GROUPS+0]=groups & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_SETACCEPTEDMSGGRPS_OFFS_GROUPS+1]=(groups>>8) & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_SETACCEPTEDMSGGRPS_OFFS_GROUPS+2]=(groups>>16) & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_SETACCEPTEDMSGGRPS_OFFS_GROUPS+3]=(groups>>24) & 0xff;
|
||||
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code,
|
||||
msgId, refMsgId,
|
||||
AQH_MSGIPC_SETACCEPTEDMSGGRPS_PAYLOADSIZE, NULL);
|
||||
GWEN_Msg_AddUint32(msg, groups);
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -68,5 +66,3 @@ void AQH_SetAcceptedMsgGroupsIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <gwenhywfar/buffer.h>
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_SetAcceptedMsgGroupsIpcMsg_new(uint16_t code, uint32_t groups);
|
||||
AQHOME_API GWEN_MSG *AQH_SetAcceptedMsgGroupsIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId, uint32_t groups);
|
||||
|
||||
AQHOME_API uint32_t AQH_SetAcceptedMsgGroupsIpcMsg_GetMsgGroups(const GWEN_MSG *msg);
|
||||
|
||||
|
||||
@@ -29,12 +29,13 @@
|
||||
#define AQH_MSGIPC_VALUE_OFFS_VALUE_NOM 6 /* 2 bytes */
|
||||
#define AQH_MSGIPC_VALUE_OFFS_VALUE_DENOM 8 /* 2 bytes */
|
||||
|
||||
#define AQH_MSGIPC_VALUE_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+10)
|
||||
#define AQH_MSGIPC_VALUE_PAYLOADIZE (AQH_MSGIPC_VALUE_OFFS_UID+10)
|
||||
#define AQH_MSGIPC_VALUE_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_PAYLOADIZE)
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG *AQH_ValueIpcMsg_new(uint16_t code,
|
||||
GWEN_MSG *AQH_ValueIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t uid,
|
||||
uint8_t valueId,
|
||||
uint8_t valueType,
|
||||
@@ -44,21 +45,13 @@ GWEN_MSG *AQH_ValueIpcMsg_new(uint16_t code,
|
||||
GWEN_MSG *msg;
|
||||
uint8_t *ptr;
|
||||
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_VALUE_MINSIZE, NULL);
|
||||
ptr=GWEN_Msg_GetBuffer(msg);
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_UID+0]=uid & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_UID+1]=(uid>>8) & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_UID+2]=(uid>>16) & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_UID+3]=(uid>>24) & 0xff;
|
||||
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_VALUEID]=valueId;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_VALUETYPE]=valueType;
|
||||
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_VALUE_NOM+0]=valueNom & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_VALUE_NOM+1]=(valueNom>>8) & 0xff;
|
||||
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_VALUE_DENOM+0]=valueDenom & 0xff;
|
||||
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_VALUE_DENOM+1]=(valueDenom>>8) & 0xff;
|
||||
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code,
|
||||
msgId, refMsgId, AQH_MSGIPC_VALUE_PAYLOADIZE, NULL);
|
||||
GWEN_Msg_AddUint32(msg, uid);
|
||||
GWEN_Msg_AddUint8(msg, valueId);
|
||||
GWEN_Msg_AddUint8(msg, valueType);
|
||||
GWEN_Msg_AddUint16(msg, valueNom);
|
||||
GWEN_Msg_AddUint16(msg, valueDenom);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_ValueIpcMsg_new(uint16_t code,
|
||||
AQHOME_API GWEN_MSG *AQH_ValueIpcMsg_new(uint16_t code, uint32_t msgId, uint32_t refMsgId,
|
||||
uint32_t uid,
|
||||
uint8_t valueId,
|
||||
uint8_t valueType,
|
||||
|
||||
@@ -141,13 +141,25 @@ void AQH_NodeDb_fromDb(AQH_NODE_DB *ndb, GWEN_DB_NODE *dbDatabase)
|
||||
GWEN_DB_NODE *dbNodeInfo;
|
||||
|
||||
AQH_NodeInfo_List_Clear(ndb->nodeList);
|
||||
|
||||
dbNodeInfo=GWEN_DB_FindFirstGroup(dbDatabase, "nodeinfo");
|
||||
while(dbNodeInfo) {
|
||||
AQH_NODE_INFO *ni;
|
||||
|
||||
ni=AQH_NodeInfo_fromDb(dbNodeInfo);
|
||||
if (ni)
|
||||
if (ni) {
|
||||
const char *deviceId;
|
||||
|
||||
deviceId=AQH_NodeInfo_GetDeviceId(ni);
|
||||
DBG_ERROR(AQH_LOGDOMAIN,
|
||||
"Adding node %08x (%s, %04x:%02x:%04x)",
|
||||
AQH_NodeInfo_GetUid(ni),
|
||||
deviceId?deviceId:"<no device id>",
|
||||
AQH_NodeInfo_GetManufacturer(ni),
|
||||
AQH_NodeInfo_GetDeviceType(ni),
|
||||
AQH_NodeInfo_GetDeviceVersion(ni));
|
||||
AQH_NodeInfo_List_Add(ni, ndb->nodeList);
|
||||
}
|
||||
|
||||
dbNodeInfo=GWEN_DB_FindNextGroup(dbNodeInfo, "nodeinfo");
|
||||
}
|
||||
|
||||
@@ -31,6 +31,13 @@
|
||||
|
||||
|
||||
<members>
|
||||
|
||||
<member name="deviceId" type="char_ptr" maxlen="128">
|
||||
<default>NULL</default>
|
||||
<preset>NULL</preset>
|
||||
<access>public</access>
|
||||
<flags>own</flags>
|
||||
</member>
|
||||
|
||||
<member name="busAddress" type="uint8_t" maxlen="8">
|
||||
<default>0</default>
|
||||
|
||||
Reference in New Issue
Block a user