18#include "fota_error.h"
46#define FOTA_PACKET_PAYLOAD_SIZE 256U
48#define FOTA_PACKET_SOF 0xAAU
50#define FOTA_PACKET_EOF 0xBBU
52#define FOTA_PACKET_MINIMUM_SIZE 14U
FotaError fota_packet_serialize(FotaPacket *packet, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_written)
Serialize packet into a buffer for transmission.
Definition: fota_packet.c:48
FotaPacketType
FOTA Packet Type.
Definition: fota_packet.h:57
#define FOTA_PACKET_PAYLOAD_SIZE
FOTA packet payload size.
Definition: fota_packet.h:46
FotaError fota_packet_init(FotaPacket *packet, FotaPacketType type, uint8_t sequence, uint16_t length)
Initialize a packet structure.
Definition: fota_packet.c:20
FotaError fota_packet_set_crc(FotaPacket *packet)
Calculate and set the CRC for a packet.
Definition: fota_packet.c:37
FotaError fota_packet_deserialize(FotaPacket *packet, uint8_t *buffer, uint32_t buf_size)
Deserialize packet from received data.
Definition: fota_packet.c:86
FotaError
FOTA Error code definitions.
Definition: fota_error.h:27
@ FOTA_PACKET_TYPE_ERROR
Definition: fota_packet.h:62
@ FOTA_PACKET_TYPE_ACK
Definition: fota_packet.h:60
@ FOTA_PACKET_TYPE_HEADER
Definition: fota_packet.h:59
@ FOTA_PACKET_TYPE_DATA
Definition: fota_packet.h:58
@ FOTA_PACKET_TYPE_NACK
Definition: fota_packet.h:61
FOTA Packet structure.
Definition: fota_packet.h:68
uint32_t datagram_id
Definition: fota_packet.h:70
uint8_t _reserved_padding
Definition: fota_packet.h:76
uint8_t eof
Definition: fota_packet.h:75
uint16_t payload_length
Definition: fota_packet.h:72
uint32_t crc32
Definition: fota_packet.h:69
uint8_t sequence_num
Definition: fota_packet.h:73
FotaPacketType packet_type
Definition: fota_packet.h:71
uint8_t sof
Definition: fota_packet.h:74