Ares Packet API.
More...
#include <zephyr/kernel.h>
Go to the source code of this file.
◆ ARES_PACKET_BROADCAST_OVERHEAD
| #define ARES_PACKET_BROADCAST_OVERHEAD |
Value:
#define ARES_PACKET_ID_OVERHEAD
Definition packet.h:54
#define ARES_PACKET_SEQ_CNT_OVERHEAD
Definition packet.h:59
#define ARES_PACKET_PAYLOAD_TYPE_OVERHEAD
Definition packet.h:79
#define ARES_PACKET_SRC_ID_OVERHEAD
Definition packet.h:69
#define ARES_PACKET_LEN_OVERHEAD
Definition packet.h:44
#define ARES_PACKET_CRC_OVERHEAD
Definition packet.h:84
#define ARES_PACKET_TYPE_OVERHEAD
Definition packet.h:49
#define ARES_PACKET_HEADER_OVERHEAD
Definition packet.h:39
#define ARES_PACKET_FOOTER_OVERHEAD
Definition packet.h:89
#define ARES_PACKET_PAN_ID_OVERHEAD
Definition packet.h:64
Number of bytes needed for a broadcast packet.
◆ ARES_PACKET_CRC_OVERHEAD
| #define ARES_PACKET_CRC_OVERHEAD 2 |
Number of bytes needed for the CRC16 field.
◆ ARES_PACKET_DIRECT_OVERHEAD
Number of bytes needed for a directed packet.
◆ ARES_PACKET_DST_ID_OVERHEAD
| #define ARES_PACKET_DST_ID_OVERHEAD 2 |
Number of bytes needed for the destination ID field.
◆ ARES_PACKET_FOOTER_0
| #define ARES_PACKET_FOOTER_0 'E' |
First byte in the footer.
◆ ARES_PACKET_FOOTER_1
| #define ARES_PACKET_FOOTER_1 'S' |
Second byte in the footer.
◆ ARES_PACKET_FOOTER_OVERHEAD
| #define ARES_PACKET_FOOTER_OVERHEAD 2 |
Number of bytes needed for the footer field.
◆ ARES_PACKET_HEADER_0
| #define ARES_PACKET_HEADER_0 'A' |
First byte in the header.
◆ ARES_PACKET_HEADER_1
| #define ARES_PACKET_HEADER_1 'R' |
Second byte in the header.
◆ ARES_PACKET_HEADER_OVERHEAD
| #define ARES_PACKET_HEADER_OVERHEAD 2 |
Number of bytes needed for the header field.
◆ ARES_PACKET_ID_OVERHEAD
| #define ARES_PACKET_ID_OVERHEAD 2 |
Number of bytes needed for the packet ID field.
◆ ARES_PACKET_LEN_OVERHEAD
| #define ARES_PACKET_LEN_OVERHEAD 2 |
Number of bytes needed for the length field.
◆ ARES_PACKET_PAN_ID_OVERHEAD
| #define ARES_PACKET_PAN_ID_OVERHEAD 2 |
Number of bytes needed for the PAN ID field.
◆ ARES_PACKET_PAYLOAD_TYPE_OVERHEAD
| #define ARES_PACKET_PAYLOAD_TYPE_OVERHEAD 1 |
Number of bytes needed for the payload type field.
◆ ARES_PACKET_SEQ_CNT_OVERHEAD
| #define ARES_PACKET_SEQ_CNT_OVERHEAD 1 |
Number of bytes needed for the sequence count field.
◆ ARES_PACKET_SRC_ID_OVERHEAD
| #define ARES_PACKET_SRC_ID_OVERHEAD 2 |
Number of bytes needed for the source ID field.
◆ ARES_PACKET_TYPE_OVERHEAD
| #define ARES_PACKET_TYPE_OVERHEAD 1 |
Number of bytes needed for the type field.
◆ ares_packet_payload_type
Packet payload types.
| Enumerator |
|---|
| ARES_PKT_PAYLOAD_START | Start data collection packet.
|
| ARES_PKT_PAYLOAD_HEARTBEAT | Heartbeat packet.
|
| ARES_PKT_PAYLOAD_CLAIM | Claim master packet.
|
| ARES_PKT_PAYLOAD_LOG | Log packet.
|
| ARES_PKT_PAYLOAD_LOG_ACK | Log acknowledge packet.
|
| ARES_PKT_PAYLOAD_INVALID | Invalid packet type.
|
◆ ares_packet_type
Ares packet types.
| Enumerator |
|---|
| ARES_PKT_TYPE_BROADCAST | Broadcast message to all listening nodes.
|
| ARES_PKT_TYPE_DIRECT | Direct a packet to a specific node.
|
| ARES_PKT_TYPE_INVALID | Invalid packet type.
|
◆ ares_packet_present()
| int ares_packet_present |
( |
const uint8_t * | buf, |
|
|
size_t | len, |
|
|
struct ares_packet_info * | info ) |
Function to check if there is an ares packet in the buffer.
- Parameters
-
| [in] | buf | Pointer to the beginning of the buffer. |
| [in] | len | The number of bytes in the buffer. |
| [out] | info | The metadata for finding the packet in the buffer. |
- Returns
- 1 if complete packet was found.
-
0 if complete packet was not found.
-
-EINVAL if parameters are invalid.
◆ ares_packet_valid()
| bool ares_packet_valid |
( |
const uint8_t * | buf, |
|
|
size_t | len ) |
Function to verify the packet in the buffer.
- Parameters
-
| [in] | buf | Pointer to the start of the packet in the buffer. |
| [in] | len | The length of the packet in the buffer. |
- Returns
- true if the packet is valid.
-
false if the inputs or the packet are invalid.
◆ deserialize_ares_packet()
| int deserialize_ares_packet |
( |
struct ares_packet * | packet, |
|
|
const uint8_t * | buf, |
|
|
size_t | len ) |
Function to deserialize an ares packet from a buffer.
- Parameters
-
| [out] | packet | Pointer to the structured packet to store the results in. |
| [in] | buf | Pointer to the start of the packet in the buffer. |
| [in] | len | The length of the packet. |
- Returns
- 0 on success.
-
-EINVAL on invalid parameters or packet not valid.
◆ serialize_ares_packet()
| int serialize_ares_packet |
( |
uint8_t * | buf, |
|
|
size_t | len, |
|
|
const struct ares_packet * | packet, |
|
|
uint8_t | seq_num ) |
Function to serialize an ares packet into a buffer.
- Parameters
-
| [out] | buf | Pointer to the start of the buffer to write the packet to. |
| [in] | len | The size of the buffer. |
| [in] | packet | Pointer to the structured packet to serialize. |
| [in] | seq_num | The sequence number for the packet. |
- Returns
- The number of bytes written to the buffer on success.
-
-EINVAL on invalid parameters.
-
-EBADMSG if the packet is invalid.
-
-ENOBUFS if the buffer is too small to contain the packet.