communication.h.svn-base

来自「A simple protocol using CRC error check.」· SVN-BASE 代码 · 共 63 行

SVN-BASE
63
字号
/*
 * Communication.h
 *
 *  Created on: 19 mars 2009
 *      Author: Crest
 */

#ifndef COMMUNICATION_H_
#define COMMUNICATION_H_

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

#define CARFIN "#"

//Define de Priorite
#define TRAME_PRIORITAIRE 64
#define TRAME_NORMALE 0

//Define de Type
#define TRAME_RAPPEL 1
#define TRAME_ODOMETRIE 2
#define TRAME_PRESENCE_DISTRIBUTEUR_PALET 3
#define TRAME_CONSIGNE_SERVOMOTEURS 4
#define TRAME_RETOUR_SERVOMOTEURS 5
#define TRAME_SERVOPOD 6
#define TRAME_POSITION 7

typedef struct trame{
	int priorite;
	int type;
	char *donnee;
	int crc;
}trame;

typedef struct file
{
    trame  donnee;
    struct file *suivant;
} File;


typedef struct resDiv{
	int quotient;
	int reste;
}resDiv;


void lectureEntete(unsigned char , trame *);
resDiv divisionEuclidienne(int , int );
void traitementTrame(File **, char *);
void inserer(File **, trame);
trame retirer(File **);
void effacerFile(File **);
char checkSumXor(unsigned char*,unsigned char);
trame decoderTrame(char *, trame );
void afficherTrame(trame);
char * codageTrame(int priorite, int type, char * donnee, char * message);

#endif /* COMMUNICATION_H_ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?