INSTALL(FILES ${HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/${LIB})
ADD_SUBDIRECTORY(test)
+ADD_SUBDIRECTORY(notification)
--- /dev/null
+PROJECT(iotcon-notification C)
+
+SET(LIB ${PROJECT_NAME})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/notification/include ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src)
+
+MESSAGE("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
+MESSAGE("CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
+MESSAGE("LIB_INSTALL_DIR: ${LIB_INSTALL_DIR}")
+MESSAGE("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
+MESSAGE("LIB: ${LIB}")
+
+SET(SRCS
+ src/iotcon-ns-provider.c
+ src/iotcon-ns-consumer.c
+)
+
+# library
+ADD_LIBRARY(${LIB} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${LIB} ${pkgs_LIBRARIES})
+SET_TARGET_PROPERTIES(${LIB} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
+INSTALL(TARGETS ${LIB} DESTINATION ${LIB_INSTALL_DIR})
+
+# pkgconfig file
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+CONFIGURE_FILE(${LIB}.pc.in ${LIB}.pc @ONLY)
+INSTALL(FILES ${LIB}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+# header file
+FILE(GLOB HEADER include/*.h)
+INSTALL(FILES ${HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/${LIB})
+
--- /dev/null
+/*\r
+ * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+\r
+#ifndef __TIZEN_IOTCON_NS_DOC_H__\r
+#define __TIZEN_IOTCON_NS_DOC_H__\r
+\r
+/**\r
+ * @ingroup CAPI_NETWORK_FRAMEWORK\r
+ * @defgroup CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE IoTCon Notification Service\r
+ * @brief The IoTCon notification service provides notification functions for IoT connectivity.\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_HEADER Required Header\r
+ * \#include <iotcon-ns.h>\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_OVERVIEW Overview\r
+ * The iotcon notification service provides notification service features based on IoTivity service.\n\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_FEATURE Related Features\r
+ * This API is related with the following features: \n\r
+ * - http://tizen.org/feature/iot.ocf \n\r
+ * It is recommended to design feature related codes in your application for reliability. \n\r
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application. \n\r
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK. \n\r
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>\r
+ */\r
+\r
+/**\r
+ * @ingroup CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE\r
+ * @defgroup CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_COMMON Common\r
+ * @brief This provides notification provider functionality.\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_COMMON_HEADER Required Header\r
+ * \#include <iotcon-ns.h>\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_COMMON_OVERVIEW Overview\r
+ * The iotcon notification service common provides common functionality for notification service features based on IoTivity service.\n\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_COMMON_FEATURE Related Features\r
+ * This API is related with the following features: \n\r
+ * - http://tizen.org/feature/iot.ocf \n\r
+ * It is recommended to design feature related codes in your application for reliability. \n\r
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application. \n\r
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK. \n\r
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>\r
+ */\r
+\r
+/**\r
+ * @ingroup CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE\r
+ * @defgroup CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_PROVIDER Provider\r
+ * @brief This provides notification provider functionality.\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_PROVIDER_HEADER Required Header\r
+ * \#include <iotcon-ns.h>\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_PROVIDER_OVERVIEW Overview\r
+ * The iotcon notification service provider provides notification provider service features based on IoTivity service.\n\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_PROVIDER_FEATURE Related Features\r
+ * This API is related with the following features: \n\r
+ * - http://tizen.org/feature/iot.ocf \n\r
+ * It is recommended to design feature related codes in your application for reliability. \n\r
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application. \n\r
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK. \n\r
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>\r
+ */\r
+\r
+/**\r
+ * @ingroup CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE\r
+ * @defgroup CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_CONSUMER Consumer\r
+ * @brief This provides notification provider functionality.\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_CONSUMER_HEADER Required Header\r
+ * \#include <iotcon-ns.h>\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_CONSUMER_OVERVIEW Overview\r
+ * The iotcon notification service consumer provides notification consumer service features based on IoTivity service.\n\r
+ *\r
+ * @section CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_CONSUMER_FEATURE Related Features\r
+ * This API is related with the following features: \n\r
+ * - http://tizen.org/feature/iot.ocf \n\r
+ * It is recommended to design feature related codes in your application for reliability. \n\r
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application. \n\r
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK. \n\r
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>\r
+ */\r
+\r
+#endif /* __TIZEN_IOTCON_NS_DOC_H__ */\r
--- /dev/null
+/*
+ * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __IOTCON_NS_COMMON_H__
+#define __IOTCON_NS_COMMON_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+
+
+/**
+ * @file "iotcon-ns-common.h"
+ */
+
+
+/**
+ * @addtogroup CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_COMMON
+ * @{
+ */
+
+
+/**
+ * @brief The message handle for notification service.
+ * @since_tizen 4.0
+ */
+typedef struct _icl_ns_message_s *iotcon_ns_message_h;
+
+/**
+ * @brief The synchronization handle of the notification message.
+ * @since_tizen 4.0
+ */
+typedef struct _icl_ns_sync_info_s *iotcon_ns_sync_info_h;
+
+/**
+ * @brief The topic linked list handle.
+ * @since_tizen 4.0
+ */
+typedef struct _icl_ns_topic_list_s *iotcon_ns_topic_list_h;
+
+
+/**
+ * @brief Invoked when the synchronization data is received.
+ * @since_tizen 4.0
+ * @param[in] sync_info The synchronization information of the notification message
+ */
+typedef void (*iotcon_ns_sync_info_received_cb)(iotcon_ns_sync_info_h sync_info);
+
+/**
+ * @brief Provider state for notification consumer service.
+ * @since_tizen 4.0
+ */
+typedef enum {
+ IOTCON_NS_PROVIDER_STATE_ALLOW = 1, /**< ALLOW */
+ IOTCON_NS_PROVIDER_STATE_DENY = 2, /**< DENY */
+ IOTCON_NS_PROVIDER_STATE_TOPIC = 3, /**< TOPIC */
+ IOTCON_NS_PROVIDER_STATE_DISCOVERED = 11, /**< DISCOVERED */
+ IOTCON_NS_PROVIDER_STATE_STOPPED = 12 /**< STOPPED */
+} iotcon_ns_provider_state_e;
+
+/**
+ * @brief Notification message sync state.
+ * @since_tizen 4.0
+ */
+typedef enum {
+ IOTCON_NS_SYNC_STATE_UNREAD = 0, /**< UNREAD */
+ IOTCON_NS_SYNC_STATE_READ = 1, /**< READ */
+ IOTCON_NS_SYNC_STATE_DELETED = 2, /**< DELETED */
+} iotcon_ns_sync_state_e;
+
+/**
+ * @brief Notification message type.
+ * @since_tizen 4.0
+ */
+typedef enum {
+ IOTCON_NS_MESSAGE_NONE = 0, /**< NONE */
+ IOTCON_NS_MESSAGE_ALERT = 1, /**< ALERT */
+ IOTCON_NS_MESSAGE_NOTICE = 2, /**< NOTICE */
+ IOTCON_NS_MESSAGE_EVENT = 3, /**< EVENT */
+ IOTCON_NS_MESSAGE_INFO = 4, /**< INFO */
+ IOTCON_NS_MESSAGE_WARNING = 5, /**< WARNING */
+ IOTCON_NS_MESSAGE_READ = 11, /**< READ */
+ IOTCON_NS_MESSAGE_DELETED = 12 /**< DELETED */
+} iotcon_ns_message_type_e;
+
+/**
+ * @brief Notification topic state.
+ * @since_tizen 4.0
+ */
+typedef enum {
+ IOTCON_NS_TOPIC_STATE_UNSUBSCRIBED = 0, /**< UNSUBSCRIBED */
+ IOTCON_NS_TOPIC_STATE_SUBSCRIBED = 1, /**< SUBSCRIBED */
+} iotcon_ns_topic_state_e;
+
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __IOTCON_NS_COMMON_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __IOTCON_NS_CONSUMER_H__
+#define __IOTCON_NS_CONSUMER_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "iotcon-ns-common.h"
+
+/**
+ * @file iotcon-ns-consumer.h
+ */
+
+
+/**
+ * @addtogroup CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_CONSUMER
+ * @{
+ */
+
+/**
+ * @brief Invoked when the provider state is changed.
+ * @since_tizen 4.0
+ * @param[in] provider_id The provider id which has the notification resource.
+ * Provider id will be freed after this callback returns.
+ * @param[in] state The provider state
+ */
+typedef void (*iotcon_ns_provider_state_changed_cb)(char *provider_id, iotcon_ns_provider_state_e state);
+
+/**
+ * @brief Invoked when the notification message from provider is received.
+ * @since_tizen 4.0
+ * @param[in] message The notification message
+ */
+typedef void (*iotcon_ns_message_received_cb)(iotcon_ns_message_h message);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_ns_consumer_foreach_topic_list().
+ * @since_tizen 4.0
+ * @param[in] name The topic name
+ * @param[in] state The topic state
+ * @param[in] user_data The user data to pass to the function
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise @c false to break out of the loop
+ * @see iotcon_ns_consumer_foreach_topic_list()
+ */
+typedef bool (*iotcon_ns_topic_list_cb)(const char *name, iotcon_ns_topic_state_e state, void *user_data);
+
+/**
+ * @brief Start notification service for consumer.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] provider_changed_cb The callback to be invoked when the provider state is changed
+ * @param[in] message_received_cb The callback to be invoked when the notification message from provider is received
+ * @param[in] sync_info_received_cb The callback to be invoked when the synchronization data is received
+ * @return @c 0 on success, otherwise a negative error value
+ * @see iotcon_ns_consumer_stop()
+ */
+int iotcon_ns_consumer_start(iotcon_ns_provider_state_changed_cb provider_changed_cb,
+ iotcon_ns_message_received_cb message_received_cb,
+ iotcon_ns_sync_info_received_cb sync_info_received_cb);
+
+/**
+ * @brief Terminate notification service for consumer.
+ * @since_tizen 4.0
+ * @return @c 0 on success, otherwise a negative error value
+ * @see iotcon_ns_consumer_start()
+ */
+int iotcon_ns_consumer_stop(void);
+
+/**
+ * @brief Request to subscribe notification message resource of provider.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] provider_id The provider id to which consumer subscribe
+ * @return @c 0 on success, otherwise a negative error value
+ * @see iotcon_ns_consumer_unsubscribe()
+ */
+int iotcon_ns_consumer_subscribe(const char *provider_id);
+
+/**
+ * @brief Request to unsubscribe in order not to receive notification message from provider.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] provider_id The provider id to which consumer unsubscribe
+ * @return @c 0 on success, otherwise a negative error value
+ * @see iotcon_ns_consumer_subscribe()
+ */
+int iotcon_ns_consumer_unsubscribe(const char *provider_id);
+
+/**
+ * @brief Send sync state to provider in order to synchronize notification status with other consumers.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] provider_id The provider id of the Notification message
+ * @param[in] message_id The Notification message id to synchronize the state
+ * @param[in] state The sync state
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_send_sync_info(const char *provider_id, unsigned long long message_id,
+ iotcon_ns_sync_state_e state);
+/**
+ * @brief Request to discover provider manually.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_rescan(void);
+
+/**
+ * @brief Calls a function for each element of the topic list
+ * @since_tizen 4.0
+ * @param[in] provider_id The provider id
+ * @param[in] cb The callback function to invoke
+ * @param[in] user_data The user data to pass to the function
+ * @return @c 0 on success, otherwise a negative error value
+ * @see iotcon_ns_topic_list_cb()
+ */
+int iotcon_ns_consumer_foreach_topic_list(const char *provider_id, iotcon_ns_topic_list_cb cb, void *user_data);
+
+/**
+ * @brief Update the topic list that is wanted to subscribe or unsubscribe from provider.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] provider_id The provider id which send the notification message
+ * @param[in] topic_list The topic list that consumer wants to set
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_update_topic_list(const char *provider_id, iotcon_ns_topic_list_h topic_list);
+
+/**
+ * @brief Get message id in message handle.
+ * @since_tizen 4.0
+ * @param[in] message The notification message handle which is received from provider
+ * @param[out] message_id The message id
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_message_get_id(iotcon_ns_message_h *message, unsigned long long *message_id);
+
+/**
+ * @brief Get message id in message handle.
+ * @since_tizen 4.0
+ * @remarks You must release @c provider_id using free()
+ * @param[in] message The notification message handle which is received from provider
+ * @param[out] provider_id The message id
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_message_get_provider_id(iotcon_ns_message_h *message, char **provider_id);
+
+/**
+ * @brief Get message type in message handle.(optional)
+ * @since_tizen 4.0
+ * @param[in] message The notification message handle which is received from provider
+ * @param[out] type The message type (#iotcon_ns_message_type_e)
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_message_get_type(iotcon_ns_message_h *message, iotcon_ns_message_type_e *type);
+
+/**
+ * @brief Get date time in message handle.(optional)
+ * @since_tizen 4.0
+ * @remarks You must release @c date_time using free()
+ * @param[in] message The notification message handle which is received from provider
+ * @param[out] date_time The date time
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_message_get_date_time(iotcon_ns_message_h *message, char **date_time);
+
+/**
+ * @brief Get ttl in message handle.(optional)
+ * @since_tizen 4.0
+ * @param[in] message The notification message handle which is received from provider
+ * @param[out] ttl The time to live
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_message_get_ttl(iotcon_ns_message_h *message, unsigned long long *ttl);
+
+/**
+ * @brief Get the title in message handle.(optional)
+ * @since_tizen 4.0
+ * @remarks You must release @c title using free()
+ * @param[in] message The notification message handle which is received from provider
+ * @param[out] title The title
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_message_get_title(iotcon_ns_message_h *message, char **title);
+
+/**
+ * @brief Get the content text in message handle.(optional)
+ * @since_tizen 4.0
+ * @remarks You must release @c content_text using free()
+ * @param[in] message The notification message handle which is received from provider
+ * @param[out] content_text The content text
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_message_get_content_text(iotcon_ns_message_h *message, char **content_text);
+
+/**
+ * @brief Get the source name in message handle.(optional)
+ * @since_tizen 4.0
+ * @remarks You must release @c source_name using free()
+ * @param[in] message The notification message handle which is received from provider
+ * @param[out] source_name The source name
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_message_get_source_name(iotcon_ns_message_h *message, char **source_name);
+
+/**
+ * @brief Get the icon image in message handle.(optional)
+ * @since_tizen 4.0
+ * @remarks You must release @c icon_image using free()
+ * @param[in] message The notification message handle which is received from provider
+ * @param[out] icon_image The icon image
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_message_get_icon_image(iotcon_ns_message_h *message, char **icon_image);
+
+/**
+ * @brief Get the topic name in message handle.(optional)
+ * @since_tizen 4.0
+ * @remarks You must release @c topic_name using free()
+ * @param[in] message The notification message handle which is received from provider
+ * @param[out] topic_name The topic name
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_consumer_message_get_topic_name(iotcon_ns_message_h *message, char **topic_name);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __IOTCON_NS_CONSUMER_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __IOTCON_NS_PROVIDER_H__
+#define __IOTCON_NS_PROVIDER_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "iotcon-ns-common.h"
+
+/**
+ * @file iotcon-ns-provider.h
+ */
+
+
+/**
+ * @addtogroup CAPI_IOT_CONNECTIVITY_NOTIFICATION_SERVICE_PROVIDER
+ * @{
+ */
+
+/**
+ * @brief Invoked when provider receives the subscription request of consumer.
+ * @since_tizen 4.0
+ * @param[in] consumer_id The consumer id which subscribes the notification message resource
+ * Consumer id will be freed after this callback returns.
+ */
+typedef void (*iotcon_ns_subscription_request_cb)(char *consumer_id);
+
+
+// TODO need to recheck what is param's usage
+/**
+ * @brief Start notification service for provider.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] subscription_request_cb The callback to be invoked when the subscription request from consumer is received
+ * @param[in] sync_info_cb The callback to be invoked when the synchronization data, read and deleted, is sent by consumer is received
+ * @param[in] sub_controllability Set the subscription policy for notification service which checks whether provider is capable of
+ * denying the subscription of notification message from consumer
+ * and getting controllabliity to set consumer topic list.
+ * If true, provider is able to control subscription request and consumer topic list.
+ * @param[in] resource_security Set on/off for secure resource channel setting
+ * @return @c 0 on success, otherwise a negative error value
+ * @see iotcon_ns_provider_stop()
+ */
+int iotcon_ns_provider_start(iotcon_ns_subscription_request_cb subscription_request_cb,
+ iotcon_ns_sync_info_received_cb sync_info_cb,
+ bool sub_controllability, bool resource_security); // TODO: check whether separate cb set api is needed or not.
+
+/**
+ * @brief Terminate notification service for provider.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @see iotcon_ns_provider_start()
+ */
+int iotcon_ns_provider_stop(void);
+
+/**
+ * @brief Send notification message to all subscribers.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] msg The notification message including provider id, message id, title, content text
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_provider_send_msg(iotcon_ns_message_h msg);
+
+/**
+ * @brief Send acceptance to consumer which subscribes the resource of notification message.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @remarks This function is valid only when sub_controllability is set true.
+ * @param[in] consumer_id The consumer id which subscribes the resource
+ * @param[in] accepted The result of acceptance
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_provider_accept_subscription(const char *consumer_id, bool accepted);
+
+/**
+ * @brief Send synchronizad state of notificaion message to consumers.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] message_id The Notification message id to synchronize the state
+ * @param[in] state The sync state
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_provider_send_sync_info(unsigned long long message_id, iotcon_ns_sync_state_e state);
+
+/**
+ * @brief Create notification message.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @remarks message handle will be returned with mandatory fields which message id and provider id are filled with.
+ * @param[out] msg The Notification message handle
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_provider_create_message(iotcon_ns_message_h *msg);
+
+/**
+ * @brief Add topic to topic list which is located in provider service storage.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] topic_name The topic name to add
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_provider_register_topic(const char *topic_name);
+
+/**
+ * @brief Delete topic from topic list
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] topic_name The topic name to delete
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_provider_unregister_topic(const char *topic_name);
+
+// TODO: what is set /unset conumser_topic API??
+/**
+ * @brief Select a topic name for a consumer
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] consumer_id The consumer id for which the user on provider selects a topic
+ * @param[in] topic_name The topic name to select
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_provider_set_consumer_topic(const char *consumer_id, const char *topic_name);
+
+/**
+ * @brief Unselect a topic from the topic list for consumer
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] consumer_id The consumer id for which the user on provider unselects a topic
+ * @param[in] topic_name The topic name to unselect
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_provider_unset_consumer_topic(const char *consumer_id, const char *topic_name);
+
+/**
+ * @brief Get the list of topics with subscription state for the consumer
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[in] consumer_id The consumer id for which topic list is subscribed for
+ * @param[out] topic_listThe topic list
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_provider_get_consumer_topics(const char *consumer_id, iotcon_ns_topic_list_h *topic_list);
+
+/**
+ * @brief Get the list of topics which are registered by provider
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ * @param[out] topic_list The topic list
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int iotcon_ns_provider_get_topics(iotcon_ns_topic_list_h *topic_list); // TODO: change it to foreach API
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __IOTCON_NS_PROVIDER_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __IOTCON_NS_H__
+#define __IOTCON_NS_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "iotcon-ns-common.h"
+#include "iotcon-ns-provider.h"
+#include "iotcon-ns-consumer.h"
+
+/**
+ * @file "iotcon-ns.h"
+ * @brief This file contains iotcon notification service related headers.
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __IOTCON_NS_H__ */
--- /dev/null
+//******************************************************************
+//
+// Copyright 2016 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+/**
+ * @file
+ *
+ * This file provides APIs of Notification Service for common functions.
+ */
+
+#ifndef _NS_COMMON_H_
+#define _NS_COMMON_H_
+
+#include <stdint.h>
+#include <octypes.h>
+
+#define NS_UUID_STRING_SIZE 37
+//#define WITH_MQ
+/**
+ * Result code of notification service
+ */
+typedef enum eResult
+{
+ NS_OK = 100,
+ NS_ERROR = 200,
+ NS_SUCCESS = 300,
+ NS_FAIL = 400,
+
+} NSResult;
+
+/**
+ * Provider state of notification consumer service
+ */
+typedef enum
+{
+ NS_ALLOW = 1,
+ NS_DENY = 2,
+ NS_TOPIC = 3,
+ NS_DISCOVERED = 11,
+ NS_STOPPED = 12
+} NSProviderState;
+
+/**
+ * Notification message status to synchronize
+ */
+typedef enum
+{
+ NS_SYNC_UNREAD = 0,
+ NS_SYNC_READ = 1,
+ NS_SYNC_DELETED = 2,
+
+} NSSyncType;
+
+/**
+ * Notification Message Type
+ * Alert mean is High / critical
+ * Notice mean is low / critical
+ * Event mean is High / Normal
+ * Information mean is Low / Normal
+ */
+typedef enum
+{
+ NS_MESSAGE_ALERT = 1,
+ NS_MESSAGE_NOTICE = 2,
+ NS_MESSAGE_EVENT = 3,
+ NS_MESSAGE_INFO = 4,
+ NS_MESSAGE_WARNING = 5,
+ NS_MESSAGE_READ = 11,
+ NS_MESSAGE_DELETED = 12
+
+} NSMessageType;
+
+/**
+ * Notification topic state
+ */
+typedef enum
+{
+ NS_TOPIC_UNSUBSCRIBED = 0,
+ NS_TOPIC_SUBSCRIBED = 1,
+
+} NSTopicState;
+
+/**
+ * Topic linked list
+ */
+typedef struct _nsTopic
+{
+ char * topicName;
+ NSTopicState state;
+ struct _nsTopic * next;
+
+} NSTopicLL;
+
+/**
+ * Consumer information
+ */
+typedef struct
+{
+ char consumerId[NS_UUID_STRING_SIZE];
+
+} NSConsumer;
+
+/**
+ * Provider information
+ */
+typedef struct
+{
+ char providerId[NS_UUID_STRING_SIZE];
+
+} NSProvider;
+
+/**
+ * Media Contents of Notification Message (Optional)
+ */
+typedef struct
+{
+ char * iconImage;
+
+} NSMediaContents;
+
+/**
+ * Notification Message
+ */
+typedef struct
+{
+ //Mandatory
+ uint64_t messageId;
+ char providerId[NS_UUID_STRING_SIZE];
+
+ //optional
+ NSMessageType type;
+ char * dateTime;
+ uint64_t ttl;
+ char * title;
+ char * contentText;
+ char * sourceName;
+ NSMediaContents * mediaContents;
+ char * topic;
+ OCRepPayload * extraInfo;
+
+} NSMessage;
+
+/**
+ * Synchronization information of the notification message
+ */
+typedef struct
+{
+ uint64_t messageId;
+ char providerId[NS_UUID_STRING_SIZE];
+ NSSyncType state;
+
+} NSSyncInfo;
+
+#endif /* _NS_COMMON_H_ */
+
--- /dev/null
+//******************************************************************
+//
+// Copyright 2016 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+/**
+ * @file
+ *
+ * This file provides APIs of Notification Service for Consumer.
+ */
+
+#ifndef _NS_CONSUMER_INTERFACE_H_
+#define _NS_CONSUMER_INTERFACE_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+#include "NSCommon.h"
+
+/**
+ * Invoked when the provider state is changed
+ * @param[in] provider Provider which has the notification resource
+ * @param[in] state Response which has the provider state
+ */
+typedef void (* NSProviderStateCallback)(NSProvider *, NSProviderState);
+
+/**
+ * Invoked when the notification message from provider is received
+ * synchronization
+ * @param[in] message Notification message
+ */
+typedef void (* NSMessageReceivedCallback)(NSMessage *);
+
+/**
+ * Invoked when the synchronization data which has notification message
+ * read/delete event from provider/consumer is received
+ * synchronization
+ * @param[in] syncInfo Synchronization information of the notification message
+ */
+typedef void (* NSSyncInfoReceivedCallback)(NSSyncInfo *);
+
+typedef struct
+{
+ NSProviderStateCallback changedCb;
+ NSMessageReceivedCallback messageCb;
+ NSSyncInfoReceivedCallback syncInfoCb;
+
+} NSConsumerConfig;
+
+/**
+ * Initialize notification service for consumer
+ * @param[in] config NSConsumerconfig structure of callback functions
+ * @return ::NS_OK or result code of NSResult
+ */
+NSResult NSStartConsumer(NSConsumerConfig config);
+
+/**
+ * Terminate notification service for consumer
+ * @return ::NS_OK or result code of NSResult
+ */
+NSResult NSStopConsumer();
+
+/**
+ * Request to discover to remote address as parameter.
+ * @param[in] server address combined with IP address and port number using delimiter :
+ * @return ::NS_OK or result code of NSResult
+ */
+NSResult NSConsumerEnableRemoteService(const char * serverAddress);
+
+#ifdef WITH_MQ
+/**
+ * Request to subscribe to remote MQ address as parameter.
+ * @param[in] server address combined with IP address and port number and MQ broker uri using delimiter :
+ * @param[in] topicName the interest MQ Topic name for subscription.
+ * @return ::NS_OK or result code of NSResult
+ */
+NSResult NSConsumerSubscribeMQService(const char * serverAddress, const char * topicName);
+#endif
+
+/**
+ * Request discovery manually
+ * @return ::NS_OK or result code of NSResult
+ */
+NSResult NSRescanProvider();
+
+/**
+ * Request to subscribe notification message resource of provider
+ * @param[in] providerId the Id of Provider who send the notification message
+ * @return ::NS_OK or result code of NSResult
+ */
+NSResult NSSubscribe(const char * providerId);
+
+/**
+ * Request to unsubscribe in order not to receive notification message from provider
+ * @param[in] providerId the Id of Provider who send the notification message
+ * @return ::NS_OK or result code of NSResult
+ */
+NSResult NSUnsubscribe(const char * providerId);
+
+/**
+ * Send sync type to provider in order to synchronize notification status with other consumers
+ * when consumer consumes the notification such as READ, DELETE
+ * @param[in] providerId Provider id of the Notification message
+ * @param[in] messageId Notification message id to synchronize the status
+ * @param[in] type changed notification status from NSSyncType
+ * @return ::NS_OK or result code of NSResult
+ */
+NSResult NSConsumerSendSyncInfo(
+ const char * providerId, uint64_t messageId, NSSyncType type);
+
+/**
+ * Request NSProvider that is matched by provider id
+ * @param[in] providerId the id of provider that user wants to get
+ * @return NSProvider
+ */
+NSProvider * NSConsumerGetProvider(const char * providerId);
+
+/**
+ * Request NSTopic list that is subscribed from provider
+ * @param[in] providerId the Id of provider that user wants to get
+ * @return NSResult
+ */
+NSTopicLL * NSConsumerGetTopicList(const char * providerId);
+
+/**
+ * Select Topic list that is wanted to subscribe from provider
+ * @param[in] providerId the Id of provider that user wants to set
+ * @param[in] topics the topic list that user wants to set
+ * @return NSResult
+ */
+NSResult NSConsumerUpdateTopicList(const char * providerId, NSTopicLL * topics);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // _NS_CONSUMER_INTERFACE_H_
--- /dev/null
+//******************************************************************\r
+//\r
+// Copyright 2016 Samsung Electronics All Rights Reserved.\r
+//\r
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
+\r
+/**\r
+ * @file\r
+ *\r
+ * This file provides APIs of Notification Service for Provider.\r
+ */\r
+\r
+#ifndef _NS_PROVIDER_INTERFACE_H_\r
+#define _NS_PROVIDER_INTERFACE_H_\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif // __cplusplus\r
+\r
+#include "NSCommon.h"\r
+#include <stdbool.h>\r
+#include <stdint.h>\r
+/**\r
+ * Invoked when provider receives the subscription request of consumer.\r
+ * @param[in] consumer Consumer who subscribes the notification message resource\r
+ */\r
+typedef void (*NSSubscribeRequestCallback)(NSConsumer *);\r
+\r
+/**\r
+ * Invoked when synchronization data which has notification message\r
+ * read/deleted event from consumer is received.\r
+ * @param[in] sync Synchronization information of the notification message\r
+ */\r
+typedef void (*NSProviderSyncInfoCallback)(NSSyncInfo *);\r
+\r
+/**\r
+ * Set provider service with the following configuration\r
+ */\r
+typedef struct\r
+{\r
+ /* Invoked when the subscription request from consumer is received */\r
+ NSSubscribeRequestCallback subRequestCallback;\r
+ /* Invoked when the synchronization data, read and deleted, is sent by consumer is received */\r
+ NSProviderSyncInfoCallback syncInfoCallback;\r
+ /* Set the policy for notification servcie which checks whether provider is capable of \r
+ * denying the subscription of notification message from consumer\r
+ * and getting controllabliity to set consumer topic list.\r
+ * If true, provider is able to control subscription request and consumer topic list.\r
+ * Otherwise(policy is false), consumer can do the same.\r
+ */\r
+ bool subControllability;\r
+ /* User defined information such as device friendly name */\r
+ char * userInfo;\r
+ /* Set on/off for secure resource channel setting */\r
+ bool resourceSecurity;\r
+\r
+} NSProviderConfig;\r
+\r
+/**\r
+ * Initialize notification service for provider\r
+ * @param[in] config Refer to NSProviderConfig\r
+ * @return ::NS_OK if the action is requested succesfully\r
+ */\r
+NSResult NSStartProvider(NSProviderConfig config);\r
+\r
+/**\r
+ * Terminate notification service for provider\r
+ * @return ::NS_OK if the action is requested succesfully\r
+ */\r
+NSResult NSStopProvider();\r
+\r
+/**\r
+ * Request to publish resource using remote relay server\r
+ * @param[in] server address combined with IP address and port number using delimiter :\r
+ * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.\r
+ */\r
+NSResult NSProviderEnableRemoteService(char * serverAddress);\r
+\r
+/**\r
+ * Request to terminate remote service from relay server\r
+ * @param[in] server address combined with IP address and port number using delimiter :\r
+ * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.\r
+ */\r
+NSResult NSProviderDisableRemoteService(char * serverAddress);\r
+\r
+#ifdef WITH_MQ\r
+/**\r
+ * Request to subscribe to remote MQ address as parameter.\r
+ * @param[in] server address combined with IP address and port number and MQ broker uri using delimiter :\r
+ * @param[in] topicName the interest Topic name for subscription.\r
+ * @return ::NS_OK or result code of NSResult\r
+ */\r
+NSResult NSProviderSubscribeMQService(const char * serverAddress, const char * topicName);\r
+#endif\r
+\r
+/**\r
+ * Send notification message to all subscribers\r
+ * @param[in] message Notification message including id, title, contentText\r
+ * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.\r
+ */\r
+NSResult NSSendMessage(NSMessage * msg);\r
+\r
+/**\r
+ * Send acceptance to consumer who subscribes the resource of notification message\r
+ * This function is valid only when subControllability is set true.\r
+ * @param[in] consumer Consumer who subscribes the resource\r
+ * @param[in] accepted the result of acceptance; ALLOW or DENY\r
+ * @return ::NS_OK if this function is requested succesfully\r
+ * or NS_FAIL if subContollability is false.\r
+ */\r
+NSResult NSAcceptSubscription(const char * consumerId, bool accepted);\r
+\r
+/**\r
+ * Send synchronizad state of notificaion message to consumers\r
+ * @param[in] messageiId ID of notification message\r
+ * @param[in] type SyncType of the syncInfo message\r
+ * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.\r
+ */\r
+NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type);\r
+\r
+/**\r
+ * Initialize NSMessage struct.\r
+ * Service sets mandatory fields which message id and provider(device) id are filled with.\r
+ * @return ::NSMessage *\r
+ */\r
+NSMessage * NSCreateMessage();\r
+\r
+/**\r
+ * Add topic to topic list which is located in provider service storage\r
+ * @param[in] topicName Topic name to add\r
+ * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.\r
+ */\r
+NSResult NSProviderRegisterTopic(const char * topicName);\r
+\r
+/**\r
+ * Delete topic from topic list\r
+ * @param[in] topicName Topic name to delete\r
+ * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.\r
+ */\r
+NSResult NSProviderUnregisterTopic(const char * topicName);\r
+\r
+/**\r
+ * Select a topic name for a consumer\r
+ * @param[in] consumerId consumer id for which the user on provider selects a topic\r
+ * @param[in] topicName Topic name to select\r
+ * @return ::NS_OK if the action is requested succesfully or NS_FAIL if subContollability is false\r
+ */\r
+NSResult NSProviderSetConsumerTopic(const char * consumerId, const char * topicName);\r
+\r
+/**\r
+ * Unselect a topic from the topic list for consumer\r
+ * @param[in] consumerId consumer id for which the user on provider unselects a topic\r
+ * @param[in] topicName Topic name to unselect\r
+ * @return ::NS_OK if the action is requested succesfully or NS_FAIL if subContollability is false\r
+ */\r
+NSResult NSProviderUnsetConsumerTopic(const char * consumerId, const char * topicName);\r
+\r
+/**\r
+ * Request topic list with selection state for the consumer\r
+ * @param[in] consumerid the id of consumer which topic list is subscribed for\r
+ * @return :: Topic list\r
+ */\r
+NSTopicLL * NSProviderGetConsumerTopics(const char * consumerId);\r
+\r
+/**\r
+ * Request topics list already registered by provider user\r
+ * @return :: Topic list\r
+ */\r
+NSTopicLL * NSProviderGetTopics();\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif // __cplusplus\r
+\r
+#endif /* _NS_PROVIDER_INTERFACE_H_ */\r
+\r
--- /dev/null
+/*
+ * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __IC_NS_COMMON_H__
+#define __IC_NS_COMMON_H__
+
+#include <stdint.h>
+#include "iotcon-ns-common.h"
+
+#include "iotcon-errors.h"
+#include "ic-log.h" // TODO: need to add separate file
+#include "ic-utils.h" // TODO: need to add separate file
+
+#ifdef API
+#undef API
+#endif
+#define API __attribute__((visibility("default")))
+/**************************************************************/
+#if 0 // TODO: removed
+
+#define ICL_NS_UUID_STRING_SIZE 37
+
+typedef struct _icl_ns_provider_s {
+ char provider_id[ICL_NS_UUID_STRING_SIZE];
+} icl_ns_provider_s;
+
+typedef struct _icl_ns_consumer_s {
+ char consumer_id[ICL_NS_UUID_STRING_SIZE];
+} icl_ns_consumer_s;
+#endif
+
+typedef struct _icl_ns_message_s {
+ /* Mandatory */
+ unsigned long long message_id;
+ char *provider_id;
+
+ /* Optional */
+ // TODO check whether all param is needed or not
+ iotcon_ns_message_type_e type;
+ char *date_time;
+ unsigned long long ttl;
+ char *title;
+ char *content_text;
+ char *source_name;
+ char *icon_image;
+ char *topic_name;
+} icl_ns_message_s;
+
+typedef struct _icl_ns_sync_info_s {
+ unsigned long long message_id;
+ char *provider_id;
+ iotcon_ns_sync_state_e state;
+} icl_ns_sync_info_s;
+
+typedef struct _icl_ns_topic_list_s {
+ char *topic_name;
+ iotcon_ns_topic_state_e topic_state;
+ struct _icl_ns_topic_list_s *next;
+} icl_ns_topic_list_s;
+
+#endif /* __IC_NS_COMMON_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ic-ns-common.h"
+#include "iotcon-ns-consumer.h"
+
+#include <NSConsumerInterface.h>
+
+/* TODO : need to check whether handler is introduced instead of many global variable as below */
+/*
+typedef struct {
+ bool consumer_started;
+ iotcon_ns_provider_state_changed_cb provider_cb;
+ iotcon_ns_message_received_cb msg_cb;
+ iotcon_ns_sync_info_received_cb sync_cb;
+ void *user_data;
+} iotcon_ns_consumer_h;
+static iotcon_ns_consumer_h g_consumer;
+*/
+static bool g_consumer_started = false;
+static iotcon_ns_provider_state_changed_cb g_provider_changed_cb;
+static iotcon_ns_message_received_cb g_message_received_cb;
+static iotcon_ns_sync_info_received_cb g_sync_info_received_cb;
+
+static void on_provider_changed(NSProvider *ioty_provider, NSProviderState ioty_state)
+{
+ FN_CALL;
+ DBG("providerId :[%s], state :[%d]", ioty_provider->providerId, ioty_state);
+
+ char *provider_id = NULL;
+ iotcon_ns_provider_state_e state;
+
+ if (ioty_provider->providerId)
+ provider_id = strdup(ioty_provider->providerId);
+ state = ioty_state;
+
+ if (g_provider_changed_cb)
+ g_provider_changed_cb(provider_id, state);
+
+ free(provider_id);
+}
+static void on_messsage_received(NSMessage *ioty_msg)
+{
+ FN_CALL;
+ DBG("messageId :[%lld]", (long long int)ioty_msg->messageId);
+ DBG("providerId : [%s]", ioty_msg->providerId);
+ DBG("type : [%d]", ioty_msg->type);
+ DBG("dateTime : [%s]", ioty_msg->dateTime);
+ DBG("ttl : [%lld]", (long long int)ioty_msg->ttl);
+ DBG("title : [%s]", ioty_msg->title);
+ DBG("content : [%s]", ioty_msg->contentText);
+ DBG("source : [%s]", ioty_msg->sourceName);
+ DBG("topic : [%s]", ioty_msg->topic);
+
+ iotcon_ns_message_h message = NULL;
+ message = calloc(1, sizeof(icl_ns_message_s));
+ if (NULL == message) {
+ ERR("calloc() Fail(%d)", errno);
+ return;
+ }
+
+ /* Mandatory */
+ message->message_id = ioty_msg->messageId;
+ if (ioty_msg->providerId)
+ message->provider_id = strdup(ioty_msg->providerId);
+
+ /* Optional */
+ message->type = ioty_msg->type;
+ if (ioty_msg->dateTime)
+ message->date_time = strdup(ioty_msg->dateTime);
+ message->ttl = ioty_msg->ttl;
+ if (ioty_msg->title)
+ message->title = strdup(ioty_msg->title);
+ if (ioty_msg->contentText)
+ message->content_text = strdup(ioty_msg->contentText);
+ if (ioty_msg->sourceName)
+ message->source_name = strdup(ioty_msg->sourceName);
+ if (ioty_msg->mediaContents && ioty_msg->mediaContents->iconImage)
+ message->icon_image = strdup(ioty_msg->mediaContents->iconImage);
+ if (ioty_msg->topic)
+ message->topic_name = strdup(ioty_msg->topic);
+
+ if (g_message_received_cb)
+ g_message_received_cb(message);
+
+ free(message->provider_id);
+ free(message->date_time);
+ free(message->title);
+ free(message->content_text);
+ free(message->source_name);
+ free(message->icon_image);
+ free(message->topic_name);
+ free(message);
+}
+
+static void on_sync_info_received(NSSyncInfo *ioty_sync_info)
+{
+ FN_CALL;
+ DBG("messageId :[%lld]", (long long int)ioty_sync_info->messageId);
+ DBG("providerId :[%s], sync state :[%d]", ioty_sync_info->providerId, ioty_sync_info->state);
+
+ iotcon_ns_sync_info_h sync_info = NULL;
+ sync_info = calloc(1, sizeof(icl_ns_sync_info_s));
+ if (NULL == sync_info) {
+ ERR("calloc() Fail(%d)", errno);
+ return;
+ }
+
+ sync_info->message_id = ioty_sync_info->messageId;
+ if (ioty_sync_info->providerId)
+ sync_info->provider_id = strdup(ioty_sync_info->providerId);
+ sync_info->state = ioty_sync_info->state;
+
+ if (g_sync_info_received_cb)
+ g_sync_info_received_cb(sync_info);
+
+ free(sync_info->provider_id);
+ free(sync_info);
+}
+
+API int iotcon_ns_consumer_start(iotcon_ns_provider_state_changed_cb provider_changed_cb,
+ iotcon_ns_message_received_cb message_received_cb,
+ iotcon_ns_sync_info_received_cb sync_info_received_cb)
+{
+ API_CALL;
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET), IOTCON_ERROR_PERMISSION_DENIED);
+
+ RETV_IF(NULL == provider_changed_cb, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == message_received_cb, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == sync_info_received_cb, IOTCON_ERROR_INVALID_PARAMETER);
+
+ if (g_consumer_started) {
+ ERR("Already started");
+ return IOTCON_ERROR_ALREADY;
+ }
+
+ NSConsumerConfig config = {0,};
+ config.changedCb = on_provider_changed;
+ config.messageCb = on_messsage_received;
+ config.syncInfoCb = on_sync_info_received;
+
+ int ret = NSStartConsumer(config);
+ if (NS_OK != ret) {
+ ERR("NSStartConsumer() Fail(%d)", ret);
+ return IOTCON_ERROR_IOTIVITY;
+ }
+
+ g_consumer_started = true;
+ g_provider_changed_cb = provider_changed_cb;
+ g_message_received_cb = message_received_cb;
+ g_sync_info_received_cb = sync_info_received_cb;
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_stop(void)
+{
+ API_CALL;
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+
+ if (!g_consumer_started) {
+ ERR("consumer is not started");
+ return IOTCON_ERROR_IOTIVITY;
+ }
+
+ int ret = NSStopConsumer();
+ if (NS_OK != ret) {
+ ERR("NSStopConsumer() Fail(%d)", ret);
+ return IOTCON_ERROR_IOTIVITY;
+ }
+
+ g_consumer_started = false;
+ g_provider_changed_cb = NULL;
+ g_message_received_cb = NULL;
+ g_sync_info_received_cb = NULL;
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_subscribe(const char *provider_id)
+{
+ API_CALL;
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET), IOTCON_ERROR_PERMISSION_DENIED);
+
+ RETV_IF(NULL == provider_id, IOTCON_ERROR_INVALID_PARAMETER);
+
+ int ret = NSSubscribe(provider_id);
+ if (NS_OK != ret) {
+ ERR("NSSubscribe() Fail(%d)", ret);
+ return IOTCON_ERROR_IOTIVITY;
+ }
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_unsubscribe(const char *provider_id)
+{
+ API_CALL;
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET), IOTCON_ERROR_PERMISSION_DENIED);
+
+ RETV_IF(NULL == provider_id, IOTCON_ERROR_INVALID_PARAMETER);
+
+#if 0 /* TODO: need to fix iotivity (there is no NSUnsubscribe API in iotivity header files) */
+ int ret = NSUnsubscribe(provider_id);
+ if (NS_OK != ret) {
+ ERR("NSUnsubscribe() Fail(%d)", ret);
+ return IOTCON_ERROR_IOTIVITY;
+ }
+#endif
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_send_sync_info(const char *provider_id, unsigned long long message_id,
+ iotcon_ns_sync_state_e state)
+{
+ API_CALL;
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET), IOTCON_ERROR_PERMISSION_DENIED);
+
+ RETV_IF(NULL == provider_id, IOTCON_ERROR_INVALID_PARAMETER);
+
+ int ret = NSConsumerSendSyncInfo(provider_id, message_id, state);
+ if (NS_OK != ret) {
+ ERR("NSConsumerSendSyncInfo() Fail(%d)", ret);
+ return IOTCON_ERROR_IOTIVITY;
+ }
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_rescan(void)
+{
+ API_CALL;
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET), IOTCON_ERROR_PERMISSION_DENIED);
+
+ int ret = NSRescanProvider();
+ if (NS_OK != ret) {
+ ERR("NSRescanProvider() Fail(%d)", ret);
+ return IOTCON_ERROR_IOTIVITY;
+ }
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_foreach_topic_list(const char *provider_id, iotcon_ns_topic_list_cb cb, void *user_data)
+{
+ API_CALL;
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+
+ RETV_IF(NULL == provider_id, IOTCON_ERROR_INVALID_PARAMETER);
+
+ NSTopicLL *ioty_list = NULL;
+ ioty_list = NSConsumerGetTopicList(provider_id);
+ if (ioty_list) {
+ NSTopicLL *iter = ioty_list;
+ while (iter) {
+ DBG("topicName:[ %s]\t, state: %d\n", iter->topicName, iter->state);
+ if (false == cb(iter->topicName, iter->state, user_data))
+ break;
+ iter = iter->next;
+ }
+ }
+
+ return IOTCON_ERROR_NONE;
+}
+
+static NSTopicLL *_topic_list_shallow_copy(iotcon_ns_topic_list_h list)
+{
+ if (NULL == list)
+ return NULL;
+
+ NSTopicLL *ioty_list = NULL;
+ NSTopicLL *ioty_last;
+
+ ioty_list = calloc(1, sizeof(NSTopicLL));
+ ioty_list->topicName = list->topic_name;
+ ioty_list->state = list->topic_state;
+
+ ioty_last = ioty_list;
+ list = list->next;
+ while (list) {
+ ioty_last->next = calloc(1, sizeof(NSTopicLL));
+ ioty_last = ioty_last->next;
+ ioty_last->topicName = list->topic_name;
+ ioty_last->state = list->topic_state;
+ list = list->next;
+ }
+ ioty_last->next = NULL;
+
+ return ioty_list;
+}
+static void _topic_list_free(NSTopicLL *list)
+{
+ if (NULL == list)
+ return;
+
+ NSTopicLL *iter = list;
+ NSTopicLL *next = NULL;
+
+ while (iter) {
+ next = iter->next;
+ free(iter);
+ iter = next;
+ }
+}
+API int iotcon_ns_consumer_update_topic_list(const char *provider_id, iotcon_ns_topic_list_h topic_list)
+{
+ API_CALL;
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET), IOTCON_ERROR_PERMISSION_DENIED);
+
+ RETV_IF(NULL == provider_id, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == topic_list, IOTCON_ERROR_INVALID_PARAMETER);
+
+#if 1
+ if (topic_list) {
+ iotcon_ns_topic_list_h iter = topic_list;
+ while (iter) {
+ DBG("[BEFORE] topic_name:[ %s]\t, topic_state: %d\n", iter->topic_name, iter->topic_state);
+ iter = iter->next;
+ }
+ }
+#endif
+
+ NSTopicLL *ioty_list = _topic_list_shallow_copy(topic_list);
+
+#if 1
+ if (ioty_list) {
+ NSTopicLL *iter = ioty_list;
+ while (iter) {
+ DBG("[AFTER]topicName:[ %s]\t, state: %d\n", iter->topicName, iter->state);
+ iter = iter->next;
+ }
+ }
+#endif
+ int ret = NSConsumerUpdateTopicList(provider_id, ioty_list);
+ if (NS_OK != ret) {
+ ERR("NSConsumerUpdateTopicList() Fail(%d)", ret);
+ _topic_list_free(ioty_list);
+ return IOTCON_ERROR_IOTIVITY;
+ }
+
+ _topic_list_free(ioty_list);
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_message_get_id(iotcon_ns_message_h *message, unsigned long long *message_id)
+{
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(NULL == message, IOTCON_ERROR_INVALID_PARAMETER);
+
+ *message_id = ((icl_ns_message_s *)message)->message_id;
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_message_get_provider_id(iotcon_ns_message_h *message, char **provider_id)
+{
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(NULL == message, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == provider_id, IOTCON_ERROR_INVALID_PARAMETER);
+
+ *provider_id = NULL;
+ if (((icl_ns_message_s *)message)->provider_id)
+ *provider_id = strdup(((icl_ns_message_s *)message)->provider_id);
+
+ return IOTCON_ERROR_NONE;
+}
+
+
+API int iotcon_ns_consumer_message_get_type(iotcon_ns_message_h *message, iotcon_ns_message_type_e *type)
+{
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(NULL == message, IOTCON_ERROR_INVALID_PARAMETER);
+
+ *type = ((icl_ns_message_s *)message)->type;
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_message_get_date_time(iotcon_ns_message_h *message, char **date_time)
+{
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(NULL == message, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == date_time, IOTCON_ERROR_INVALID_PARAMETER);
+
+ *date_time = NULL;
+ if (((icl_ns_message_s *)message)->date_time)
+ *date_time = strdup(((icl_ns_message_s *)message)->date_time);
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_message_get_ttl(iotcon_ns_message_h *message, unsigned long long *ttl)
+{
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(NULL == message, IOTCON_ERROR_INVALID_PARAMETER);
+
+ *ttl = ((icl_ns_message_s *)message)->ttl;
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_message_get_title(iotcon_ns_message_h *message, char **title)
+{
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(NULL == message, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == title, IOTCON_ERROR_INVALID_PARAMETER);
+
+ *title = NULL;
+ if (((icl_ns_message_s *)message)->title)
+ *title = strdup(((icl_ns_message_s *)message)->title);
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_message_get_content_text(iotcon_ns_message_h *message, char **content_text)
+{
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(NULL == message, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == content_text, IOTCON_ERROR_INVALID_PARAMETER);
+
+ *content_text = NULL;
+ if (((icl_ns_message_s *)message)->content_text)
+ *content_text = strdup(((icl_ns_message_s *)message)->content_text);
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_message_get_source_name(iotcon_ns_message_h *message, char **source_name)
+{
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(NULL == message, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == source_name, IOTCON_ERROR_INVALID_PARAMETER);
+
+ *source_name = NULL;
+ if (((icl_ns_message_s *)message)->source_name)
+ *source_name = strdup(((icl_ns_message_s *)message)->source_name);
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_message_get_icon_image(iotcon_ns_message_h *message, char **icon_image)
+{
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(NULL == message, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == icon_image, IOTCON_ERROR_INVALID_PARAMETER);
+
+ *icon_image = NULL;
+ if (((icl_ns_message_s *)message)->icon_image)
+ *icon_image = strdup(((icl_ns_message_s *)message)->icon_image);
+
+ return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_ns_consumer_message_get_topic_name(iotcon_ns_message_h *message, char **topic_name)
+{
+ RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
+ RETV_IF(NULL == message, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == topic_name, IOTCON_ERROR_INVALID_PARAMETER);
+
+ *topic_name = NULL;
+ if (((icl_ns_message_s *)message)->topic_name)
+ *topic_name = strdup(((icl_ns_message_s *)message)->topic_name);
+
+ return IOTCON_ERROR_NONE;
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#include <NSProviderInterface.h>
+#include "ic-ns-common.h"
+#include "iotcon-ns-provider.h"
+
+API int iotcon_ns_provider_start(iotcon_ns_subscription_request_cb subscription_request_cb,
+ iotcon_ns_sync_info_received_cb sync_info_cb,
+ bool sub_controllability, bool resource_security)
+{
+
+ return IOTCON_ERROR_NONE;
+}