1 /******************************************************************
3 * Copyright 2015 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 ******************************************************************/
24 #ifndef HEIGHTSENSORAPP_H_
25 #define HEIGHTSENSORAPP_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"
46 #define INTERVAL_FOR_CHECK 4 // seconds
47 #define INTERVAL_FOR_MEASUREMENT 3 // seconds
48 #define INIT_VAL 1 // default value
49 #define DIFF_VAL 0.02 // default value
53 // Forward declaring the entityHandler
58 /// Access this property from a TB client
62 std::string m_resourceUri;
63 std::vector<std::string> m_resourceTypes;
64 std::vector<std::string> m_resourceInterfaces;
65 OCResourceHandle m_resourceHandle;
66 OCRepresentation m_resourceRep;
67 ObservationIds m_interestedObservers;
72 /*m_humid(0), m_temp(0), */ m_height(0), m_resourceHandle(0)
74 m_resourceUri = "/Thing_HeightSensor";
75 m_resourceTypes.push_back(COAP_TYPE_NAME);
76 m_resourceInterfaces.push_back(DEFAULT_INTERFACE);
78 printf("Running thing as %s\n", m_resourceUri.c_str());
79 m_resourceRep.setUri(m_resourceUri);
80 m_resourceRep.setResourceTypes(m_resourceTypes);
81 m_resourceRep.setResourceInterfaces(m_resourceInterfaces);
88 void registerResource();
90 OCResourceHandle getHandle();
92 void setResourceRepresentation(OCRepresentation &rep);
94 OCRepresentation getResourceRepresentation();
97 #endif /* THINGRESOURCESERVER_H_ */