-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEFP1Message.h
executable file
·111 lines (100 loc) · 2.92 KB
/
EFP1Message.h
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
102
103
104
105
106
107
108
109
110
111
#ifndef EFP1Message_H
#define EFP1Message_H
#include <vector>
#include <string>
#define MAX_NR_FIELDS 41
using namespace std;
enum EPF1SubMessage
{
Protocol = 0,
Command,
PisteId,
CompetitionId,
PhaseNumber,
Poule_Tableau_Id,
MatchNumber,
RoundNumber,
Start_time,
StopWatch,
CompetitionType,
Weapon,
Priority,
State,
RefereeId,
RefereeName,
RefereeNation,
RightFencerId,
RightFencerName,
RightFencerNation,
RightScore,
RightStatus,
RightYCard,
RightRCard,
RightLight,
RightWhiteLight,
RightMedicalIntervention,
RightReserveIntroduction,
RightPCards,
LeftFencerId,
LeftFencerName,
LeftFencerNation,
LeftScore,
LeftStatus,
LeftYCard,
LeftRCard,
LeftLight,
LeftWhiteLight,
LeftMedicalIntervention,
LeftReserveIntroduction,
LeftPCards
};
enum MessageType
{
HELLO,
DISP,
ACK,
NAK,
INFO,
NEXT,
PREV,
ERROR
};
class EFP1Message
{
public:
/** Default constructor */
EFP1Message();
/** Constructor from string*/
EFP1Message(const std::string &Buffer);
/** Default destructor */
virtual ~EFP1Message();
/** Assignment operator
* \param other Object to assign from
* \return A reference to this
*/
EFP1Message& operator=(const EFP1Message& other);
std::string ToString(std::string & Buffer);
std::string & operator[](int i);
const std::string & operator[](int i) const;
void CopyIfNotEmpty(const EFP1Message &Source);
void Prune(const EFP1Message &Source);
void TruncateToMaxLength(void){return;} // ToDo make sure the length of the fields is conform to the specification. I don't think I really need it.
MessageType GetType() const;
string MakeNextMessageString();
string MakePrevMessageString();
void SetRed(bool value){if(value){(*this)[LeftLight]= '1';}else{(*this)[LeftLight]= '0';}};
void SetGreen(bool value){if(value){(*this)[RightLight]= '1';}else{(*this)[RightLight]= '0';}};
void SetWhiteLeft(bool value){if(value){(*this)[LeftWhiteLight]= '1';}else{(*this)[LeftWhiteLight]= '0';}};
void SetWhiteRight(bool value){if(value){(*this)[RightWhiteLight]= '1';}else{(*this)[RightWhiteLight]= '0';}};
void SwapFencersInclScoreCardsEtc();
void HandleTeamReserve(bool left, bool value);
uint8_t EFP1StatusString2Type10MessageStatus();
protected:
private:
std::vector<std::string> mGeneralFields; //!< Member variable "mGeneralFields"
std::vector<std::string> mLeftFencerFields; //!< Member variable "mLeftFencerFields"
std::vector<std::string> mRightFencerFields; //!< Member variable "mRightFencerFields"
int const GetNrOfGeneralFields()const {return 17;}
int const GetNrOfFencerFields()const ;
};
#endif // EFP1Message_H