-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbooth.h
More file actions
31 lines (26 loc) · 736 Bytes
/
booth.h
File metadata and controls
31 lines (26 loc) · 736 Bytes
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
#ifndef BOOTH_H
#define BOOTH_H
#include "packet.h"
#include "config.h"
class Booth
{
char type;
char id;
public:
Booth(char type, char id) :type(type), id(id) {}
char getType() { return type; }
char getID() { return id; }
Packet getSkeletonPacket(char serviceType='-') {
Packet packet;
packet.receiverType() = getType();
packet.receiverID() = getID()+'0';
packet.commandType() = serviceType;
strncpy(packet.data(), "-----", 6);
packet.extraByte() = '-';
return packet;
}
virtual Packet getPingPacket() = 0;
virtual bool processPacket(Packet &packet) = 0; //return if you need next slot
virtual void onTimout() {}
};
#endif // BOOTH_H