1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
-
|
!
-
|
|
!
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
!
|
|
|
|
-
!
|
|
|
-
!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
!
|
|
|
|
|
|
|
|
|
!
-
|
!
| #pragma once
#include "common.h"
class OutBuffer;
class InBuffer;
class StringQueue;
class CommandBuffer{
private:
char myname[IdLenMax]; char upname[IdLenMax]; unsigned char id; InBuffer * faceIn[FaceMax]; OutBuffer * faceOut[FaceMax];
char faceID[FaceMax]; char dirID[FaceMax]; char myDirID[FaceMax]; int IX; int UpFaceID; InBuffer *nextDoorIn;
OutBuffer *nextDoorOut;
OutBuffer *currentOutFace;
int p;
char buff[CMax];
unsigned char in;
unsigned char parsingNow;
int FirstTime; int resetFlag;
int thisIsProbe;
int thisIsMonitoring;
int echoBackUART;
char commandFaceID[CMax]; int cqp1;
unsigned char lock;
StringQueue *squeue;
void appendString( int fid, char *s);
unsigned char getRegisterValue( int fid);
int response2ack1( int fid, int nextDoor, int dir, int uDir);
int response2ack2( int fid, int nextDoor, int dir, int uDir);
int response2cq( int fid, int nextDoor, int nextDir);
void sendHelpMessage( int fid);
void setCurrentOutFace( OutBuffer *obuffer);
int startsWithStringConst(char *s);
void sendCq(char i);
int parseAck2(int fid);
int parseAck1(int fid);
int parseCq(int fid);
int parseSend(int fid);
void sendCommandToConnectedFace( int faceID, char *s);
public:
CommandBuffer(unsigned char idx);
void ackReturned( int faceID);
unsigned char isLocked(void);
unsigned char faceIsConnected(char x);
StringQueue * getStringQueue();
void initBuffer(void);
void interruptProcess(void);
int isBufferNull(void);
void output(void);
void putCommand(int faceID, char *s);
int putQueue( int faceID, char *s, int l);
void putChar( int faceID, unsigned char c);
void putInt(int faceID, unsigned char i);
void put_error(int fid);
void resetBuffer(void);
void shift( int i ) ;
void startRecursiveReset( int UpFaceID);
void startRecursiveStructureSearch( int UpFaceID, char *upName);
void skipSpace(void);
int startsWith( char *s);
int startsWithPInt( int *x);
int startsWithHexDec(int *x);
void setLock( unsigned char trueOrFalse);
void sendCommand( int faceID, char *s);
unsigned char faceIsConnected( int faceID);
void setName( char *name);
void setUpFaceID( int id);
void interpretCommand( int faceID);
void setFaceIn( unsigned char i, InBuffer *fin);
void setFaceOut( unsigned char i,OutBuffer *fout);
void setBuffers(void);
} ;
|