/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2023 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_MSG_IPC_DATA_DEVICES_H
#define AQH_MSG_IPC_DATA_DEVICES_H


#include <aqhome/api.h>

#include <aqhome/data/device.h>

#include <gwenhywfar/msg_ipc.h>


/**
 * This message is used in request AQH_MSGTYPE_IPC_DATA_ADDDEVICES_REQ and in response AQH_MSGTYPE_IPC_DATA_GETDEVICES_RSP.
 */

#define AQH_MSGDATA_DEVICES_FLAGS_LASTMSG 0x0001

#define AQH_MSGDATA_DEVICES_TAGS_FLAGS    0x01
#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 void AQH_DevicesDataIpcMsg_Parse(GWEN_MSG *msg, int doCopy);

AQHOME_API AQH_DEVICE_LIST *AQH_DevicesDataIpcMsg_ReadDeviceList(const GWEN_MSG *msg);
AQHOME_API AQH_DEVICE *AQH_DevicesDataIpcMsg_ReadFirstDevice(const GWEN_MSG *msg);


AQHOME_API uint32_t AQH_DevicesDataIpcMsg_GetFlags(const GWEN_MSG *msg);

AQHOME_API void AQH_DevicesDataIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);







#endif



