-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMessage.hpp
More file actions
34 lines (30 loc) · 887 Bytes
/
Copy pathMessage.hpp
File metadata and controls
34 lines (30 loc) · 887 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
32
33
34
#ifndef Message_hpp
#define Message_hpp
#ifndef UUID_LENGTH
#define UUID_LENGTH 5
#endif
#define MESSAGE_MAX_LENGTH 16
class Message {
public:
Message();
Message(unsigned char *from, unsigned char *to, unsigned short payload, unsigned char length);
Message(unsigned char *from, unsigned char *to, char const *message);
void setLength(unsigned char length);
void setTo(unsigned char *to);
void setFrom(unsigned char *from);
void setPayload(unsigned short payload);
unsigned char getLength();
unsigned char *getTo();
unsigned char *getFrom();
unsigned short getPayload();
char *getPayloadString();
protected:
unsigned short stringToPayload(char const *message);
char *payloadToString(unsigned short payload, unsigned char length);
private:
unsigned char *sender;
unsigned char *receiver;
unsigned char length;
unsigned short payload;
};
#endif /* Message_hpp */