51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
/****************************************************************************
|
|
* 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 <config.h>
|
|
#endif
|
|
|
|
#include "aqhome/msg/msg_flashresponse.h"
|
|
|
|
#include <gwenhywfar/misc.h>
|
|
#include <gwenhywfar/list.h>
|
|
#include <gwenhywfar/error.h>
|
|
#include <gwenhywfar/debug.h>
|
|
|
|
|
|
#define AQH_MSG_OFFS_FLASHRESPONSE_CODE 0 /* 1 byte */
|
|
|
|
#define AQH_MSG_FLASHRESPONSE_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_FLASHRESPONSE_CODE+1)
|
|
|
|
|
|
|
|
uint8_t AQH_FlashResponseMsg_GetCode(const GWEN_MSG *msg)
|
|
{
|
|
return GWEN_Msg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_FLASHRESPONSE_CODE, 0);
|
|
}
|
|
|
|
|
|
|
|
void AQH_FlashResponseMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
|
|
{
|
|
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_FLASHRESPONSE_MINSIZE) {
|
|
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: FLASHRESPONSE %s (code=%d)\n",
|
|
AQH_NodeMsg_GetSourceAddress(msg),
|
|
AQH_NodeMsg_GetDestAddress(msg),
|
|
sText,
|
|
AQH_FlashResponseMsg_GetCode(msg));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|