Midnight Sun Firmware
Loading...
Searching...
No Matches
FOTA

Firmware Over the Air (FOTA) Update system. More...

Classes

struct  Packet
 
struct  NetworkBuffer
 struct containing details of circular buffer More...
 
struct  PacketManager
 

Macros

#define PAYLOAD_SIZE   256
 
#define NETWORK_BUFFER_SIZE   1024U
 
#define PACKET_NUM   8
 

Enumerations

enum  FotaError {
  FOTA_ERROR_SUCCESS , FOTA_RESOURCE_EXHAUSTED , FOTA_ERROR_INVALID_ARGS , FOTA_ERROR_INTERNAL_ERROR ,
  FOTA_ERROR_CRC_MISMATCH
}
 FOTA Error code definitions. More...
 
enum  PacketType { HEADER_PACKET , DATA_PACKET , ERROR_PACKET }
 

Functions

FotaError encode_packet (Packet *packet, uint8_t *payload)
 
FotaError decode_packet (Packet *packet, uint8_t *payload)
 
FotaError network_buffer_init (NetworkBuffer *network_buffer)
 Initalizes circular buffer for use, by initalizing assocated structs. More...
 
uint16_t network_buffer_num_items (NetworkBuffer *network_buffer)
 Fetches the number of items in the network buffer. More...
 
uint16_t network_buffer_num_empty_slots (NetworkBuffer *network_buffer)
 Fetches the number of empty slots in the network buffer. More...
 
bool network_buffer_empty (NetworkBuffer *network_buffer)
 Checks if the network buffer is empty. More...
 
bool network_buffer_full (NetworkBuffer *network_buffer)
 Checks if the network buffer is full. More...
 
FotaError network_buffer_write (NetworkBuffer *network_buffer, uint8_t *data)
 Write data bytes. More...
 
FotaError network_buffer_read (NetworkBuffer *network_buffer, uint8_t *data)
 Read data bytes. More...
 
FotaError crc_check (PacketManager *packet_manager)
 
FotaError transmit_packet (PacketManager *packet_manager)
 

Detailed Description

Firmware Over the Air (FOTA) Update system.

Enumeration Type Documentation

◆ FotaError

enum FotaError

FOTA Error code definitions.

Enumerator
FOTA_ERROR_SUCCESS 

Success error code

FOTA_RESOURCE_EXHAUSTED 

Resource exhausted error code

FOTA_ERROR_INVALID_ARGS 

Invalid arguments error code

FOTA_ERROR_INTERNAL_ERROR 

Internal issue error code

FOTA_ERROR_CRC_MISMATCH 

CRC mismatch error code

Function Documentation

◆ network_buffer_empty()

bool network_buffer_empty ( NetworkBuffer network_buffer)

Checks if the network buffer is empty.

Parameters
network_bufferPointer to the network buffer
Returns
TRUE if network buffer is empty FALSE if network buffer has data

◆ network_buffer_full()

bool network_buffer_full ( NetworkBuffer network_buffer)

Checks if the network buffer is full.

Parameters
network_bufferPointer to the network buffer
Returns
TRUE if network buffer is full FALSE if network buffer is not full

◆ network_buffer_init()

FotaError network_buffer_init ( NetworkBuffer network_buffer)

Initalizes circular buffer for use, by initalizing assocated structs.

Parameters
network_bufferPointer to the network buffer
Returns
FOTA_ERROR_SUCCESS if network buffer is initialized successfully FOTA_ERROR_INVALID_ARGS if one of the parameters are incorrect

◆ network_buffer_num_empty_slots()

uint16_t network_buffer_num_empty_slots ( NetworkBuffer network_buffer)

Fetches the number of empty slots in the network buffer.

Parameters
network_bufferPointer to the network buffer
Returns
Number of empty slots in the network buffer

◆ network_buffer_num_items()

uint16_t network_buffer_num_items ( NetworkBuffer network_buffer)

Fetches the number of items in the network buffer.

Parameters
network_bufferPointer to the network buffer
Returns
Number of items in the network buffer

◆ network_buffer_read()

FotaError network_buffer_read ( NetworkBuffer network_buffer,
uint8_t *  data 
)

Read data bytes.

Parameters
network_bufferPointer to the network buffer
dataReads packet from circular buffer into a provided location
Returns
FOTA_ERROR_SUCCESS if network buffer is initialized successfully FOTA_ERROR_INVALID_ARGS if one of the parameters are incorrect

◆ network_buffer_write()

FotaError network_buffer_write ( NetworkBuffer network_buffer,
uint8_t *  data 
)

Write data bytes.

Parameters
network_bufferPointer to the network buffer
dataPointer to data byte to write
Returns
FOTA_ERROR_SUCCESS if network buffer is initialized successfully FOTA_ERROR_INVALID_ARGS if one of the parameters are incorrect