Midnight Sun Firmware
Loading...
Searching...
No Matches
fota_packet.h
1#pragma once
2
3/************************************************************************************************
4 * @file fota_packet.h
5 *
6 * @brief Packet implementation for firmware over the air (FOTA) updates
7 *
8 * @date 2025-03-16
9 * @author Midnight Sun Team #24 - MSXVI
10 ************************************************************************************************/
11
12/* Standard library Headers */
13#include <stdint.h>
14
15/* Inter-component Headers */
16
17/* Intra-component Headers */
18#include "fota_error.h"
19
26#define PAYLOAD_SIZE 256
27
28typedef enum { HEADER_PACKET, DATA_PACKET, ERROR_PACKET } PacketType;
29typedef struct {
30 uint8_t sof;
31 PacketType packet_type;
32 uint8_t sequence_num;
33 uint16_t payload_length;
34 uint8_t payload[PAYLOAD_SIZE];
35 uint8_t eof;
36} Packet;
37
38FotaError encode_packet(Packet *packet, uint8_t *payload);
39
40FotaError decode_packet(Packet *packet, uint8_t *payload);
41
FotaError
FOTA Error code definitions.
Definition: fota_error.h:26
Definition: fota_packet.h:29