1 //******************************************************************
\r
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
7 // Licensed under the Apache License, Version 2.0 (the "License");
\r
8 // you may not use this file except in compliance with the License.
\r
9 // You may obtain a copy of the License at
\r
11 // http://www.apache.org/licenses/LICENSE-2.0
\r
13 // Unless required by applicable law or agreed to in writing, software
\r
14 // distributed under the License is distributed on an "AS IS" BASIS,
\r
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 // See the License for the specific language governing permissions and
\r
17 // limitations under the License.
\r
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
24 * This file provides APIs of Notification Service for Provider.
\r
27 #ifndef _NS_PROVIDER_INTERFACE_H_
\r
28 #define _NS_PROVIDER_INTERFACE_H_
\r
33 #endif // __cplusplus
\r
35 #include "NSCommon.h"
\r
36 #include <stdbool.h>
\r
40 * Invoked the subscription request from consumer is received
\r
41 * @param[in] consumer Consumer who subscribes the resource
\r
43 typedef void (*NSSubscribeRequestCallback)(NSConsumer *);
\r
46 * Invoked when the synchronization data which has notification message
\r
47 * read/delete event from consumer is received
\r
49 * @param[in] syncinfo Synchronization information of the notification message
\r
51 typedef void (*NSProviderSyncInfoCallback)(NSSyncInfo *);
\r
54 * Initialize notification service for provider
\r
55 * @param[in] policy Accepter
\r
56 * @param[in] subscribeRequestCallback Callback function to register for receiving
\r
57 * subscription request from consumer
\r
58 * @param[in] syncCallback Callback function to register for receiving sync data
\r
59 * @return ::NS_OK or result code of NSResult
\r
61 NSResult NSStartProvider(bool policy, NSSubscribeRequestCallback subscribeRequestCb,
\r
62 NSProviderSyncInfoCallback syncCb);
\r
65 * Terminate notification service for provider
\r
66 * @return ::NS_OK or result code of NSResult
\r
68 NSResult NSStopProvider();
\r
71 * Request to publish resource to cloud server
\r
72 * @param[in] server address combined with IP address and port number using delimiter :
\r
73 * @return ::NS_OK or result code of NSResult
\r
75 NSResult NSProviderEnableRemoteService(char *serverAddress);
\r
78 * Request to cancel remote service using cloud server
\r
79 * @param[in] server address combined with IP address and port number using delimiter :
\r
80 * @return ::NS_OK or result code of NSResult
\r
82 NSResult NSProviderDisableRemoteService(char *serverAddress);
\r
85 * Send notification message to all subscribers
\r
86 * @param[in] message Notification message including id, title, contentText
\r
87 * @return ::NS_OK or result code of NSResult
\r
89 NSResult NSSendMessage(NSMessage *msg);
\r
92 * Send acceptance to consumer who subscribes the resource of notification message
\r
93 * @param[in] consumer Consumer who subscribes the resource
\r
94 * @param[in] accepted the result of acceptance; Allow or Deny
\r
95 * @return ::NS_OK or result code of NSResult
\r
97 NSResult NSAcceptSubscription(NSConsumer *consumer, bool accepted);
\r
100 * Send sync type in order to synchronize notification status with other consumers,
\r
101 * when provider consumes the notification such as READ, DELETE
\r
102 * @param[in] messageId Notification message if to synchronize the status
\r
103 * @param[in] type changed notification status from NSSyncType
\r
104 * @return ::NS_OK or result code of NSResult
\r
106 NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type);
\r
110 * Initialize NSMessage structure with message id and provider(device) id
\r
111 * @return ::NSMessage *
\r
113 NSMessage * NSCreateMessage();
\r
117 #endif // __cplusplus
\r
119 #endif /* _NS_PROVIDER_INTERFACE_H_ */
\r