-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathURI.h
executable file
·101 lines (79 loc) · 2.63 KB
/
URI.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
/*
*
* The arduino XBeeAPI library facilitate the management, of XBee Devices configured in API Mode
* Copyright (C) 2015 Orazio Briante [email protected]
* Laboratory A.R.T.S. - University Mediterranea of Reggio Calabria - Faculty of Engineering
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef URI_H_
#define URI_H_
#include "Arduino.h"
#include "XBee.h"
namespace ndn {
#define NDN_DELIMITER ":"
#define NDN_DELIMITER_SIZE 1
#define NDN_PATH_DELIMITER "/"
#define NDN_PATH_DELIMITER_SIZE 1
#define NDN_CLOSE_DELIMITER "//"
#define NDN_CLOSE_DELIMITER_SIZE 2
#define NDN_JOLLY_PATH "/*"
#define NDN_JOLLY_PATH_SIZE 2
#define NDN_JOLLY_OBJ "*"
#define NDN_JOLLY_OBJ_SIZE 1
#define NDN_REQ "r:"
#define NDN_REQ_SIZE 2
#define NDN_ANS "a:"
#define NDN_ANS_SIZE 2
class URI {
public:
enum Type {
ANSWER = 0,
REQUEST,
CLEAN
};
protected:
String object;
String path;
String value;
Type type;
public:
URI();
URI(const String uri);
URI(const String object, const String path);
URI(const String object, const String path, const URI::Type type);
URI(const String object, const String path, const String value, const URI::Type type);
virtual ~ URI();
String getObject() const;
void setObject(const String object);
String getPath() const;
void setPath(const String path);
String getValue() const;
void setValue(const String value);
URI::Type getType() const;
void setType(URI::Type type);
void setURI(const String & uri);
String getURI() const;
String toString() const;
boolean isThisObject(const URI & uri) const;
boolean isThisPath(const URI & uri) const;
boolean equals(const URI & uri);
void send();
void send(const XBeeAddress64 & addr64);
void receive(XBeeAddress64 & addr64);
void receive(XBeeAddress64 & addr64, const unsigned long timeout);
};
} /* namespace ndn */
#endif /* URI_H_ */