2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
18 * @file FNetNfcNdefPushManager.h
19 * @brief This is the header file for the %NdefPushManager class.
21 * This header file contains the declarations of the %NdefPushManager class.
23 #ifndef _FNET_NFC_NDEF_PUSH_MANAGER_H_
24 #define _FNET_NFC_NDEF_PUSH_MANAGER_H_
26 #include <FBaseObject.h>
27 #include <FBaseResult.h>
28 #include <FAppTypes.h>
30 namespace Tizen { namespace Base
35 namespace Tizen { namespace Base { namespace Collection
41 namespace Tizen { namespace Net { namespace Nfc
44 class INdefPushManagerListener;
46 class _NdefPushManagerImpl;
49 * @class NdefPushManager
50 * @brief This is the class for pushing an NDEF message to a device.
54 * @final This class is not intended for extension.
56 * The %NdefPushManager class is the class for pushing an NDEF message to a device.
58 * For more information on the class features, see
59 * <a href="../com.osp.cppappprogramming.help/html/guide/net/nfc.htm">NFC Guide</a>.
62 class _OSP_EXPORT_ NdefPushManager
63 : public Tizen::Base::Object
67 * This is the default constructor for this class.
71 NdefPushManager(void);
74 * This destructor overrides Object::~Object().
78 ~NdefPushManager(void);
81 * Sets a listener for receiving the result of pushing an NDEF message.
85 * @privilege %http://tizen.org/privilege/nfc.p2p
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.
96 result SetNdefPushManagerListener(INdefPushManagerListener* pListener);
99 * Pushes the NDEF message.
103 * @privilege %http://tizen.org/privilege/nfc.p2p
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
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.
120 result Push(const NdefMessage& message);
123 * Activates Reserved Push feature which sends the preselected NDEF message to the connected NFC peer device on
124 * behalf of the application.
127 * @privlevel platform
128 * @privilege %http://tizen.org/privilege/nfcmanager
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
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>
141 result ActivateReservedPush(void);
144 * Deactivates Reserved Push feature which sends the preselected NDEF message to the connected NFC peer device on
145 * behalf of the application.
148 * @privlevel platform
149 * @privilege %http://tizen.org/privilege/nfcmanager
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
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>
162 result DeactivateReservedPush(void);
165 * Checks whether Reserved Push feature is activated.
169 * @return @c true if Reserved Push is activated, @n
172 bool IsReservedPushActivated(void) const;
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.
180 * @return An IMapT containing the pairs of package ID and message description if successful, @n
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.
185 Tizen::Base::Collection::IMap* GetReservedPushCandidatesN(void) const;
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.
192 * @privlevel platform
193 * @privilege %http://tizen.org/privilege/nfcmanager
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
207 result PickReservedPushMessage(const Tizen::App::PackageId& packageId);
210 * Gets the owner application ID of the picked NDEF message among all Reserved Push candidates.
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.
224 Tizen::App::PackageId GetPickedReservedPushMessage(void) const;
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.
233 * @privilege %http://tizen.org/privilege/nfc.p2p
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.
253 static result RegisterNdefPushMessage(const NdefMessage& message, const Tizen::Base::String& description);
256 * Unregisters an NDEF message from the Reserved Push candidates.
260 * @privilege %http://tizen.org/privilege/nfc.p2p
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>
270 static result UnregisterNdefPushMessage(void);
274 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying
277 NdefPushManager(const NdefPushManager& value);
280 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit
281 // copying of objects.
283 NdefPushManager& operator =(const NdefPushManager& value);
286 _NdefPushManagerImpl* __pImpl;
288 friend class _NdefPushManagerImpl;
289 }; // NdefPushManager
291 } } } // Tizen::Net::Nfc
293 #endif // _FNET_NFC_NDEF_PUSH_MANAGER_H_