RCOM PROJ
File transfer via serial port
|
Go to the documentation of this file.
43 int stateMachine(
unsigned char byte,
unsigned char **buf,
int *size);
81 int processBCC_OK(
unsigned char byte,
unsigned char **buffer,
int *buffersize);
#define TRUE
Definition: macros.h:41
unsigned char address
Definition: statemachine.h:19
#define FALSE
Definition: macros.h:40
@ A_RCV
Definition: statemachine.h:12
int processStart(unsigned char byte)
Function to process a byte in case the state is Start.
Definition: statemachine.c:47
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
@ BCC_OK
Definition: statemachine.h:12
@ Start
Definition: statemachine.h:12
void log_caution(char *arr)
Outputs a message in yellow.
Definition: logs.c:13
enum stateMachineType type
Definition: statemachine.h:21
@ Write
Definition: statemachine.h:11
unsigned char sequenceNumber
Definition: dcp.h:30
#define T_PROP_DELAY
Definition: macros.h:17
@ Read
Definition: statemachine.h:11
int processFLAG_RCV(unsigned char byte)
Function to process a byte in case the state is FLAG_RCV.
Definition: statemachine.c:65
struct stateMachineParams state_machine
Definition: statemachine.h:24
@ DONE
Definition: statemachine.h:12
int processC_RCV(unsigned char byte)
Function to process a byte in case the state is C_RCV.
Definition: statemachine.c:134
unsigned char control
Definition: statemachine.h:18
List of Parameters to Personalize the State Machine.
Definition: statemachine.h:17
#define BCC(a, c)
XOR entre a e c.
Definition: macros.h:37
#define C_I(r)
(0x00 0x40) Campo de Controlo - Tramas I
Definition: macros.h:35
@ C_RCV
Definition: statemachine.h:12
@ FLAG_RCV
Definition: statemachine.h:12
static int frameIndex
Definition: statemachine.c:7
#define FLAG
(0x7E) flag de inicio e fim
Definition: macros.h:25
unsigned char frame[MAX_SIZE_AFT_STUFF]
Definition: dcp.h:33
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
static int wrongC
Definition: statemachine.c:7
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
int processBCC_OK(unsigned char byte, unsigned char **buffer, int *buffersize)
Function to process a byte in case the state is BCC_OK.
Definition: statemachine.c:179
Struct to hold information about the Link Layer.
Definition: dcp.h:27
static unsigned checkBuffer[2]
Definition: statemachine.c:6
@ Supervision
Definition: statemachine.h:11
stateMachineState
Definition: statemachine.h:12
#define PROBABILITY_BCC1
Definition: macros.h:16
#define PROBABILITY_BCC2
Definition: macros.h:15
stateMachineType
Definition: statemachine.h:11
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 processA_RCV(unsigned char byte)
Function to process a byte in case the state is A_RCV.
Definition: statemachine.c:77