RCOM PROJ
File transfer via serial port
application.h
Go to the documentation of this file.
1 
4 #ifndef APP_HEADER
5 #define APP_HEADER
6 
7 #include "dcp.h"
8 #include "logs.h"
9 
14  off_t filesize; // Size of file in bytes
15  char filename[255]; // String with file name
16  char destinationArg[255]; // String with path to destination message received
17  char filenameArg[255]; //String with filename passed by programs arguments
18  int type; // TRANSMITTER | RECEIVER
19  int gate; // /dev/ttySx | gate is x
20 };
21 
28 void parseArgs(int argc, char** argv);
29 
36 int transmitterApp(int fd);
37 
43 void parseFileInfo(unsigned char *controlpackage, int packagesize);
44 
51 int receiverApp(int fd);
52 
60 int main(int argc, char** argv);
61 
62 #endif // APP_HEADER
63 
clearProgressBar
void clearProgressBar()
Clears progress bar from terminal.
Definition: logs.c:43
log_bitsPerSecond
void log_bitsPerSecond(double nbytes, struct timespec start_time)
Definition: logs.c:77
RECEIVER
#define RECEIVER
Definition: macros.h:45
applicationLayer::destinationArg
char destinationArg[255]
Definition: application.h:16
log_caution
void log_caution(char *arr)
Outputs a message in yellow.
Definition: logs.c:13
T_SIZE
#define T_SIZE
Definition: macros.h:55
applicationLayer::filenameArg
char filenameArg[255]
Definition: application.h:17
applicationLayer::type
int type
Definition: application.h:18
MAX_SIZE
#define MAX_SIZE
Definition: macros.h:12
END
#define END
Definition: macros.h:52
applicationLayer::gate
int gate
Definition: application.h:19
log_elapsedTime
void log_elapsedTime(char *message, struct timespec start_time)
starts counting time
Definition: logs.c:67
receiverApp
int receiverApp(int fd)
Receiver part of the application.
Definition: application.c:137
applicationLayer::filename
char filename[255]
Definition: application.h:15
startTime
void startTime(struct timespec *start_time)
starts counting time
Definition: logs.c:63
START
#define START
Definition: macros.h:51
llclose
int llclose(int fd)
Closes the connection to the serial port.
Definition: dcp.c:141
logs.h
dcp.h
applicationLayer::filesize
off_t filesize
Definition: application.h:14
log_error
void log_error(char *arr)
Outputs a message in red.
Definition: logs.c:7
llopen
int llopen(int porta, int type)
Opens a data connection with the serial port.
Definition: dcp.c:9
applicationLayer
Struct to save data relative to the Application.
Definition: application.h:13
transmitterApp
int transmitterApp(int fd)
Transmitter part of the application.
Definition: application.c:34
TRANSMITTER
#define TRANSMITTER
Definition: macros.h:44
parseFileInfo
void parseFileInfo(unsigned char *controlpackage, int packagesize)
Parses the info of a Control Package to the Application Layer Struct.
Definition: application.c:110
DATA
#define DATA
Definition: macros.h:50
log_success
void log_success(char *arr)
Outputs a message in green.
Definition: logs.c:19
printProgressBar
void printProgressBar(int progress, int total)
Prints progress bar on terminal.
Definition: logs.c:50
main
int main(int argc, char **argv)
Definition: application.c:206
parseArgs
void parseArgs(int argc, char **argv)
Função para dar parse dos argumentos da linah de comandos.
Definition: application.c:8
llread
int llread(int fd, unsigned char *buffer)
Reads from fd to buffer.
Definition: dcp.c:109
T_NAME
#define T_NAME
Definition: macros.h:56
applayer
static struct applicationLayer applayer
Definition: application.c:6
llwrite
int llwrite(int fd, char *buffer, int lenght)
Writes the content of buffer to fd.
Definition: dcp.c:47
application.h