add % before the privilege tag not to link to the linkage page
[platform/framework/native/nfc.git] / inc / FNetNfcNdefPushManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file    FNetNfcNdefPushManager.h
19  * @brief   This is the header file for the %NdefPushManager class.
20  *
21  * This header file contains the declarations of the %NdefPushManager class.
22  */
23 #ifndef _FNET_NFC_NDEF_PUSH_MANAGER_H_
24 #define _FNET_NFC_NDEF_PUSH_MANAGER_H_
25
26 #include <FBaseObject.h>
27 #include <FBaseResult.h>
28 #include <FAppTypes.h>
29
30 namespace Tizen { namespace Base
31 {
32 class String;
33 } }
34
35 namespace Tizen { namespace Base { namespace Collection
36 {
37 class IMap;
38 }
39 } }
40
41 namespace Tizen { namespace Net { namespace Nfc
42 {
43
44 class INdefPushManagerListener;
45 class NdefMessage;
46 class _NdefPushManagerImpl;
47
48 /**
49  * @class    NdefPushManager
50  * @brief    This is the class for pushing an NDEF message to a device.
51  *
52  * @since    2.0
53  *
54  * @final    This class is not intended for extension.
55  *
56  * The %NdefPushManager class is the class for pushing an NDEF message to a device.
57  *
58  * For more information on the class features, see
59  * <a href="../com.osp.cppappprogramming.help/html/guide/net/nfc.htm">NFC Guide</a>.
60  *
61  */
62 class _OSP_EXPORT_ NdefPushManager
63         : public Tizen::Base::Object
64 {
65 public:
66         /**
67          * This is the default constructor for this class.
68          *
69          * @since       2.0
70          */
71         NdefPushManager(void);
72
73         /**
74          * This destructor overrides Object::~Object().
75          *
76          * @since       2.0
77          */
78         ~NdefPushManager(void);
79
80         /**
81          * Sets a listener for receiving the result of pushing an NDEF message.
82          *
83          * @since       2.0
84          * @privlevel   public
85          * @privilege   %http://tizen.org/privilege/nfc.p2p
86          *
87          * @return      An error code
88          * @param[in]   pListener               An instance of %INdefPushManagerListener. @n
89          *                                      If it is null, it will reset the listener.
90          * @exception   E_SUCCESS               The method is successful.
91          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
92          * @exception   E_UNSUPPORTED_OPERATION The device does not support the NFC feature.
93          * @exception   E_OPERATION_FAILED      The operation has failed.
94          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
95          */
96         result SetNdefPushManagerListener(INdefPushManagerListener* pListener);
97
98         /**
99          * Pushes the NDEF message.
100          *
101          * @since       2.0
102          * @privlevel   public
103          * @privilege   %http://tizen.org/privilege/nfc.p2p
104          *
105          * @return      An error code
106          * @param[in]   message                 The NDEF message to be sent
107          * @exception   E_SUCCESS               The method is successful.
108          * @exception   E_DEVICE_BUSY           The device is processing preceding job.
109          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
110          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
111          *                                      For example, the NFC feature is not activated or a peer device is not
112          *                                      attached.
113          * @exception   E_INVALID_ARG           The input @c message is invalid. @n
114          *                                      For example, it does not contain any NDEF records.
115          * @exception   E_UNSUPPORTED_OPERATION The device does not support the NFC feature.
116          * @exception   E_OPERATION_FAILED      The operation has failed.
117          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
118          * @remarks
119          */
120         result Push(const NdefMessage& message);
121
122         /**
123          * Activates Reserved Push feature which sends the preselected NDEF message to the connected NFC peer device on
124          * behalf of the application.
125          *
126          * @since       2.1
127          * @privlevel   platform
128          * @privilege   %http://tizen.org/privilege/nfcmanager
129          *
130          * @return      An error code
131          * @exception   E_SUCCESS               The method is successful.
132          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified
133          *                                      operation. @n
134          *                                      For example, Reserved Push is already activated.
135          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
136          * @exception   E_UNSUPPORTED_OPERATION The device does not support the NFC feature.
137          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
138          * @see         <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
139          *              The NFC Reserved Push guide</a>
140          */
141         result ActivateReservedPush(void);
142
143         /**
144          * Deactivates Reserved Push feature which sends the preselected NDEF message to the connected NFC peer device on
145          * behalf of the application.
146          *
147          * @since       2.1
148          * @privlevel   platform
149          * @privilege   %http://tizen.org/privilege/nfcmanager
150          *
151          * @return      An error code
152          * @exception   E_SUCCESS               The method is successful.
153          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified
154          *                                      operation. @n
155          *                                      For example, Reserved Push is already deactivated.
156          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
157          * @exception   E_UNSUPPORTED_OPERATION The device does not support the NFC feature.
158          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
159          * @see         <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
160          *              The NFC Reserved Push guide</a>
161          */
162         result DeactivateReservedPush(void);
163
164         /**
165          * Checks whether Reserved Push feature is activated.
166          *
167          * @since       2.1
168          *
169          * @return      @c true if Reserved Push is activated, @n
170          *              else @c false
171          */
172         bool IsReservedPushActivated(void) const;
173
174         /**
175          * Gets information of all the Reserved Push candidates. Each element of the result IMap consists of the package ID
176          * of application which registered the NDEF message and the description about the registered NDEF message.
177          *
178          * @since       2.1
179          *
180          * @return      An IMapT containing the pairs of package ID and message description if successful, @n
181          *              else @c null
182          * @remarks     The key of the returned IMap should be casted to Tizen::App::PackageId pointer and the value should
183          *              be casted to Tizen::Base::String pointer.
184          */
185         Tizen::Base::Collection::IMap* GetReservedPushCandidatesN(void) const;
186
187         /**
188          * Picks out an NDEF message among all Reserved Push candidates by application ID. The selected NDEF message is
189          * pushed when a peer device is detected.
190          *
191          * @since       2.1
192          * @privlevel   platform
193          * @privilege   %http://tizen.org/privilege/nfcmanager
194          *
195          * @return      An error code
196          * @param[in]   packageId               The package ID of the application which registered the NDEF message to push
197          * @exception   E_SUCCESS               The method is successful.
198          * @exception   E_OBJ_NOT_FOUND         The specified @c packageId is not found in the Reserved Push candidate list.
199          * @exception   E_UNSUPPORTED_OPERATION The device does not support the NFC feature.
200          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
201          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
202          * @see         <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
203          *              The NFC Reserved Push guide</a>
204          * @remarks     The only one message can be selected to push. So the previously selected message will be replaced
205          *              by the new one.
206          */
207         result PickReservedPushMessage(const Tizen::App::PackageId& packageId);
208
209         /**
210          * Gets the owner application ID of the picked NDEF message among all Reserved Push candidates.
211          *
212          * @since       2.1
213          *
214          * @return      The package ID of the application which is the owner of the picked Reserved Push message @n
215          *              else an empty string if an error occurs
216          * @exception   E_SUCCESS               The method is successful.
217          * @exception   E_OBJ_NOT_FOUND         There is no element in the Reserved Push candidate list.
218          * @exception   E_UNSUPPORTED_OPERATION The device does not support the NFC feature.
219          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
220          * @see         <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
221          *              The NFC Reserved Push guide</a>
222          * @remarks     The specific error code can be accessed using the GetLastResult() method.
223          */
224         Tizen::App::PackageId GetPickedReservedPushMessage(void) const;
225
226         /**
227          * Registers an NDEF message as a Reserved Push candidate. @n
228          * If the message is picked out among the candidates. it is pushed to the detected peer device when the home screen
229          * or the main menu is on top of the screen in the local device.
230          *
231          * @since       2.0
232          * @privlevel   public
233          * @privilege   %http://tizen.org/privilege/nfc.p2p
234          *
235          * @return      An error code
236          * @param[in]   message                 The NDEF message to be registered
237          * @param[in]   description             The description for the NDEF message to be registered @n
238          *                                      This description can be used in Reserved Push UI, for example, UI for
239          *                                      getting user consent to send the registered message.
240          * @exception   E_SUCCESS               The method is successful.
241          * @exception   E_INVALID_ARG           The input @c message is invalid. @n
242          *                                      For example, it does not contain any NDEF records.
243          * @exception   E_UNSUPPORTED_OPERATION The device does not support the NFC or the Reserved Push feature.
244          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
245          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
246          * @see         <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
247          *              The NFC Reserved Push guide</a>
248          * @remarks     An application can register only one NDEF message. So the previously registered message will be
249          *              replaced by the new one.@n
250          *              The registered NDEF message can be selected to the Reserved Push message only by the user through
251          *              the Setting application.
252          */
253         static result RegisterNdefPushMessage(const NdefMessage& message, const Tizen::Base::String& description);
254
255         /**
256          * Unregisters an NDEF message from the Reserved Push candidates.
257          *
258          * @since       2.0
259          * @privlevel   public
260          * @privilege   %http://tizen.org/privilege/nfc.p2p
261          *
262          * @return      An error code
263          * @exception   E_SUCCESS               The method is successful.
264          * @exception   E_UNSUPPORTED_OPERATION The device does not support the NFC or the Reserved Push feature.
265          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
266          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
267          * @see         <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
268          *              The NFC Reserved Push guide</a>
269          */
270         static result UnregisterNdefPushMessage(void);
271
272 private:
273         //
274         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying
275         // of objects.
276         //
277         NdefPushManager(const NdefPushManager& value);
278
279         //
280         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit
281         // copying of objects.
282         //
283         NdefPushManager& operator =(const NdefPushManager& value);
284
285 private:
286         _NdefPushManagerImpl* __pImpl;
287
288         friend class _NdefPushManagerImpl;
289 }; // NdefPushManager
290
291 } } } // Tizen::Net::Nfc
292
293 #endif // _FNET_NFC_NDEF_PUSH_MANAGER_H_