102 lines
3.1 KiB
C
102 lines
3.1 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.
|
|
****************************************************************************/
|
|
|
|
#ifndef AQH_MSG_NODE_H
|
|
#define AQH_MSG_NODE_H
|
|
|
|
|
|
#include <aqhome/api.h>
|
|
|
|
#include <gwenhywfar/msg.h>
|
|
#include <gwenhywfar/buffer.h>
|
|
|
|
|
|
#define AQH_MAXMSGSIZE 128
|
|
|
|
|
|
#define AQH_MSG_OFFS_ALL_DEST_ADDRESS 0
|
|
#define AQH_MSG_OFFS_ALL_PAYLOAD_LEN 1
|
|
#define AQH_MSG_OFFS_ALL_PAYLOAD_BEGIN 2
|
|
#define AQH_MSG_OFFS_ALL_MSG_TYPE 2
|
|
#define AQH_MSG_OFFS_ALL_SRC_ADDRESS 3
|
|
#define AQH_MSG_OFFS_ALL_DATA_BEGIN 4
|
|
|
|
|
|
#define AQH_MSG_TYPE_PING 10
|
|
#define AQH_MSG_TYPE_PONG 11
|
|
#define AQH_MSG_TYPE_COMSENDSTATS 20
|
|
#define AQH_MSG_TYPE_COMRECVSTATS 21
|
|
#define AQH_MSG_TYPE_TWIBUSMEMBER 30
|
|
#define AQH_MSG_TYPE_DEBUG 40
|
|
#define AQH_MSG_TYPE_VALUE 50
|
|
#define AQH_MSG_TYPE_VALUE2 51
|
|
#define AQH_MSG_TYPE_NEED_ADDRESS 60
|
|
#define AQH_MSG_TYPE_HAVE_ADDRESS 61
|
|
#define AQH_MSG_TYPE_CLAIM_ADDRESS 62
|
|
#define AQH_MSG_TYPE_DENY_ADDRESS 63
|
|
#define AQH_MSG_TYPE_ADDRESS_RANGE 64
|
|
|
|
#define AQH_MSG_TYPE_FLASH_START 70
|
|
#define AQH_MSG_TYPE_FLASH_END 71
|
|
#define AQH_MSG_TYPE_FLASH_READY 72
|
|
#define AQH_MSG_TYPE_FLASH_DATA 73
|
|
#define AQH_MSG_TYPE_FLASH_RSP 74
|
|
|
|
#define AQH_MSG_TYPE_DEVICE 80
|
|
#define AQH_MSG_TYPE_MEMSTATS 81
|
|
#define AQH_MSG_TYPE_SYSSTATS 82
|
|
|
|
#define AQH_MSG_TYPE_REBOOT_REQ 90
|
|
#define AQH_MSG_TYPE_REBOOT_RSP 91
|
|
|
|
|
|
/* internal msg types via NET interface */
|
|
#define AQH_MSG_TYPE_NET_SET_ACCEPTED_MSGGROUPS 200
|
|
|
|
|
|
#define AQH_MSG_TYPEGROUP_INFO 0x00000001
|
|
#define AQH_MSG_TYPEGROUP_VALUES 0x00000002
|
|
#define AQH_MSG_TYPEGROUP_ADDRESS 0x00000004
|
|
#define AQH_MSG_TYPEGROUP_FLASH 0x00000008
|
|
#define AQH_MSG_TYPEGROUP_ADMIN 0x00000010
|
|
#define AQH_MSG_TYPEGROUP_ALL 0xffffffff
|
|
|
|
|
|
#define AQH_MSG_MODULES_MASK_TIMER 0x02
|
|
#define AQH_MSG_MODULES_MASK_COM 0x04
|
|
#define AQH_MSG_MODULES_MASK_LED 0x08
|
|
#define AQH_MSG_MODULES_MASK_TWIMASTER 0x10
|
|
#define AQH_MSG_MODULES_MASK_LCD 0x20
|
|
#define AQH_MSG_MODULES_MASK_SI7021 0x40
|
|
#define AQH_MSG_MODULES_MASK_STATS 0x80
|
|
|
|
|
|
|
|
AQHOME_API GWEN_MSG *AQH_NodeMsg_new(uint8_t destAddr, uint8_t srcAddr, uint8_t code, uint8_t payloadLen, const uint8_t *payload);
|
|
|
|
|
|
AQHOME_API uint8_t AQH_NodeMsg_GetDestAddress(const GWEN_MSG *msg);
|
|
AQHOME_API uint8_t AQH_NodeMsg_GetMsgType(const GWEN_MSG *msg);
|
|
AQHOME_API uint8_t AQH_NodeMsg_GetSourceAddress(const GWEN_MSG *msg);
|
|
AQHOME_API uint8_t AQH_NodeMsg_GetMsgPayloadLen(const GWEN_MSG *msg);
|
|
|
|
|
|
|
|
AQHOME_API int AQH_NodeMsg_IsMsgComplete(const GWEN_MSG *msg);
|
|
AQHOME_API int AQH_NodeMsg_IsChecksumValid(const GWEN_MSG *msg);
|
|
AQHOME_API int AQH_NodeMsg_AddChecksum(GWEN_MSG *msg);
|
|
|
|
AQHOME_API void AQH_NodeMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
|
|
|
AQHOME_API uint32_t AQH_NodeMsg_GetMsgGroup(uint8_t msgType);
|
|
|
|
AQHOME_API const char *AQH_NodeMsg_MsgTypeToChar(uint8_t i);
|
|
|
|
|
|
#endif
|