File: testhelper.h

package info (click to toggle)
hueplusplus 1.2.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,372 kB
  • sloc: cpp: 14,028; ansic: 70; makefile: 12
file content (283 lines) | stat: -rw-r--r-- 11,484 bytes parent folder | download
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
/**
    \file testhelper.h
    Copyright Notice\n
    Copyright (C) 2017  Jan Rogall		- developer\n
    Copyright (C) 2017  Moritz Wirger	- developer\n

    This file is part of hueplusplus.

    hueplusplus 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.

    hueplusplus 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 Lesser General Public License
    along with hueplusplus.  If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef _TEST_HELPER_H
#define _TEST_HELPER_H

inline std::string getBridgeIp()
{
    return "192.168.2.116"; //!< IP-Address of the fake hue bridge in dotted
                            //!< decimal notation like "192.168.2.1"
}

inline int getBridgePort()
{
    return 80;
}

inline std::string getBridgeUsername()
{
    return "83b7780291a6ceffbe0bd049104df"; //!< Username that is used to access
                                            //!< the fake hue bridge
}
inline std::string getBridgeId()
{
    return "111111FFFE11E111";
}
inline std::string getBridgeUuid()
{
    return "1f111f11-da11-11e1-1b11-11111111e111";
}
inline std::string getBridgeMac()
{
    return "11111111e111";
}

inline std::string getBridgeXml()
{
    return R"xml(<?xml version="1.0" encoding="UTF-8" ?>
        <root xmlns="urn:schemas-upnp-org:device-1-0">
        <specVersion>
        <major>1</major>
        <minor>0</minor>
        </specVersion>
        <URLBase>http://192.168.2.116:80/</URLBase>
        <device>
        <deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType>
        <friendlyName>Philips hue (192.168.2.116)</friendlyName>
        <manufacturer>Royal Philips Electronics</manufacturer>
        <manufacturerURL>http://www.philips.com</manufacturerURL>
        <modelDescription>Philips hue Personal Wireless Lighting</modelDescription>
        <modelName>Philips hue bridge 2015</modelName>
        <modelNumber>BSB002</modelNumber>
        <modelURL>http://www.meethue.com</modelURL>
        <serialNumber>11111111e111</serialNumber>
        <UDN>uuid:1f111f11-da11-11e1-1b11-11111111e111</UDN>
        <presentationURL>index.html</presentationURL>
        <iconList>
        <icon>
        <mimetype>image/png</mimetype>
        <height>48</height>
        <width>48</width>
        <depth>24</depth>
        <url>hue_logo_0.png</url>
        </icon>
        </iconList>
        </device>
        </root>)xml";
}

inline std::vector<std::string> getMulticastReply()
{
    return {"HTTP/1.1 200 OK\r\n"
            "CACHE-CONTROL: max-age=300\r\n"
            "DATE: Wed, 21 Jan 1970 05:42:21 GMT\r\n"
            "EXT:\r\n"
            "LOCATION: http://192.168.2.1:1900/gatedesc.xml\r\n"
            "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n"
            "01-NLS: 000c0000-0dd0-00b0-0da0-00a000e000c0\r\n"
            "SERVER: Linux/2.6.36, UPnP/1.0, Portable SDK for UPnP devices/1.6.19\r\n"
            "X-User-Agent: redsonic\r\n"
            "ST: upnp:rootdevice\r\n"
            "USN: uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00::upnp:rootdevice",

        "HTTP/1.1 200 OK\r\n"
        "CACHE-CONTROL: max-age=300\r\n"
        "DATE: Wed, 21 Jan 1970 05:42:21 GMT\r\n"
        "EXT:\r\n"
        "LOCATION: http://192.168.2.1:1900/gatedesc.xml\r\n"
        "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n"
        "01-NLS: 000c0000-0dd0-00b0-0da0-00a000e000c0\r\n"
        "SERVER: Linux/2.6.36, UPnP/1.0, Portable SDK for UPnP devices/1.6.19\r\n"
        "X-User-Agent: redsonic\r\n"
        "ST: uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00\r\n"
        "USN: uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00",

        "HTTP/1.1 200 OK\r\n"
        "CACHE-CONTROL: max-age=300\r\n"
        "DATE: Wed, 21 Jan 1970 05:42:21 GMT\r\n"
        "EXT:\r\n"
        "LOCATION: http://192.168.2.1:1900/gatedesc.xml\r\n"
        "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n"
        "01-NLS: 000c0000-0dd0-00b0-0da0-00a000e000c0\r\n"
        "SERVER: Linux/2.6.36, UPnP/1.0, Portable SDK for UPnP devices/1.6.19\r\n"
        "X-User-Agent: redsonic\r\n"
        "ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n"
        "USN: "
        "uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00::urn:schemas-upnp-org:device:"
        "InternetGatewayDevice:1",

        "HTTP/1.1 200 OK\r\n"
        "CACHE-CONTROL: max-age=300\r\n"
        "DATE: Wed, 21 Jan 1970 05:42:21 GMT\r\n"
        "EXT:\r\n"
        "LOCATION: http://192.168.2.1:1900/gatedesc.xml\r\n"
        "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n"
        "01-NLS: 000c0000-0dd0-00b0-0da0-00a000e000c0\r\n"
        "SERVER: Linux/2.6.36, UPnP/1.0, Portable SDK for UPnP devices/1.6.19\r\n"
        "X-User-Agent: redsonic\r\n"
        "ST: urn:schemas-upnp-org:service:Layer3Forwarding:1\r\n"
        "USN: "
        "uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00::urn:schemas-upnp-org:service:"
        "Layer3Forwarding:1",

        "HTTP/1.1 200 OK\r\n"
        "CACHE-CONTROL: max-age=300\r\n"
        "DATE: Wed, 21 Jan 1970 05:42:21 GMT\r\n"
        "EXT:\r\n"
        "LOCATION: http://192.168.2.1:1900/gatedesc.xml\r\n"
        "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n"
        "01-NLS: 000c0000-0dd0-00b0-0da0-00a000e000c0\r\n"
        "SERVER: Linux/2.6.36, UPnP/1.0, Portable SDK for UPnP devices/1.6.19\r\n"
        "X-User-Agent: redsonic\r\n"
        "ST: uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00\r\n"
        "USN: uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00",

        "HTTP/1.1 200 OK\r\n"
        "CACHE-CONTROL: max-age=300\r\n"
        "DATE: Wed, 21 Jan 1970 05:42:21 GMT\r\n"
        "EXT:\r\n"
        "LOCATION: http://192.168.2.1:1900/gatedesc.xml\r\n"
        "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n"
        "01-NLS: 000c0000-0dd0-00b0-0da0-00a000e000c0\r\n"
        "SERVER: Linux/2.6.36, UPnP/1.0, Portable SDK for UPnP devices/1.6.19\r\n"
        "X-User-Agent: redsonic\r\n"
        "ST: urn:schemas-upnp-org:device:WANDevice:1\r\n"
        "USN: "
        "uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00::urn:schemas-upnp-org:device:"
        "WANDevice:1",

        "HTTP/1.1 200 OK\r\n"
        "CACHE-CONTROL: max-age=300\r\n"
        "DATE: Wed, 21 Jan 1970 05:42:21 GMT\r\n"
        "EXT:\r\n"
        "LOCATION: http://192.168.2.1:1900/gatedesc.xml\r\n"
        "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n"
        "01-NLS: 000c0000-0dd0-00b0-0da0-00a000e000c0\r\n"
        "SERVER: Linux/2.6.36, UPnP/1.0, Portable SDK for UPnP devices/1.6.19\r\n"
        "X-User-Agent: redsonic\r\n"
        "ST: urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1\r\n"
        "USN: "
        "uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00::urn:schemas-upnp-org:service:"
        "WANCommonInterfaceConfig:1",

        "HTTP/1.1 200 OK\r\n"
        "CACHE-CONTROL: max-age=300\r\n"
        "DATE: Wed, 21 Jan 1970 05:42:21 GMT\r\n"
        "EXT:\r\n"
        "LOCATION: http://192.168.2.1:1900/gatedesc.xml\r\n"
        "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n"
        "01-NLS: 000c0000-0dd0-00b0-0da0-00a000e000c0\r\n"
        "SERVER: Linux/2.6.36, UPnP/1.0, Portable SDK for UPnP devices/1.6.19\r\n"
        "X-User-Agent: redsonic\r\n"
        "ST: uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00\r\n"
        "USN: uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00",

        "HTTP/1.1 200 OK\r\n"
        "CACHE-CONTROL: max-age=300\r\n"
        "DATE: Wed, 21 Jan 1970 05:42:21 GMT\r\n"
        "EXT:\r\n"
        "LOCATION: http://192.168.2.1:1900/gatedesc.xml\r\n"
        "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n"
        "01-NLS: 000c0000-0dd0-00b0-0da0-00a000e000c0\r\n"
        "SERVER: Linux/2.6.36, UPnP/1.0, Portable SDK for UPnP devices/1.6.19\r\n"
        "X-User-Agent: redsonic\r\n"
        "ST: urn:schemas-upnp-org:device:WANConnectionDevice:1\r\n"
        "USN: "
        "uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00::urn:schemas-upnp-org:device:"
        "WANConnectionDevice:1",

        "HTTP/1.1 200 OK\r\n"
        "CACHE-CONTROL: max-age=300\r\n"
        "DATE: Wed, 21 Jan 1970 05:42:21 GMT\r\n"
        "EXT:\r\n"
        "LOCATION: http://192.168.2.1:1900/gatedesc.xml\r\n"
        "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n"
        "01-NLS: 000c0000-0dd0-00b0-0da0-00a000e000c0\r\n"
        "SERVER: Linux/2.6.36, UPnP/1.0, Portable SDK for UPnP devices/1.6.19\r\n"
        "X-User-Agent: redsonic\r\n"
        "ST: urn:schemas-upnp-org:service:WANIPConnection:1\r\n"
        "USN: "
        "uuid:0f0000b0-f0da-0ad0-00b0-0000000fdf00::urn:schemas-upnp-org:service:"
        "WANIPConnection:1",

        "HTTP/1.1 200 OK\r\n"
        "HOST: 239.255.255.250:1900\r\n"
        "EXT:\r\n"
        "CACHE-CONTROL: max-age=100\r\n"
        "LOCATION: http://192.168.2.116:80/description.xml\r\n"
        "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.21.0\r\n"
        "hue-bridgeid: 111111FFFE11E111\r\n"
        "ST: upnp:rootdevice\r\n"
        "USN: uuid:1f111f11-da11-11e1-1b11-11111111e111::upnp:rootdevice",

        "HTTP/1.1 200 OK\r\n"
        "HOST: 239.255.255.250:1900\r\n"
        "EXT:\r\n"
        "CACHE-CONTROL: max-age=100\r\n"
        "LOCATION: http://192.168.2.116:80/description.xml\r\n"
        "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.21.0\r\n"
        "hue-bridgeid: 111111FFFE11E111\r\n"
        "ST: uuid:1f111f11-da11-11e1-1b11-11111111e111\r\n"
        "USN: uuid:1f111f11-da11-11e1-1b11-11111111e111",

        "HTTP/1.1 200 OK\r\n"
        "HOST: 239.255.255.250:1900\r\n"
        "EXT:\r\n"
        "CACHE-CONTROL: max-age=100\r\n"
        "LOCATION: http://192.168.2.116:80/description.xml\r\n"
        "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.21.0\r\n"
        "hue-bridgeid: 111111FFFE11E111\r\n"
        "ST: urn:schemas-upnp-org:device:basic:1\r\n"
        "USN: uuid:1f111f11-da11-11e1-1b11-11111111e111",

        "HTTP/1.1 200 OK\r\n"
        "HOST: 239.255.255.250:1900\r\n"
        "EXT:\r\n"
        "CACHE-CONTROL: max-age=100\r\n"
        "LOCATION: http://192.168.2.116:80/description.xml\r\n"
        "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.21.0\r\n"
        "hue-bridgeid: 111111FFFE11E111\r\n"
        "ST: upnp:rootdevice\r\n"
        "USN: uuid:1f111f11-da11-11e1-1b11-11111111e111::upnp:rootdevice",

        "HTTP/1.1 200 OK\r\n"
        "HOST: 239.255.255.250:1900\r\n"
        "EXT:\r\n"
        "CACHE-CONTROL: max-age=100\r\n"
        "LOCATION: http://192.168.2.116:80/description.xml\r\n"
        "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.21.0\r\n"
        "hue-bridgeid: 111111FFFE11E111\r\n"
        "ST: uuid:1f111f11-da11-11e1-1b11-11111111e111\r\n"
        "USN: uuid:1f111f11-da11-11e1-1b11-11111111e111",

        "HTTP/1.1 200 OK\r\n"
        "HOST: 239.255.255.250:1900\r\n"
        "EXT:\r\n"
        "CACHE-CONTROL: max-age=100\r\n"
        "LOCATION: http://192.168.2.116:80/description.xml\r\n"
        "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.21.0\r\n"
        "hue-bridgeid: 111111FFFE11E111\r\n"
        "ST: urn:schemas-upnp-org:device:basic:1\r\n"
        "USN: uuid:1f111f11-da11-11e1-1b11-11111111e111"};
}
#endif