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 * Provider uses this callback function to receive subscription request of consumer
\r
41 * @param[in] consumer Consumer who subscribes the resource
\r
43 typedef void (*NSSubscribeRequestCallback)(NSConsumer *);
\r
46 * Provider use this callback function to receive the status of the message
\r
48 * @param[in] sync Synchronization information of the notification message
\r
50 typedef void (*NSProviderSyncInfoCallback)(NSSyncInfo *);
\r
53 * Initialize notification service for provider
\r
54 * @param[in] policy Accepter
\r
55 * @param[in] subscribeRequestCallback Callback function to register for receiving
\r
56 * subscription request from consumer
\r
57 * @param[in] syncCallback Callback function to register for receiving sync data
\r
58 * @return ::NS_OK or result code of NSResult
\r
60 NSResult NSStartProvider(NSAccessPolicy policy, NSSubscribeRequestCallback subscribeRequestCb,
\r
61 NSProviderSyncInfoCallback syncCb);
\r
64 * Terminate notification service for provider
\r
65 * @return ::NS_OK or result code of NSResult
\r
67 NSResult NSStopProvider();
\r
70 * Request to publish resource to cloud server
\r
71 * @param[in] server address combined with IP address and port number using delimiter :
\r
72 * @return ::NS_OK or result code of NSResult
\r
74 NSResult NSProviderEnableRemoteService(char *serverAddress);
\r
77 * Request to cancel remote service using cloud server
\r
78 * @param[in] server address combined with IP address and port number using delimiter :
\r
79 * @return ::NS_OK or result code of NSResult
\r
81 NSResult NSProviderDisableRemoteService(char *serverAddress);
\r
84 * Send notification message to all subscribers
\r
85 * @param[in] message Notification message including id, title, contentText
\r
86 * @return ::NS_OK or result code of NSResult
\r
88 NSResult NSSendMessage(NSMessage *msg);
\r
91 * Send acceptance to consumer who subscribes the resource of notification message
\r
92 * @param[in] consumer Consumer who subscribes the resource
\r
93 * @param[in] accepted the result of acceptance; Allow or Deny
\r
94 * @return ::NS_OK or result code of NSResult
\r
96 NSResult NSAccept(NSConsumer *consumer, bool accepted);
\r
99 * Get consumer list that is stored in the cache of notification service
\r
100 * @param[in] list Consumer list
\r
101 * @param[in] size the number of consumers stored in the cache
\r
102 * @return ::NS_OK or result code of NSResult
\r
104 // NSResult NSGetConsumerList(uint8_t *list, uint32_t size);
\r
107 * Send read-check to provider in order to synchronize notification status with other consumers
\r
108 * @param[in] message Notification message to synchronize the status
\r
109 * @return ::NS_OK or result code of NSResult
\r
111 NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type);
\r
115 * Initialize NSMessage struct, our service set message id and provider(device) id
\r
116 * @return ::NSMessage *
\r
118 NSMessage * NSCreateMessage();
\r
122 #endif // __cplusplus
\r
124 #endif /* _NS_PROVIDER_INTERFACE_H_ */
\r