FOSSASAT-1B
communication.h File Reference

This system is the main interface that is used to transmit message, configure the radio and process received transmissions. More...

#include "FossaSat1B.h"
Include dependency graph for communication.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void Communication_Receive_Interrupt ()
 This function is called by the ISR when a transmission is received. More...
 
int16_t Communication_Set_Modem (uint8_t modem)
 This function configures the radio to the given modem. More...
 
int16_t Communication_Set_Configuration (uint8_t *optData, uint8_t optDataLen)
 This function sets the configuration of the radio, which is used to Radio.Begin(). More...
 
int16_t Communication_Set_SpreadingFactor (uint8_t sfMode)
 This function sets the spreading factor of the radio. More...
 
void Communication_Send_Morse_Beacon (float battVoltage)
 This function transmits a morse beacon message. More...
 
void Communication_CW_Beep (uint32_t len)
 This function transmits a continous wave "BEEP"". More...
 
template<typename T >
void Communication_Frame_Add (uint8_t **buffPtr, T val, const char *name)
 This function adds frame entry to a frame. More...
 
void Communication_Send_System_Info ()
 Send the satellite's information via the configured radio settings. More...
 
void Communication_Acknowledge (uint8_t functionId, uint8_t result)
 This function sends acknowledge for a received frame. More...
 
void Communication_Process_Packet ()
 This function reads the contents of the radio when it receives a transmission. More...
 
void Comunication_Parse_Frame (uint8_t *frame, size_t len)
 This function parses the internal contents of the message using the FOSSA COMMS Protocol. More...
 
void Communication_Execute_Function (uint8_t functionId, uint8_t *optData=NULL, size_t optDataLen=0)
 This function executes the given function id provided with the given data. More...
 
int16_t Communication_Send_Response (uint8_t respId, uint8_t *optData=nullptr, size_t optDataLen=0, bool overrideModem=false)
 Responds to a given function id execution (internally used). More...
 
int16_t Communication_Transmit (uint8_t *data, uint8_t len, bool overrideModem=true)
 Transmits the given data. More...
 
bool Communication_Check_OptDataLen (uint8_t expected, uint8_t actual)
 Helper functions to check two variables are equal, with debug prints. More...
 

Detailed Description

This system is the main interface that is used to transmit message, configure the radio and process received transmissions.

Definition in file communication.h.

Function Documentation

◆ Communication_Acknowledge()

void Communication_Acknowledge ( uint8_t  functionId,
uint8_t  result 
)

This function sends acknowledge for a received frame.

Test:
(ID COMMS_H_T10) (SEV 1) Test that each command/packet is processed correctly.
Parameters
functionIdFunction ID to acknowledge.
resultResult of frame processing.

Definition at line 237 of file communication.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Communication_Check_OptDataLen()

bool Communication_Check_OptDataLen ( uint8_t  expected,
uint8_t  actual 
)

Helper functions to check two variables are equal, with debug prints.

Test:
(ID COMMS_H_T14) (SEV 1) Check that this function equates correctly.
Parameters
expectedThe expected value
actualThe given value.
Returns
true They are the same value.
false They are not the same value.

Definition at line 816 of file communication.cpp.

◆ Communication_CW_Beep()

void Communication_CW_Beep ( uint32_t  len)

This function transmits a continous wave "BEEP"".

Test:
(ID COMMS_H_T7) (SEV 2) Test that the CW beep is received ok.
Parameters
lenLength of the beep in ms, with 500 ms resolution

Definition at line 153 of file communication.cpp.

Here is the call graph for this function:

◆ Communication_Execute_Function()

void Communication_Execute_Function ( uint8_t  functionId,
uint8_t *  optData = NULL,
size_t  optDataLen = 0 
)

This function executes the given function id provided with the given data.

Test:
(ID COMMS_H_T11) (SEV 1) Test that each command is responded to with the correct function and data.
Parameters
functionIdThe function to execute.
optDataThe data to give to the function.
optDataLenThe length of the data that is given to the function.

Definition at line 381 of file communication.cpp.

Here is the call graph for this function:

◆ Communication_Frame_Add()

template<typename T >
void Communication_Frame_Add ( uint8_t **  buffPtr,
val,
const char *  name 
)

This function adds frame entry to a frame.

Test:
(ID COMMS_H_T8) (SEV 1) Test that the system information is received correctly.
Parameters
buffPtrPointer to the frame buffer.
valValue to be added.
nameName of the parameter (debug only);

Definition at line 81 of file communication.h.

Here is the caller graph for this function:

