replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / include / OCResource.h
index 1e413a6..e1f7bc6 100644 (file)
@@ -117,6 +117,7 @@ namespace OC
             m_uri(std::move(o.m_uri)),
             m_resourceId(std::move(o.m_resourceId)),
             m_devAddr(std::move(o.m_devAddr)),
+            m_deviceName(std::move(o.m_deviceName)),
             m_useHostString(o.m_useHostString),
             m_property(o.m_property),
             m_isCollection(o.m_isCollection),
@@ -485,6 +486,29 @@ namespace OC
         std::string host() const;
 
         /**
+        * Function to set host address information.
+        *
+        * @param host std::string host address
+        *             optionally one of
+        *                   CoAP over UDP prefix    "coap://"
+        *                   CoAP over TCP prefix    "coap+tcp://"
+        *                   CoAP over DTLS prefix   "coaps://"
+        *                   CoAP over TLS prefix    "coaps+tcp://"
+        *                   CoAP over RFCOMM prefix "coap+rfcomm://"
+        *                   CoAP over GATT prefix   "coap+gatt://"
+        *             optionally one of
+        *                   IPv6 address            "[1234::5678]"
+        *                   IPv4 address            "192.168.1.1"
+        *             optional port               ":5683"
+        *
+        * @note This should be in the format coap://address:port.
+        *       If host has different connectivity type with a given OCResource object
+        *       which was discovered after calling findResource API, raise an exception on failure.
+        *
+        */
+        void setHost(const std::string& host);
+
+        /**
         * Function to get the URI for this resource
         * @return std::string resource URI
         */
@@ -502,6 +526,8 @@ namespace OC
         *         not observable.
         */
         bool isObservable() const;
+        
+        OCDevAddr getDevAddr() const;
 
 #ifdef WITH_MQ
         /**
@@ -543,19 +569,28 @@ namespace OC
         */
         std::string sid() const;
 
+        /**
+        * Function to get a string representation of the human friendly name defined by the vendor.
+        * @note The format of the return value is subject to change and will
+        * likely change both in size and contents in the future.
+        */
+        std::string deviceName() const;
+
 #ifdef WITH_MQ
         /**
         * Function to discovery Topics from MQ Broker.
         *
         * @param queryParametersMap map which can have the query parameter name and value
         * @param attributeHandler handles callback
-
+        * @param qos the quality of communication
+        *
         * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
         * @note OCStackResult is defined in ocstack.h.
         *
         */
         OCStackResult discoveryMQTopics(const QueryParamsMap& queryParametersMap,
-                                        FindCallback attributeHandler);
+                                        MQTopicCallback attributeHandler,
+                                        QualityOfService qos);
         /**
         * Function to create Topic into MQ Broker.
         * SubTopic is also created through this method.
@@ -564,7 +599,8 @@ namespace OC
         * @param topicUri new uri of the topic which want to create
         * @param queryParametersMap map which can have the query parameter name and value
         * @param attributeHandler handles callback
-
+        * @param qos the quality of communication
+        *
         * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
         * @note OCStackResult is defined in ocstack.h.
         *
@@ -572,7 +608,8 @@ namespace OC
         OCStackResult createMQTopic(const OCRepresentation& rep,
                                     const std::string& topicUri,
                                     const QueryParamsMap& queryParametersMap,
-                                    MQCreateTopicCallback attributeHandler);
+                                    MQTopicCallback attributeHandler,
+                                    QualityOfService qos);
 #endif
 #ifdef MQ_SUBSCRIBER
         /**
@@ -581,23 +618,27 @@ namespace OC
         * @param observeType allows the client to specify how it wants to observe.
         * @param queryParametersMap map which can have the query parameter name and value
         * @param observeHandler handles callback
-
+        * @param qos the quality of communication
+        *
         * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
         * @note OCStackResult is defined in ocstack.h.
         *
         */
         OCStackResult subscribeMQTopic(ObserveType observeType,
                                        const QueryParamsMap& queryParametersMap,
-                                       ObserveCallback observeHandler);
+                                       ObserveCallback observeHandler,
+                                       QualityOfService qos);
 
         /**
         * Function to unsubscribe Topic to MQ Broker.
         *
+        * @param qos the quality of communication
+        *
         * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
         * @note OCStackResult is defined in ocstack.h.
         *
         */
-        OCStackResult unsubscribeMQTopic();
+        OCStackResult unsubscribeMQTopic(QualityOfService qos);
 
         /**
         * Function to request publish to MQ publisher.
@@ -605,13 +646,15 @@ namespace OC
         *
         * @param queryParametersMap map which can have the query parameter name and value
         * @param attributeHandler handles callback
-
+        * @param qos the quality of communication
+        *
         * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
         * @note OCStackResult is defined in ocstack.h.
         *
         */
         OCStackResult requestMQPublish(const QueryParamsMap& queryParametersMap,
-                                       PostCallback attributeHandler);
+                                       PostCallback attributeHandler,
+                                       QualityOfService qos);
 #endif
 #ifdef MQ_PUBLISHER
         /**
@@ -620,14 +663,16 @@ namespace OC
         * @param rep representation of the topic
         * @param queryParametersMap map which can have the query parameter name and value
         * @param attributeHandler handles callback
-
+        * @param qos the quality of communication
+        *
         * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
         * @note OCStackResult is defined in ocstack.h.
         *
         */
         OCStackResult publishMQTopic(const OCRepresentation& rep,
                                      const QueryParamsMap& queryParametersMap,
-                                     PostCallback attributeHandler);
+                                     PostCallback attributeHandler,
+                                     QualityOfService qos);
 #endif
         // overloaded operators allow for putting into a 'set'
         // the uniqueidentifier allows for putting into a hash
@@ -644,7 +689,6 @@ namespace OC
         bool operator>=(const OCResource &other) const;
 
     private:
-        void setHost(const std::string& host);
         std::weak_ptr<IClientWrapper> m_clientWrapper;
         std::string m_uri;
         OCResourceIdentifier m_resourceId;
@@ -656,6 +700,7 @@ namespace OC
         std::vector<std::string> m_interfaces;
         std::vector<std::string> m_children;
         OCDoHandle m_observeHandle;
+        std::string m_deviceName;
         HeaderOptions m_headerOptions;
 
     private:
@@ -663,14 +708,16 @@ namespace OC
                     const OCDevAddr& devAddr, const std::string& uri,
                     const std::string& serverId, uint8_t property,
                     const std::vector<std::string>& resourceTypes,
-                    const std::vector<std::string>& interfaces);
+                    const std::vector<std::string>& interfaces,
+                    const std::string& deviceName);
 
         OCResource(std::weak_ptr<IClientWrapper> clientWrapper,
                     const std::string& host, const std::string& uri,
                     const std::string& serverId,
                     OCConnectivityType connectivityType, uint8_t property,
                     const std::vector<std::string>& resourceTypes,
-                    const std::vector<std::string>& interfaces);
+                    const std::vector<std::string>& interfaces,
+                    const std::string& deviceName);
     };
 
 } // namespace OC