-//******************************************************************\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 contains Notification service Provider representation.\r
- */\r
-\r
-#ifndef _NS_PROVIDER_H_\r
-#define _NS_PROVIDER_H_\r
-\r
-\r
-#include <string>\r
-#include "NSSyncInfo.h"\r
-#include "NSMessage.h"\r
-#include "NSUtils.h"\r
-#include "NSTopicsList.h"\r
-\r
-namespace OIC\r
-{\r
- namespace Service\r
- {\r
- /**\r
- * @class NSProvider\r
- * @brief This class provides a set of Notification service Provider representation APIs.\r
- */\r
- class NSProvider\r
- {\r
- public:\r
-\r
- /**\r
- * Invoked when the provider state is changed\r
- * @param[in] providerState NSProviderState of the notification resource\r
- */\r
- typedef void (* ProviderStateCallback)(NSProviderState);\r
-\r
- /**\r
- * Consumer use this callback function to receive notification message from provider\r
- * synchronization\r
- * @param[in] message Notification message\r
- */\r
- typedef void (*MessageReceivedCallback)(NSMessage *);\r
-\r
- /**\r
- * Provider and consumer use this callback function to receive the status of the message\r
- * synchronization\r
- * @param[in] sync Synchronization information of the notification message\r
- */\r
- typedef void (*SyncInfoReceivedCallback)(NSSyncInfo *);\r
-\r
- /**\r
- * Constructor of NSProvider.\r
- */\r
- NSProvider(): m_topicList(new NSTopicsList()), m_state(NSProviderState::DENY),\r
- m_subscribedState(NSProviderSubscribedState::DENY),\r
- m_stateCb(NULL), m_messageCb(NULL), m_syncInfoCb(NULL)\r
- {\r
- }\r
-\r
- /**\r
- * Constructor of NSProvider.\r
- *\r
- * @param providerId - providerId of the Notification.\r
- */\r
- NSProvider(const std::string &providerId) : m_providerId(providerId),\r
- m_topicList(new NSTopicsList()), m_state(NSProviderState::DENY),\r
- m_subscribedState(NSProviderSubscribedState::DENY),\r
- m_stateCb(NULL), m_messageCb(NULL), m_syncInfoCb(NULL)\r
- {\r
- }\r
-\r
- /**\r
- * Constructor of NSProvider.\r
- *\r
- * @param providerId - providerId of the Notification.\r
- * @param topicList - NSTopicsList of interested Topics.\r
- */\r
- NSProvider(const std::string &providerId, NSTopicsList *topicList) : m_providerId(\r
- providerId), m_topicList(topicList), m_state(NSProviderState::DENY),\r
- m_subscribedState(NSProviderSubscribedState::DENY),\r
- m_stateCb(NULL), m_messageCb(NULL), m_syncInfoCb(NULL)\r
- {\r
- }\r
-\r
- /**\r
- * Constructor of NSProvider.\r
- *\r
- * @param provider - of type NSProvider.\r
- */\r
- NSProvider(::NSProvider *provider);\r
-\r
- /**\r
- * Copy Constructor of NSProvider.\r
- *\r
- * @param provider - NSProvider to initialize.\r
- */\r
- NSProvider(const NSProvider &provider);\r
-\r
- /**\r
- * Copy assignment operator of NSProvider.\r
- *\r
- * @param provider - NSProvider to initialize.\r
- * @return NSProvider object reference\r
- */\r
- NSProvider &operator=(const NSProvider &provider);\r
-\r
- /**\r
- * Destructor of NSProvider.\r
- */\r
- ~NSProvider();\r
-\r
- /**\r
- * This method is for getting ProviderId from the Notification service provider.\r
- *\r
- * @return ProviderId as string.\r
- */\r
- std::string getProviderId() const;\r
-\r
- /**\r
- * This method is for getting NSTopic List from the Notification service provider.\r
- *\r
- * @return NSTopicsList as pointer.\r
- */\r
- NSTopicsList *getTopicList() const;\r
-\r
- /**\r
- * Update Topic list that is wanted to be subscribed from provider\r
- *\r
- * @param topicList - NSTopicsList of interested Topics.\r
- * @return NSResult\r
- */\r
- NSResult updateTopicList(NSTopicsList *topicList);\r
-\r
- /**\r
- * This method is for getting ProviderState from the Notification service provider.\r
- *\r
- * @return ProviderState as NSProviderState.\r
- */\r
- NSProviderState getProviderState() const;\r
-\r
- /**\r
- * This method is for getting SubscribedState from the Notification service provider.\r
- *\r
- * @return subscribedState as NSProviderSubscribedState.\r
- */\r
- NSProviderSubscribedState getProviderSubscribedState() const;\r
-\r
- /**\r
- * This method is for requesting subscription of Notification service.\r
- * @return ::NS_OK or result code of NSResult\r
- */\r
- NSResult subscribe();\r
-\r
- /**\r
- * Request to unsubscribe in order not to receive notification message from provider\r
- * @return ::NS_OK or result code of NSResult\r
- */\r
- NSResult unsubscribe();\r
-\r
- /**\r
- * This method is for requesting subscription status from Provider of Notification service.\r
- *\r
- */\r
- bool isSubscribed();\r
-\r
- /**\r
- * This method is for Sending SyncInfo of Notification service.\r
- *\r
- * @param messageId - id of type message.\r
- * @param type - NSSyncType of Notification service.\r
- * @return ::NS_OK or result code of NSResult\r
- */\r
- NSResult sendSyncInfo(uint64_t messageId, NSSyncInfo::NSSyncType type);\r
-\r
- /**\r
- * This method is for registering for listeners of Notification .\r
- *\r
- * @param stateHandle - ProviderStateCallback callback.\r
- * @param messageHandle - MessageReceivedCallback callback.\r
- * @param syncHandle - SyncInfoReceivedCallback callback\r
- */\r
- void setListener(ProviderStateCallback stateHandle,\r
- MessageReceivedCallback messageHandle,\r
- SyncInfoReceivedCallback syncHandle);\r
-\r
- /**\r
- * This method is for getting the registered cb of Provider State received.\r
- *\r
- * @return stateCb - ProviderStateCallback .\r
- */\r
- ProviderStateCallback getProviderStateReceivedCb() const;\r
-\r
- /**\r
- * This method is for getting the registered cb of Notification message received.\r
- *\r
- * @return messageCb - MessageReceivedCallback .\r
- */\r
- MessageReceivedCallback getMessageReceivedCb() const;\r
-\r
- /**\r
- * This method is for getting the registered cb of Notification SyncInfo received.\r
- *\r
- * @return syncInfoCb - SyncInfoReceivedCallback .\r
- */\r
- SyncInfoReceivedCallback getSyncInfoReceivedCb() const;\r
-\r
- /**\r
- * This method is for setting NSTopic List for the Notification service provider.\r
- *\r
- * @param topicsList as NSTopicsList pointer.\r
- */\r
- void setTopicList(NSTopicsList *topicsList);\r
-\r
- /**\r
- * This method is for setting ProviderState for the Notification service provider.\r
- *\r
- * @param providerState as NSProviderState.\r
- */\r
- void setProviderState(const NSProviderState &providerState);\r
-\r
- /**\r
- * This method is for setting subscribedState for the Notification service provider.\r
- *\r
- * @param subscribedState as NSProviderSubscribedState.\r
- */\r
- void setProviderSubscribedState(const NSProviderSubscribedState &subscribedState);\r
-\r
- private:\r
- ::NSProvider *getNSProvider();\r
-\r
- private:\r
- std::string m_providerId;\r
- NSTopicsList *m_topicList;\r
- NSProviderState m_state;\r
- NSProviderSubscribedState m_subscribedState;\r
-\r
- ProviderStateCallback m_stateCb;\r
- MessageReceivedCallback m_messageCb;\r
- SyncInfoReceivedCallback m_syncInfoCb;\r
- };\r
- }\r
-}\r
-#endif /* _NS_PROVIDER_H_ */\r
+//******************************************************************
+//
+// 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 contains Notification service Provider representation.
+ */
+
+#ifndef _NS_PROVIDER_H_
+#define _NS_PROVIDER_H_
+
+
+#include <string>
+#include "NSSyncInfo.h"
+#include "NSMessage.h"
+#include "NSUtils.h"
+#include "NSTopicsList.h"
+
+namespace OIC
+{
+ namespace Service
+ {
+ /**
+ * @class NSProvider
+ * @brief This class provides a set of Notification service Provider representation APIs.
+ */
+ class NSProvider
+ {
+ public:
+
+ /**
+ * Invoked when the provider state is changed
+ * @param[in] providerState NSProviderState of the notification resource
+ */
+ typedef void (* ProviderStateCallback)(NSProviderState);
+
+ /**
+ * Consumer use this callback function to receive notification message from provider
+ * synchronization
+ * @param[in] message Notification message
+ */
+ typedef void (*MessageReceivedCallback)(NSMessage *);
+
+ /**
+ * Provider and consumer use this callback function to receive the status of the message
+ * synchronization
+ * @param[in] sync Synchronization information of the notification message
+ */
+ typedef void (*SyncInfoReceivedCallback)(NSSyncInfo *);
+
+ /**
+ * Constructor of NSProvider.
+ */
+ NSProvider(): m_topicList(new NSTopicsList()), m_state(NSProviderState::DENY),
+ m_subscribedState(NSProviderSubscribedState::DENY),
+ m_stateCb(NULL), m_messageCb(NULL), m_syncInfoCb(NULL)
+ {
+ }
+
+ /**
+ * Constructor of NSProvider.
+ *
+ * @param providerId - providerId of the Notification.
+ */
+ NSProvider(const std::string &providerId) : m_providerId(providerId),
+ m_topicList(new NSTopicsList()), m_state(NSProviderState::DENY),
+ m_subscribedState(NSProviderSubscribedState::DENY),
+ m_stateCb(NULL), m_messageCb(NULL), m_syncInfoCb(NULL)
+ {
+ }
+
+ /**
+ * Constructor of NSProvider.
+ *
+ * @param providerId - providerId of the Notification.
+ * @param topicList - NSTopicsList of interested Topics.
+ */
+ NSProvider(const std::string &providerId, NSTopicsList *topicList) : m_providerId(
+ providerId), m_topicList(topicList), m_state(NSProviderState::DENY),
+ m_subscribedState(NSProviderSubscribedState::DENY),
+ m_stateCb(NULL), m_messageCb(NULL), m_syncInfoCb(NULL)
+ {
+ }
+
+ /**
+ * Constructor of NSProvider.
+ *
+ * @param provider - of type NSProvider.
+ */
+ NSProvider(::NSProvider *provider);
+
+ /**
+ * Copy Constructor of NSProvider.
+ *
+ * @param provider - NSProvider to initialize.
+ */
+ NSProvider(const NSProvider &provider);
+
+ /**
+ * Copy assignment operator of NSProvider.
+ *
+ * @param provider - NSProvider to initialize.
+ * @return NSProvider object reference
+ */
+ NSProvider &operator=(const NSProvider &provider);
+
+ /**
+ * Destructor of NSProvider.
+ */
+ ~NSProvider();
+
+ /**
+ * This method is for getting ProviderId from the Notification service provider.
+ *
+ * @return ProviderId as string.
+ */
+ std::string getProviderId() const;
+
+ /**
+ * This method is for getting NSTopic List from the Notification service provider.
+ *
+ * @return NSTopicsList as pointer.
+ */
+ NSTopicsList *getTopicList() const;
+
+ /**
+ * Update Topic list that is wanted to be subscribed from provider
+ *
+ * @param topicList - NSTopicsList of interested Topics.
+ * @return NSResult
+ */
+ NSResult updateTopicList(NSTopicsList *topicList);
+
+ /**
+ * This method is for getting ProviderState from the Notification service provider.
+ *
+ * @return ProviderState as NSProviderState.
+ */
+ NSProviderState getProviderState() const;
+
+ /**
+ * This method is for getting SubscribedState from the Notification service provider.
+ *
+ * @return subscribedState as NSProviderSubscribedState.
+ */
+ NSProviderSubscribedState getProviderSubscribedState() const;
+
+ /**
+ * This method is for requesting subscription of Notification service.
+ * This API should be called with a valid Provider object obtained from Discovery callback.
+ * The API should not be called when the Provider is in STOPPED state.
+ *
+ * Discovery APIs to discover Providers are as below.
+ * Start/rescanProvider for D2D,
+ * enableRemoteService for D2S,
+ *
+ * @return ::NS_OK or result code of NSResult
+ */
+ NSResult subscribe();
+
+ /**
+ * Request to unsubscribe in order not to receive notification message from provider
+ *
+ * This API should be called with a valid Provider object obtained from Discovery callback.
+ * The API should not be called when the Provider is in STOPPED state.
+ *
+ * @return ::NS_OK or result code of NSResult
+ */
+ NSResult unsubscribe();
+
+ /**
+ * This method is for requesting subscription status from Provider of Notification service.
+ *
+ */
+ bool isSubscribed();
+
+ /**
+ * This method is for Sending SyncInfo of Notification service.
+ *
+ * @param messageId - id of type message.
+ * @param type - NSSyncType of Notification service.
+ * @return ::NS_OK or result code of NSResult
+ */
+ NSResult sendSyncInfo(uint64_t messageId, NSSyncInfo::NSSyncType type);
+
+ /**
+ * This method is for registering for listeners of Notification .
+ *
+ * @param stateHandle - ProviderStateCallback callback.
+ * @param messageHandle - MessageReceivedCallback callback.
+ * @param syncHandle - SyncInfoReceivedCallback callback
+ */
+ void setListener(ProviderStateCallback stateHandle,
+ MessageReceivedCallback messageHandle,
+ SyncInfoReceivedCallback syncHandle);
+
+ /**
+ * This method is for getting the registered cb of Provider State received.
+ *
+ * @return stateCb - ProviderStateCallback .
+ */
+ ProviderStateCallback getProviderStateReceivedCb() const;
+
+ /**
+ * This method is for getting the registered cb of Notification message received.
+ *
+ * @return messageCb - MessageReceivedCallback .
+ */
+ MessageReceivedCallback getMessageReceivedCb() const;
+
+ /**
+ * This method is for getting the registered cb of Notification SyncInfo received.
+ *
+ * @return syncInfoCb - SyncInfoReceivedCallback .
+ */
+ SyncInfoReceivedCallback getSyncInfoReceivedCb() const;
+
+ /**
+ * This method is for setting NSTopic List for the Notification service provider.
+ *
+ * @param topicsList as NSTopicsList pointer.
+ */
+ void setTopicList(NSTopicsList *topicsList);
+
+ /**
+ * This method is for setting ProviderState for the Notification service provider.
+ *
+ * @param providerState as NSProviderState.
+ */
+ void setProviderState(const NSProviderState &providerState);
+
+ /**
+ * This method is for setting subscribedState for the Notification service provider.
+ *
+ * @param subscribedState as NSProviderSubscribedState.
+ */
+ void setProviderSubscribedState(const NSProviderSubscribedState &subscribedState);
+
+ private:
+ ::NSProvider *getNSProvider();
+
+ private:
+ std::string m_providerId;
+ NSTopicsList *m_topicList;
+ NSProviderState m_state;
+ NSProviderSubscribedState m_subscribedState;
+
+ ProviderStateCallback m_stateCb;
+ MessageReceivedCallback m_messageCb;
+ SyncInfoReceivedCallback m_syncInfoCb;
+ };
+ }
+}
+#endif /* _NS_PROVIDER_H_ */