1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
21 * ThingResourceServer.h
24 #ifndef THINGRESOURCESERVER_H_
25 #define THINGRESOURCESERVER_H_
29 #include "OCPlatform.h"
38 #define COAP_IP "0.0.0.0"
40 #define COAP_MODE ModeType::Server
41 #define COAP_SRVTYPE ServiceType::InProc
43 #define COAP_TYPE_NAME "SSManager.Sensor"
45 // Forward declaring the entityHandler
47 class TemphumidResource
50 /// Access this property from a TB client
53 std::string m_resourceUri;
54 std::vector<std::string> m_resourceTypes;
55 std::vector<std::string> m_resourceInterfaces;
56 OCResourceHandle m_resourceHandle;
57 OCRepresentation m_resourceRep;
58 ObservationIds m_interestedObservers;
63 m_humid(0), m_temp(0), m_resourceHandle(0)
65 m_resourceUri = "/Thing_TempHumSensor";
66 m_resourceTypes.push_back(COAP_TYPE_NAME);
67 m_resourceInterfaces.push_back(DEFAULT_INTERFACE);
69 printf("Running thing as %s\n", m_resourceUri.c_str());
70 m_resourceRep.setUri(m_resourceUri);
71 m_resourceRep.setResourceTypes(m_resourceTypes);
72 m_resourceRep.setResourceInterfaces(m_resourceInterfaces);
79 void registerResource();
81 OCResourceHandle getHandle();
83 void setResourceRepresentation(OCRepresentation &rep);
85 OCRepresentation getResourceRepresentation();
88 #endif /* THINGRESOURCESERVER_H_ */