RCOM PROJ
File transfer via serial port
Logs

Macros

#define _POSIX_C_SOURCE   199309L
 
#define RESET   "\033[0m"
 
#define BLACK   "\033[30m" /* Black */
 
#define RED   "\033[31m" /* Red */
 
#define GREEN   "\033[32m" /* Green */
 
#define YELLOW   "\033[33m" /* Yellow */
 
#define BLUE   "\033[34m" /* Blue */
 
#define MAGENTA   "\033[35m" /* Magenta */
 
#define CYAN   "\033[36m" /* Cyan */
 
#define WHITE   "\033[37m" /* White */
 
#define BOLDBLACK   "\033[1m\033[30m" /* Bold Black */
 
#define BOLDRED   "\033[1m\033[31m" /* Bold Red */
 
#define BOLDGREEN   "\033[1m\033[32m" /* Bold Green */
 
#define BOLDYELLOW   "\033[1m\033[33m" /* Bold Yellow */
 
#define BOLDBLUE   "\033[1m\033[34m" /* Bold Blue */
 
#define BOLDMAGENTA   "\033[1m\033[35m" /* Bold Magenta */
 
#define BOLDCYAN   "\033[1m\033[36m" /* Bold Cyan */
 
#define BOLDWHITE   "\033[1m\033[37m" /* Bold White */
 
#define PROGRESS_BAR_SIZE   30
 
#define SEPARATOR_CHAR   '#'
 
#define EMPTY_CHAR   '.'
 
#define NUM_BACKSPACES   PROGRESS_BAR_SIZE + 9
 

Functions

void log_error (char *arr)
 Outputs a message in red. More...
 
void log_caution (char *arr)
 Outputs a message in yellow. More...
 
void log_success (char *arr)
 Outputs a message in green. More...
 
void log_message (char *arr)
 Outputs a message in white. More...
 
void log_message_number (char *arr, int numb)
 Outputs a message in the form "number - message". More...
 
void log_hexa (unsigned char a)
 Outputs a message in the form "Content: 0xHH". More...
 
void clearProgressBar ()
 Clears progress bar from terminal. More...
 
void printProgressBar (int progress, int total)
 Prints progress bar on terminal. More...
 
void startTime (struct timespec *start_time)
 starts counting time More...
 
void log_elapsedTime (char *message, struct timespec start_time)
 starts counting time More...
 
void log_bitsPerSecond (double nbytes, struct timespec start_time)
 

Detailed Description

Macro Definition Documentation

◆ _POSIX_C_SOURCE

#define _POSIX_C_SOURCE   199309L

◆ BLACK

#define BLACK   "\033[30m" /* Black */

◆ BLUE

#define BLUE   "\033[34m" /* Blue */

◆ BOLDBLACK

#define BOLDBLACK   "\033[1m\033[30m" /* Bold Black */

◆ BOLDBLUE

#define BOLDBLUE   "\033[1m\033[34m" /* Bold Blue */

◆ BOLDCYAN

#define BOLDCYAN   "\033[1m\033[36m" /* Bold Cyan */

◆ BOLDGREEN

#define BOLDGREEN   "\033[1m\033[32m" /* Bold Green */

◆ BOLDMAGENTA

#define BOLDMAGENTA   "\033[1m\033[35m" /* Bold Magenta */

◆ BOLDRED

#define BOLDRED   "\033[1m\033[31m" /* Bold Red */

◆ BOLDWHITE

#define BOLDWHITE   "\033[1m\033[37m" /* Bold White */

◆ BOLDYELLOW

#define BOLDYELLOW   "\033[1m\033[33m" /* Bold Yellow */

◆ CYAN

#define CYAN   "\033[36m" /* Cyan */

◆ EMPTY_CHAR

#define EMPTY_CHAR   '.'

◆ GREEN

#define GREEN   "\033[32m" /* Green */

◆ MAGENTA

#define MAGENTA   "\033[35m" /* Magenta */

◆ NUM_BACKSPACES

#define NUM_BACKSPACES   PROGRESS_BAR_SIZE + 9

◆ PROGRESS_BAR_SIZE

#define PROGRESS_BAR_SIZE   30

◆ RED

#define RED   "\033[31m" /* Red */

◆ RESET

#define RESET   "\033[0m"

◆ SEPARATOR_CHAR

#define SEPARATOR_CHAR   '#'

◆ WHITE

#define WHITE   "\033[37m" /* White */

◆ YELLOW

#define YELLOW   "\033[33m" /* Yellow */

Function Documentation

◆ clearProgressBar()

void clearProgressBar ( )

Clears progress bar from terminal.

References NUM_BACKSPACES.

Referenced by receiverApp(), and transmitterApp().

Here is the caller graph for this function:

◆ log_bitsPerSecond()

void log_bitsPerSecond ( double  nbytes,
struct timespec  start_time 
)

Referenced by transmitterApp().

Here is the caller graph for this function:

◆ log_caution()

void log_caution ( char *  arr)

Outputs a message in yellow.

Parameters
arrmessage String

References RESET, and YELLOW.

Referenced by atende(), parseArgs(), processA_RCV(), processC_RCV(), readingCycle(), receiverApp(), and writeCycle().

Here is the caller graph for this function:

◆ log_elapsedTime()

void log_elapsedTime ( char *  message,
struct timespec  start_time 
)

starts counting time

Referenced by transmitterApp().

Here is the caller graph for this function:

◆ log_error()

void log_error ( char *  arr)

Outputs a message in red.

Parameters
arrmessage String

References RED, and RESET.

Referenced by initConnection(), llclose(), llopen(), llread(), llwrite(), main(), parseArgs(), processA_RCV(), processBCC_OK(), processC_RCV(), readingCycle(), receiver_DISC_UA(), receiver_UA(), receiverApp(), stateMachine(), transmitter_DISC_UA(), transmitter_SET(), transmitterApp(), and writeCycle().

Here is the caller graph for this function:

◆ log_hexa()

void log_hexa ( unsigned char  a)

Outputs a message in the form "Content: 0xHH".

Parameters
aByte

◆ log_message()

void log_message ( char *  arr)

Outputs a message in white.

Parameters
arrmessage String

Referenced by generateErrorBCC1(), and generateErrorBCC2().

Here is the caller graph for this function:

◆ log_message_number()

void log_message_number ( char *  arr,
int  numb 
)

Outputs a message in the form "number - message".

Parameters
arrmessage String
numbnumber

◆ log_success()

void log_success ( char *  arr)

Outputs a message in green.

Parameters
arrmessage String

References GREEN, and RESET.

Referenced by initConnection(), llclose(), and main().

Here is the caller graph for this function:

◆ printProgressBar()

void printProgressBar ( int  progress,
int  total 
)

Prints progress bar on terminal.

Parameters
progressnbytes already sent
totalnumber of bytes to send

References EMPTY_CHAR, PROGRESS_BAR_SIZE, and SEPARATOR_CHAR.

Referenced by receiverApp(), and transmitterApp().

Here is the caller graph for this function:

◆ startTime()

void startTime ( struct timespec *  start_time)

starts counting time

Referenced by transmitterApp().

Here is the caller graph for this function: