; ***************************************************************************
; copyright   : (C) 2026 by Martin Preuss
; email       : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome".                              *
; * Please see toplevel file COPYING of that project for license details.   *
; ***************************************************************************

#ifndef AQH_AVR_NETWORK_MSG_DEFS_ASM
#define AQH_AVR_NETWORK_MSG_DEFS_ASM



; ---------------------------------------------------------------------------
; command values

.equ NETMSG_CMD_PING                   = 10
.equ NETMSG_CMD_PONG                   = 11
.equ NETMSG_CMD_HEARTBEAT              = 12
.equ NETMSG_CMD_SENDSTATS              = 22
.equ NETMSG_CMD_RECVSTATS              = 23
.equ NETMSG_CMD_TWIBUSMEMBER           = 30
.equ NETMSG_CMD_DEBUG                  = 40

.equ NETMSG_CMD_RESULT                 = 50

.equ NETMSG_CMD_NEED_ADDRESS           = 60
.equ NETMSG_CMD_HAVE_ADDRESS           = 61
.equ NETMSG_CMD_CLAIM_ADDRESS          = 62
.equ NETMSG_CMD_DENY_ADDRESS           = 63
.equ NETMSG_CMD_ADDRESS_RANGE          = 64
.equ NETMSG_CMD_REENUM                 = 65

.equ NETMSG_CMD_FLASH_START            = 70
.equ NETMSG_CMD_FLASH_END              = 71
.equ NETMSG_CMD_FLASH_READY            = 72
.equ NETMSG_CMD_FLASH_DATA             = 73
.equ NETMSG_CMD_FLASH_RSP              = 74

.equ NETMSG_CMD_DEVICE                 = 80
.equ NETMSG_CMD_MEMSTATS               = 81
.equ NETMSG_CMD_SYSSTATS               = 82

.equ NETMSG_CMD_REBOOT_REQUEST         = 90
.equ NETMSG_CMD_REBOOT_RESPONSE        = 91

.equ NETMSG_CMD_VALUE_REPORT           = 100
.equ NETMSG_CMD_VALUE_SET              = 101
.equ NETMSG_CMD_VALUE_SET_ACK          = 102
.equ NETMSG_CMD_VALUE_SET_NACK         = 103

.equ NETMSG_CMD_DATA                   = 110

.equ NETMSG_CMD_TIME_ANNOUNCE          = 120
.equ NETMSG_CMD_TIME_REQSET            = 121
.equ NETMSG_CMD_TIME_RSPSET            = 122



; ---------------------------------------------------------------------------
; position definitions for all messages

.equ NETMSG_OFFS_DESTADDR        = 0
.equ NETMSG_OFFS_MSGLEN          = 1
.equ NETMSG_OFFS_MSGDATA         = 2
.equ NETMSG_OFFS_CMD             = 2 ; first at NETMSG_OFFS_MSGDATA
.equ NETMSG_OFFS_SRCADDR         = 3
.equ NETMSG_OFFS_PAYLOAD         = 4 ; payload for the cmd follows here

.equ NETMSG_CRC8_POLYNOMIAL      = 0x97 ; HD=4 up to 119 bytes, e.g. detects all 1 to 3 bit errors



; ---------------------------------------------------------------------------
; special addresses

.equ NET_MAINTENANCE_ADDR               = 0xc1



#endif


