-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwellknowncoreresource.cpp
More file actions
62 lines (50 loc) · 1.21 KB
/
wellknowncoreresource.cpp
File metadata and controls
62 lines (50 loc) · 1.21 KB
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
#include "wellknowncoreresource.h"
WellKnownCoreResource::WellKnownCoreResource():CoAPResource()
{
answer = "</>;";
answer += "rt=\"http://schema.org/EntryPoint\";";
answer += "ct=50";
sleepyAnswer = answer;
answer += ",</config>;";
answer += "rt=\"http://";
answer += "external";
answer += "/doc#ConfigResource\";";
answer += "ct=50";
}
void WellKnownCoreResource::addResource(String resString)
{
answer += resString;
sleepyAnswer += resString;
}
char *WellKnownCoreResource::getUri()
{
return wellKnownCoreUri;
}
int WellKnownCoreResource::getMethod(uint8_t *payloadValue, int payloadLen, CoapPDU::ContentFormat contentFormat)
{
return 0;
}
bool WellKnownCoreResource::getMethodIsPrivate()
{
return false;
}
CoapPDU::Code WellKnownCoreResource::getCode()
{
return CoapPDU::COAP_CONTENT;
}
uint8_t *WellKnownCoreResource::getPayloadPointer()
{
return (uint8_t*)answer.c_str(); // FIXME
}
int WellKnownCoreResource::getPayloadLength()
{
return answer.length();
}
CoapPDU::ContentFormat WellKnownCoreResource::getContentFormat()
{
return CoapPDU::COAP_CONTENT_FORMAT_APP_LINK;
}
String WellKnownCoreResource::getSleepyAnswer()
{
return sleepyAnswer;
}