added msg "getValues"
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
m_ipcd_values.h
|
||||
m_ipcd_getdata.h
|
||||
m_ipcd_setdata.h
|
||||
m_ipcd_getvalues.h
|
||||
</headers>
|
||||
|
||||
|
||||
@@ -67,6 +68,7 @@
|
||||
m_ipcd_values.c
|
||||
m_ipcd_getdata.c
|
||||
m_ipcd_setdata.c
|
||||
m_ipcd_getvalues.c
|
||||
</sources>
|
||||
|
||||
|
||||
|
||||
81
aqhome/msg/ipc/data/m_ipcd_getvalues.c
Normal file
81
aqhome/msg/ipc/data/m_ipcd_getvalues.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqHome.
|
||||
* AqHome (c) by 2025 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "aqhome/msg/ipc/data/m_ipcd_getvalues.h"
|
||||
#include "aqhome/msg/ipc/m_ipc_tag16.h"
|
||||
#include "aqhome/msg/ipc/data/m_ipcd.h"
|
||||
#include "aqhome/msg/ipc/m_ipc.h"
|
||||
|
||||
#include <gwenhywfar/text.h>
|
||||
#include <gwenhywfar/tag16.h>
|
||||
#include <gwenhywfar/buffer.h>
|
||||
#include <gwenhywfar/debug.h>
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* forward declarations
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* implementation
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
AQH_MESSAGE *AQH_IpcdMessageGetValues_new(uint16_t code, uint32_t msgId, uint32_t refMsgId,
|
||||
const char *deviceName, int modality)
|
||||
{
|
||||
AQH_MESSAGE *msg;
|
||||
GWEN_BUFFER *buf;
|
||||
|
||||
buf=GWEN_Buffer_new(0, 256, 0, 1);
|
||||
|
||||
if (deviceName && *deviceName)
|
||||
GWEN_Tag16_WriteStringTagToBuffer(AQH_MSGDATA_GETVALUES_TAGS_DEVICENAME, deviceName, buf);
|
||||
GWEN_Tag16_WriteUint64TagToBuffer(AQH_MSGDATA_GETVALUES_TAGS_MODALITY, modality, buf);
|
||||
|
||||
msg=AQH_IpcMessage_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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQH_IpcdMessageGetValues_DumpToBuffer(const AQH_MESSAGE *msg, const GWEN_TAG16_LIST *tagList,
|
||||
GWEN_BUFFER *dbuf, const char *sText)
|
||||
{
|
||||
char *deviceName;
|
||||
uint64_t modality;
|
||||
|
||||
deviceName=tagList?AQH_Tag16_GetTagDataAsNewString(tagList, AQH_MSGDATA_GETVALUES_TAGS_DEVICENAME, NULL):NULL;
|
||||
modality=tagList?AQH_Tag16_GetTagDataAsUint64(tagList, AQH_MSGDATA_GETVALUES_TAGS_MODALITY, 0):0;
|
||||
|
||||
GWEN_Buffer_AppendArgs(dbuf,
|
||||
"GETVALUES(%s) %s (code=%d, proto=%d, proto version=%d, device=%s, modality=%s)\n",
|
||||
AQH_IpcdMessage_MsgTypeToChar(AQH_IpcMessage_GetCode(msg)),
|
||||
sText?sText:"",
|
||||
AQH_IpcMessage_GetCode(msg),
|
||||
AQH_IpcMessage_GetProtoId(msg),
|
||||
AQH_IpcMessage_GetProtoVersion(msg),
|
||||
deviceName?deviceName:"<empty>",
|
||||
AQH_ValueModality_toString(modality));
|
||||
free(deviceName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
36
aqhome/msg/ipc/data/m_ipcd_getvalues.h
Normal file
36
aqhome/msg/ipc/data/m_ipcd_getvalues.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqHome.
|
||||
* AqHome (c) by 2025 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQH_M_IPCD_GETVALUES_H
|
||||
#define AQH_M_IPCD_GETVALUES_H
|
||||
|
||||
|
||||
|
||||
#include <aqhome/api.h>
|
||||
#include <aqhome/ipc2/message.h>
|
||||
#include <aqhome/data/value.h>
|
||||
|
||||
#include <gwenhywfar/tag16.h>
|
||||
#include <gwenhywfar/buffer.h>
|
||||
|
||||
|
||||
|
||||
#define AQH_MSGDATA_GETVALUES_TAGS_DEVICENAME 0x0001
|
||||
#define AQH_MSGDATA_GETVALUES_TAGS_MODALITY 0x0002
|
||||
|
||||
|
||||
|
||||
AQHOME_API AQH_MESSAGE *AQH_IpcdMessageGetValues_new(uint16_t code, uint32_t msgId, uint32_t refMsgId,
|
||||
const char *deviceName, int modality);
|
||||
|
||||
AQHOME_API void AQH_IpcdMessageGetValues_DumpToBuffer(const AQH_MESSAGE *msg, const GWEN_TAG16_LIST *tagList,
|
||||
GWEN_BUFFER *dbuf, const char *sText);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user