◆ Communication_Process_Packet()

void Communication_Process_Packet ( )

This function reads the contents of the radio when it receives a transmission.

Test:
(ID COMMS_H_T9) (SEV 1) Test that each command/packet is processed correctly.

Definition at line 242 of file communication.cpp.

◆ Communication_Receive_Interrupt()

void Communication_Receive_Interrupt ( )

This function is called by the ISR when a transmission is received.

Test:
(ID COMMS_H_T0) (SEV 1) Make sure this function is called when the radio receives data.

Definition at line 3 of file communication.cpp.

◆ Communication_Send_Morse_Beacon()

void Communication_Send_Morse_Beacon ( float  battVoltage)

This function transmits a morse beacon message.

Test:

(ID COMMS_H_T5) (SEV 1) Test that the beacon message can be received properly.

(ID COMMS_H_T6) (SEV 1) Test that the beacon messages battery voltage is received ok.

Parameters
battVoltageThe battery voltage to send via morse code.

Definition at line 122 of file communication.cpp.

Here is the call graph for this function:

◆ Communication_Send_Response()

int16_t Communication_Send_Response ( uint8_t  respId,
uint8_t *  optData = nullptr,
size_t  optDataLen = 0,
bool  overrideModem = false 
)

Responds to a given function id execution (internally used).

Test:
(ID COMMS_H_T12) (SEV 1) Test that each response transmits correctly.
Parameters
respIdFunction ID to respond with.
optDataThe data to respond with.
optDataLenThe length of the data to respond with.
overrideModemOverride the modem to use default LoRa modem and settings.
Returns
int16_t The status code of the Communication_Transmit() function.

Definition at line 694 of file communication.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Communication_Send_System_Info()

void Communication_Send_System_Info ( )

Send the satellite's information via the configured radio settings.

Test:
(ID COMMS_H_T8) (SEV 1) Test that the system information is received correctly.

Definition at line 159 of file communication.cpp.

Here is the call graph for this function:

◆ Communication_Set_Configuration()

int16_t Communication_Set_Configuration ( uint8_t *  optData,
uint8_t  optDataLen 
)

This function sets the configuration of the radio, which is used to Radio.Begin().

Test:
(ID COMMS_H_T2) (SEV 1) Make sure the modem mode is changed with no errors.
Parameters
optDataThe data which is used to configure the radio.
optDataLenThe length of the byte string given.
Returns
int16_t The status code returned by the radio.Begin() function.

Definition at line 90 of file communication.cpp.

Here is the caller graph for this function:

◆ Communication_Set_Modem()

int16_t Communication_Set_Modem ( uint8_t  modem)

This function configures the radio to the given modem.

Test:
(ID COMMS_H_T1) (SEV 1) Make sure the modem mode is changed with no errors.
Parameters
modemsee Modem Identifiers
Returns
int16_t The RadioLib status code for .Begin().

Definition at line 13 of file communication.cpp.

◆ Communication_Set_SpreadingFactor()

int16_t Communication_Set_SpreadingFactor ( uint8_t  sfMode)

This function sets the spreading factor of the radio.

Test:

(ID COMMS_H_T3) (SEV 1) Make sure the radio's spreading factor can be changed with no errors.

(ID COMMS_H_T4) (SEV 1) Make sure the radio's spreading factors are compatable with generic radios.

Parameters
sfModeSee defines_radio_lora_configuraiton
Returns
int16_t The status code returned by the radio.setSpreadingFactor() function.

Definition at line 71 of file communication.cpp.

◆ Communication_Transmit()

int16_t Communication_Transmit ( uint8_t *  data,
uint8_t  len,
bool  overrideModem = true 
)

Transmits the given data.

Test:
(ID COMMS_H_T13) (SEV 1) Check that each function/command transmits correctly.
Parameters
dataThe byte array to transmit.
lenThe length of the byte array to transmit.
overrideModemOverride the modem to use default LoRa modem and settings.
Returns
int16_t The status code of the Radio.Tranmit() function.

Definition at line 719 of file communication.cpp.

Here is the call graph for this function:

◆ Comunication_Parse_Frame()

void Comunication_Parse_Frame ( uint8_t *  frame,
size_t  len 
)

This function parses the internal contents of the message using the FOSSA COMMS Protocol.

Test:
(ID COMMS_H_T10) (SEV 1) Test that each command/packet is processed correctly.
Parameters
frameThe raw data to process.
lenThe length of the raw data.

Definition at line 293 of file communication.cpp.

Here is the call graph for this function: