/**************************************************************************** * 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. ****************************************************************************/ #ifdef HAVE_CONFIG_H # include #endif #include "aqhome/msg/msg_denyaddr.h" #include #include #include #include #define AQH_MSG_OFFS_DENYADDR_UID 0 #define AQH_MSG_OFFS_DENYADDR_ADDR 4 #define AQH_MSG_DENYADDR_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DENYADDR_ADDR+1) uint32_t AQH_DenyAddrMsg_GetUid(const GWEN_MSG *msg) { return GWEN_Msg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DENYADDR_UID, 0); } uint8_t AQH_DenyAddrMsg_GetAddress(const GWEN_MSG *msg) { return GWEN_Msg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DENYADDR_ADDR, 0); } void AQH_DenyAddrMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText) { if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_DENY_ADDRESS) && (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DENYADDR_MINSIZE)) { GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: DENY_ADDRESS %s (uid=0x%08x, address=0x%02x)\n", AQH_NodeMsg_GetSourceAddress(msg), AQH_NodeMsg_GetDestAddress(msg), sText, (unsigned int) AQH_DenyAddrMsg_GetUid(msg), AQH_DenyAddrMsg_GetAddress(msg)); } }