RCOM PROJ
File transfer via serial port
|
Go to the documentation of this file.
4 #ifndef PLD_SPEC_HEADER
5 #define PLD_SPEC_HEADER
72 int fillFinalBuffer(
unsigned char* finalBuffer,
unsigned char* headerBuf,
unsigned char* footerBuf,
int footerBufSize,
unsigned char* dataBuffer,
int dataSize);
105 #endif // PLD_SPEC_HEADER
#define TRUE
Definition: macros.h:41
readingType
Definition: dcp_spec.h:9
#define FALSE
Definition: macros.h:40
void stateMachineSetUp(unsigned char control, unsigned char address, enum stateMachineState state, enum stateMachineType type)
Function to easily change the State Machine.
Definition: statemachine.c:9
@ Start
Definition: statemachine.h:12
@ trans_DISC_UA
Definition: dcp_spec.h:10
struct termios oldtio
used in llclose to reset termios
Definition: dcp.h:39
#define C_DISC
(0x0B) Campo de Controlo - DISC (disconnect)
Definition: macros.h:31
#define A_ER
(0x03) Campo de Endereço (A) de commandos do Emissor, resposta do Receptor
Definition: macros.h:27
void log_caution(char *arr)
Outputs a message in yellow.
Definition: logs.c:13
#define C_RR(r)
(0x05 OU 0x85) Campo de Controlo - RR (receiver ready / positive ACK))
Definition: macros.h:33
int receiver_UA(int fd)
Função que recebe trama SET e envia trama UA.
Definition: dcp_spec.c:237
int transmitter_SET(int fd)
Função que envia Trama SET e recebe trama UA.
Definition: dcp_spec.c:223
unsigned int timeout
Definition: dcp.h:31
unsigned char sequenceNumber
Definition: dcp.h:30
int transmitter_DISC_UA(int fd)
Transmitter sequence to Disconnect.
Definition: dcp_spec.c:277
@ closeDISC
Definition: dcp_spec.h:9
void atende()
Função handler do sinal de alarme.
Definition: dcp_spec.c:215
struct stateMachineParams state_machine
Definition: statemachine.h:24
#define BAUDRATE
Definition: macros.h:9
@ DONE
Definition: statemachine.h:12
#define BCC(a, c)
XOR entre a e c.
Definition: macros.h:37
unsigned int numTransmissions
Definition: dcp.h:32
int fillFinalBuffer(unsigned char *finalBuffer, unsigned char *headerBuf, unsigned char *footerBuf, int footerBufSize, unsigned char *dataBuffer, int dataSize)
Stuffs the final buffer with the Information Packet.
Definition: dcp_spec.c:257
int writeCycle(enum writingType type, int fd, unsigned char *buf, int bufsize)
Function used to write to fd.
Definition: dcp_spec.c:72
int initConnection(int *fd, char *port)
Estabelece ligação ao cabo e cria fd.
Definition: dcp_spec.c:178
#define TIME_OUT
Definition: macros.h:10
@ openR
Definition: dcp_spec.h:9
int receiver_DISC_UA(int fd)
Receiver sequence to Disconnect.
Definition: dcp_spec.c:300
#define C_UA
(0x07) Campo de Controlo - UA (Unnumbered Acknowledgement)
Definition: macros.h:32
#define FLAG
(0x7E) flag de inicio e fim
Definition: macros.h:25
volatile int failed
used in the alarm handler
Definition: dcp.h:40
void log_message(char *arr)
Outputs a message in white.
Definition: logs.c:25
#define C_SET
(0x03) Campo de Controlo - SET (set up)
Definition: macros.h:30
writingType
Definition: dcp_spec.h:10
void log_error(char *arr)
Outputs a message in red.
Definition: logs.c:7
void generateErrorBCC2(unsigned char *frame, int frameSize)
Generates a error on BCC2 based on PROBABILITY_BCC2.
Definition: dcp_spec.c:328
#define A_RE
(0x01) Campo de Endereço (A) de commandos do Receptor, resposta do Emissor
Definition: macros.h:28
void generateErrorBCC1(unsigned int *checkBuffer)
Generates a error on BCC based on PROBABILITY_BCC2.
Definition: dcp_spec.c:339
enum stateMachineState state
Definition: statemachine.h:20
#define C_REJ(r)
(0x01 OU 0x81) Campo de Controlo - REJ (reject / negative ACK))
Definition: macros.h:34
char port[20]
Definition: dcp.h:28
int baudRate
Definition: dcp.h:29
int readingCycle(enum readingType type, int fd, unsigned char *c, unsigned char **dataBuf, int *retBufferSize)
Function to read a byte from fd.
Definition: dcp_spec.c:7
void log_success(char *arr)
Outputs a message in green.
Definition: logs.c:19
Struct to hold information about the Link Layer.
Definition: dcp.h:27
@ trans_SET
Definition: dcp_spec.h:10
#define ATTEMPTS
Definition: macros.h:11
static unsigned checkBuffer[2]
Definition: statemachine.c:6
@ Supervision
Definition: statemachine.h:11
@ writeR
Definition: dcp_spec.h:10
#define PROBABILITY_BCC1
Definition: macros.h:16
#define SU_FRAME_SIZE
Enum com Valores para a Máquina de Estados de SET-UA.
Definition: macros.h:23
#define PROBABILITY_BCC2
Definition: macros.h:15
@ readR
Definition: dcp_spec.h:9
int stateMachine(unsigned char byte, unsigned char **buf, int *size)
The StateMachine function that processes a byte and updates it's state.
Definition: statemachine.c:16
int testSend1
Definition: dcp_spec.c:5
@ closeUA
Definition: dcp_spec.h:9