#author("2021-12-05T14:00:52+09:00","default:Real2Virtual202111","Real2Virtual202111") #author("2021-12-05T16:40:07+09:00","default:Real2Virtual202111","Real2Virtual202111") [[Real2Virtual202111]] * CommandBuffer.h [#bcce9098] #code(c){{ #pragma once //#ifndef COMMANDBUFFER_H //#define COMMANDBUFFER_H #include "common.h" //#include "Initialize.h" //#include "Initialize.cpp" //#include "OutBuffer.h" class OutBuffer; class InBuffer; class StringQueue; class CommandBuffer{ private: char myname[IdLenMax]; // name of the tesla dice char upname[IdLenMax]; // up dice name unsigned char id; // id of this buffer InBuffer * faceIn[FaceMax]; // OutBuffer * faceOut[FaceMax]; char faceID[FaceMax]; // faceID[i] は、このtesla dice の i 面に隣接する他の dice の 面を表す。 char dirID[FaceMax]; // dirID[i] は、この tesla dice の i面に隣接する他の dice の面との向きを表す。 char myDirID[FaceMax]; // myDirID[i] は、このtesla dice のi面が隣接するdice と通信するための、こちら側の向きを表す。 int IX; // 送信関数-->受信関数間で面の情報を引き渡すための変数 int UpFaceID; // 上位(probeに近い)の dice が接続された面, -1 はシリアル通信チャネルを表す。 InBuffer *nextDoorIn; OutBuffer *nextDoorOut; OutBuffer *currentOutFace; int p; char buff[CMax]; unsigned char in; unsigned char parsingNow; int FirstTime; // first time parse int resetFlag; int thisIsProbe; int thisIsMonitoring; int echoBackUART; // // command queue for h8 // char commandFaceID[CMax]; // int cqp1; unsigned char lock; StringQueue *squeue; // unsigned char (*parse)(struct comBuffer *this); 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, char *n, int nextDoor, int nextDir); 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 init(void); 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); // int startsWithStringConst(char *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); } ; //unsigned char parseForComBuffer(struct comBuffer *this); //#endif }} ---- #counter