#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
Go to the source code of this file.
|
typedef struct Byte | Byte |
|
typedef struct Packet | Packet |
|
◆ byteToPacket()
Creates a Packet structure containing the provided Byte.
- Parameters
-
b | Pointer to the Byte to be wrapped |
- Returns
- Pointer to the resulting Packet
◆ createPacket()
Creates a reserved, empty Packet struct instance.
- Returns
- Pointer to the resulting Packet, NULL if there is no available memory
◆ createRetransmitPacket()
Packet * createRetransmitPacket |
( |
uint8_t | identifier | ) |
|
Creates a Packet requesting that the peer retransmit the cached Packet with the specified identifier.
- Returns
- Pointer to the resulting Packet, NULL if there is no available memory
◆ freePacket()
Free the memory reserved for the packet and all contained bytes.
- Parameters
-
p | Pointer to the Packet to be freed |
◆ getPacketID()
uint8_t getPacketID |
( |
Packet * | p | ) |
|
Extracts the Packet Identifier from the header field.
- Parameters
-
p | Pointer to the Packet to be examined |
- Returns
- The value of the Packet Identifier (ID) bits
◆ getPacketRT()
bool getPacketRT |
( |
Packet * | p | ) |
|
Checks the header field to determine if the specified Packet ID should be retransmitted.
- Parameters
-
p | Pointer to the Packet to be examined |
- Returns
- The value of the Retransmission (RT) bit
◆ packetAppendByte()
Creates a Packet to be stored within the PacketCache.
- Returns
- Pointer to the resulting Packet, NULL if there is no available memory
- Deprecated
- The Packet Cache is being migrated to main.c
Inserts a Byte at the end of a Packet. This function ignores linked Bytes, so they should be handled appropriately.
- Parameters
-
p | Pointer to the Packet to be modified |
b | Pointer to the Byte to be appended. The addresses stored within .previous and .next will be overwritten. |
◆ printByte()
void printByte |
( |
Byte * | b | ) |
|
Sending and retransmitting.
- Deprecated
- Packet transmission should be implemented in uart.c
Sending and retransmitting
- Deprecated
- Packet transmission should be implemented in uart.c
Print the detailed contents of a Byte struct instance
- Parameters
-
b | Pointer to the Byte to be printed |
◆ printPacket()
void printPacket |
( |
Packet * | p | ) |
|
Display the bytes contained within the packet and their ASCII representation.
- Parameters
-
p | Pointer to the Packet to be printed |
◆ setPacketID()
void setPacketID |
( |
Packet * | p, |
|
|
uint8_t | id ) |
Sets the Packet Identifier within the header field.
- Parameters
-
p | Pointer to the Packet to be modified |
id | The 3-bit Packet ID value |
◆ toByte()
Converts a character to a Byte struct (linked list node)
- Parameters
-
c | 8-bit char to be used as the Byte's value |
- Returns
- Pointer to the resulting Byte, NULL if there is no available memory
◆ toPacket()
Converts a char* string to a Packet containing one Byte per char.
- Parameters
-
s | The char* string to be converted to a Byte sequence |
- Returns
- Pointer to the resulting Packet, NULL if there is no available memory