IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NSProviderInterface.h
Go to the documentation of this file.
1 //******************************************************************
2 //
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
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
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
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.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20 
27 #ifndef _NS_PROVIDER_INTERFACE_H_
28 #define _NS_PROVIDER_INTERFACE_H_
29 
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif // __cplusplus
34 
35 #include "NSCommon.h"
36 #include <stdbool.h>
37 #include <stdint.h>
43 
50 
54 typedef struct
55 {
56  /* Invoked when the subscription request from consumer is received */
58  /* Invoked when the synchronization data, read and deleted, is sent by consumer is received */
60  /* Set the policy for notification servcie which checks whether provider is capable of
61  * denying the subscription of notification message from consumer
62  * and getting controllabliity to set consumer topic list.
63  * If true, provider is able to control subscription request and consumer topic list.
64  * Otherwise(policy is false), consumer can do the same.
65  */
67  /* User defined information such as device friendly name */
68  char * userInfo;
69  /* Set on/off for secure resource channel setting */
71 
73 
80 
86 
92 NSResult NSProviderEnableRemoteService(char * serverAddress);
93 
99 NSResult NSProviderDisableRemoteService(char * serverAddress);
100 
101 #ifdef WITH_MQ
102 
108 NSResult NSProviderSubscribeMQService(const char * serverAddress, const char * topicName);
109 #endif
110 
117 
126 NSResult NSAcceptSubscription(const char * consumerId, bool accepted);
127 
134 NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type);
135 
142 
148 NSResult NSProviderRegisterTopic(const char * topicName);
149 
155 NSResult NSProviderUnregisterTopic(const char * topicName);
156 
163 NSResult NSProviderSetConsumerTopic(const char * consumerId, const char * topicName);
164 
171 NSResult NSProviderUnsetConsumerTopic(const char * consumerId, const char * topicName);
172 
178 NSTopicLL * NSProviderGetConsumerTopics(const char * consumerId);
179 
185 
186 #ifdef __cplusplus
187 }
188 #endif // __cplusplus
189 
190 #endif /* _NS_PROVIDER_INTERFACE_H_ */
191 
void(* NSSubscribeRequestCallback)(NSConsumer *)
Invoked when provider receives the subscription request of consumer.
Definition: NSProviderInterface.h:42
NSResult NSAcceptSubscription(const char *consumerId, bool accepted)
Send acceptance to consumer who subscribes the resource of notification message This function is vali...
NSResult NSProviderRegisterTopic(const char *topicName)
Add topic to topic list which is located in provider service storage.
NSResult NSSendMessage(NSMessage *msg)
Send notification message to all subscribers.
Synchronization information of the notification message.
Definition: NSCommon.h:163
NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type)
Send synchronizad state of notificaion message to consumers.
Notification Message.
Definition: NSCommon.h:141
NSSubscribeRequestCallback subRequestCallback
Definition: NSProviderInterface.h:57
NSResult NSStartProvider(NSProviderConfig config)
Initialize notification service for provider.
NSResult NSProviderSetConsumerTopic(const char *consumerId, const char *topicName)
Select a topic name for a consumer.
NSTopicLL * NSProviderGetConsumerTopics(const char *consumerId)
Request topic list with selection state for the consumer.
Set provider service with the following configuration.
Definition: NSProviderInterface.h:54
NSTopicLL * NSProviderGetTopics()
Request topics list already registered by provider user.
NSMessage * NSCreateMessage()
Initialize NSMessage struct.
NSProviderSyncInfoCallback syncInfoCallback
Definition: NSProviderInterface.h:59
void(* NSProviderSyncInfoCallback)(NSSyncInfo *)
Invoked when synchronization data which has notification message read/deleted event from consumer is ...
Definition: NSProviderInterface.h:49
char * userInfo
Definition: NSProviderInterface.h:68
Topic linked list.
Definition: NSCommon.h:103
NSSyncType
Notification message status to synchronize.
Definition: NSCommon.h:63
NSResult NSProviderUnregisterTopic(const char *topicName)
Delete topic from topic list.
Consumer information.
Definition: NSCommon.h:114
bool subControllability
Definition: NSProviderInterface.h:66
NSResult NSStopProvider()
Terminate notification service for provider.
NSResult NSProviderDisableRemoteService(char *serverAddress)
Request to terminate remote service from relay server.
bool resourceSecurity
Definition: NSProviderInterface.h:70
enum eResult NSResult
Result code of notification service.
NSResult NSProviderUnsetConsumerTopic(const char *consumerId, const char *topicName)
Unselect a topic from the topic list for consumer.
NSResult NSProviderEnableRemoteService(char *serverAddress)
Request to publish resource using remote relay server.
This file provides APIs of Notification Service for common functions.