1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 #ifndef __INTEL_OCAPI_H_2014_07_10
22 #define __INTEL_OCAPI_H_2014_07_10
38 namespace OC { namespace OCReflect {
42 }} // namespace OC::OCReflect
46 enum class OCPlatformStatus {
51 enum class OCAdvertisementStatus{
55 typedef std::string URI;
57 enum class ServiceType
70 enum class QualityOfService : uint8_t
72 Confirmable = OC_CONFIRMABLE,
73 NonConfirmable = OC_NON_CONFIRMABLE
78 ServiceType serviceType; // This will indicate whether it is InProc or OutOfProc
79 ModeType mode; // This will indicate whether we want to do server, client or both
80 std::string ipAddress; // This is the ipAddress of the server to connect to
81 uint16_t port; // Port of the server
86 PlatformConfig(const ServiceType serviceType_,
88 const std::string& ipAddress_,
90 const QualityOfService QoS_)
91 : serviceType(serviceType_),
93 ipAddress(ipAddress_),
99 enum class RequestHandlerFlag
106 enum class ObserveType
112 // TODO: To find the complete JSon data structure and modify map value type
113 // Typedef for attribute values and attribute map.
114 typedef std::vector<std::string> AttributeValues;
115 typedef std::map<std::string, AttributeValues> AttributeMap;
117 // Typedef for query parameter map
118 typedef std::map<std::string, std::string> QueryParamsMap;
120 // const strings for different interfaces
123 const std::string DEFAULT_INTERFACE = "oc.mi.def";
125 // Used in discovering (GET) links to other resources of a collection.
126 const std::string LINK_INTERFACE = "oc.mi.ll";
128 // Used in GET, PUT, POST, DELETE methods on links to other resources of a collection.
129 const std::string BATCH_INTERFACE = "oc.mi.b";
131 // Helper function to escape character in a string.
132 std::string escapeString(const std::string& value);
134 class OCRepresentation
140 AttributeMap m_attributeMap;
141 std::vector<std::string> m_resourceTypes;
142 std::vector<std::string> m_resourceInterfaces;
143 bool m_observable; // TODO : do we need this here???
146 std::vector<OCRepresentation> m_children;
150 OCRepresentation() {}
152 std::string getUri(void) const
157 void setUri(std::string uri)
162 std::vector<OCRepresentation> getChildren(void) const
167 void setChildren(std::vector<OCRepresentation> children)
169 m_children = children;
172 OCResource* getResource() const
174 // TODO Needs to be implemented
175 OCResource* res = NULL;
180 AttributeMap getAttributeMap() const
182 return m_attributeMap;
185 void setAttributeMap(AttributeMap map)
187 m_attributeMap = map;
190 std::vector<std::string> getResourceTypes() const
192 return m_resourceTypes;
195 void setResourceTypes(std::vector<std::string> resourceTypes)
197 m_resourceTypes = resourceTypes;
200 std::vector<std::string> getResourceInterfaces(void) const
202 return m_resourceInterfaces;
205 void setResourceInterfaces(std::vector<std::string> resourceInterfaces)
207 m_resourceInterfaces = resourceInterfaces;