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="../org.tizen.native.appprogramming/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
86 * @feature %http://tizen.org/feature/network.nfc
88 * @return An error code
89 * @param[in] pListener An instance of %INdefPushManagerListener. @n
90 * If it is null, it will reset the listener.
91 * @exception E_SUCCESS The method is successful.
92 * @exception E_OUT_OF_MEMORY The memory is insufficient.
93 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
94 * For more information, see
95 * <a href=”../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm”>
96 * Application Filtering</a>.
97 * @exception E_OPERATION_FAILED The operation has failed.
98 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
99 * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue()
102 result SetNdefPushManagerListener(INdefPushManagerListener* pListener);
105 * Pushes the NDEF message.
109 * @privilege %http://tizen.org/privilege/nfc.p2p
110 * @feature %http://tizen.org/feature/network.nfc
112 * @return An error code
113 * @param[in] message The NDEF message to send
114 * @exception E_SUCCESS The method is successful.
115 * @exception E_DEVICE_BUSY The device is processing preceding job.
116 * @exception E_OUT_OF_MEMORY The memory is insufficient.
117 * @exception E_INVALID_STATE This instance is in an invalid state. @n
118 * For example, the NFC feature is not activated or a peer device is not
120 * @exception E_INVALID_ARG The input @c message is invalid. @n
121 * For example, it does not contain any NDEF records.
122 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
123 * For more information, see
124 * <a href=”../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm”>
125 * Application Filtering</a>.
126 * @exception E_OPERATION_FAILED The operation has failed.
127 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
128 * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue()
131 result Push(const NdefMessage& message);
134 * Activates the Reserved Push feature that sends the preselected NDEF message to the connected NFC peer device on
135 * behalf of the application.
138 * @privlevel platform
139 * @privilege %http://tizen.org/privilege/nfcmanager
140 * @feature %http://tizen.org/feature/network.nfc and %http://tizen.org/feature/network.nfc.reserved_push @n
141 * Both the features are required.
143 * @return An error code
144 * @exception E_SUCCESS The method is successful.
145 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
147 * For example, Reserved Push is already activated.
148 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
149 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
150 * For more information, see
151 * <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">
152 * Application Filtering</a>.
153 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
154 * @see <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
155 * The NFC Reserved Push guide</a>
156 * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue()
159 result ActivateReservedPush(void);
162 * Deactivates the Reserved Push feature that sends the preselected NDEF message to the connected NFC peer device on
163 * behalf of the application.
166 * @privlevel platform
167 * @privilege %http://tizen.org/privilege/nfcmanager
168 * @feature %http://tizen.org/feature/network.nfc and %http://tizen.org/feature/network.nfc.reserved_push @n
169 * Both the features are required.
171 * @return An error code
172 * @exception E_SUCCESS The method is successful.
173 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
175 * For example, Reserved Push is already deactivated.
176 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
177 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
178 * For more information, see
179 * <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">
180 * Application Filtering</a>.
181 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
182 * @see <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
183 * The NFC Reserved Push guide</a>
184 * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue()
187 result DeactivateReservedPush(void);
190 * Checks whether the Reserved Push feature is activated.
194 * @return @c true if Reserved Push is activated, @n
197 bool IsReservedPushActivated(void) const;
200 * Gets information of all the Reserved Push candidates. @n Each element of the result Tizen::Base::Collection::IMap consists of the package ID
201 * of the application that registered the NDEF message and the description about the registered NDEF message.
205 * @return An IMapT containing the pairs of package ID and message description if successful, @n
207 * @remarks The key of the returned Tizen::Base::Collection::IMap should be casted to Tizen::App::PackageId pointer and the value should
208 * be casted to Tizen::Base::String pointer.
210 Tizen::Base::Collection::IMap* GetReservedPushCandidatesN(void) const;
213 * Picks out an NDEF message among all the Reserved Push candidates by the application ID. @n The selected NDEF message is
214 * pushed when a peer device is detected.
217 * @privlevel platform
218 * @privilege %http://tizen.org/privilege/nfcmanager
219 * @feature %http://tizen.org/feature/network.nfc and %http://tizen.org/feature/network.nfc.reserved_push @n
220 * Both the features are required.
222 * @return An error code
223 * @param[in] packageId The package ID of the application that registered the NDEF message to push
224 * @exception E_SUCCESS The method is successful.
225 * @exception E_OBJ_NOT_FOUND The specified @c packageId is not found in the Reserved Push candidate list.
226 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
227 * For more information, see
228 * <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">
229 * Application Filtering</a>.
230 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
231 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
232 * @see <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
233 * The NFC Reserved Push guide</a>
235 * - The only one message can be selected to push. So the previously selected message will be replaced
237 * - Before calling this method, check whether the feature is supported by
238 * %Tizen::System::SystemInfo::GetValue() methods.
240 result PickReservedPushMessage(const Tizen::App::PackageId& packageId);
243 * Gets the owner application ID of the picked NDEF message among all the Reserved Push candidates.
246 * @feature %http://tizen.org/feature/network.nfc and %http://tizen.org/feature/network.nfc.reserved_push @n
247 * Both the features are required.
249 * @return The package ID of the application which is the owner of the picked Reserved Push message @n
250 * else an empty string if an error occurs
251 * @exception E_SUCCESS The method is successful.
252 * @exception E_OBJ_NOT_FOUND There is no element in the Reserved Push candidate list.
253 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
254 * For more information, see
255 * <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">
256 * Application Filtering</a>.
257 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
258 * @see <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
259 * The NFC Reserved Push guide</a>
261 * - The specific error code can be accessed using the GetLastResult() method.
262 * - Before calling this method, check whether the feature is supported by
263 * %Tizen::System::SystemInfo::GetValue() methods.
265 Tizen::App::PackageId GetPickedReservedPushMessage(void) const;
268 * Registers an NDEF message as a Reserved Push candidate. @n
269 * If the message is picked out among the candidates, it is pushed to the detected peer device when the home screen
270 * or the main menu is on top of the screen in the local device.
274 * @privilege %http://tizen.org/privilege/nfc.p2p
275 * @feature %http://tizen.org/feature/network.nfc and %http://tizen.org/feature/network.nfc.reserved_push @n
276 * Both the features are required.
278 * @return An error code
279 * @param[in] message The NDEF message to register
280 * @param[in] description The description for the NDEF message to register @n
281 * This description can be used in Reserved Push UI, for example, UI for
282 * getting user consent to send the registered message.
283 * @exception E_SUCCESS The method is successful.
284 * @exception E_INVALID_ARG The input @c message is invalid. @n
285 * For example, it does not contain any NDEF records.
286 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
287 * For more information, see
288 * <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">
289 * Application Filtering</a>.
290 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
291 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
292 * @see <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
293 * The NFC Reserved Push guide</a>
295 * - An application can register only one NDEF message. So the previously registered message will be
296 * replaced by the new one.
297 * - The registered NDEF message is pushed only if it is selected by the user through the Setting
299 * - Before calling this method, check whether the feature is supported by
300 * %Tizen::System::SystemInfo::GetValue() methods.
302 static result RegisterNdefPushMessage(const NdefMessage& message, const Tizen::Base::String& description);
305 * Unregisters an NDEF message from the Reserved Push candidates.
309 * @privilege %http://tizen.org/privilege/nfc.p2p
310 * @feature %http://tizen.org/feature/network.nfc and %http://tizen.org/feature/network.nfc.reserved_push @n
311 * Both the features are required.
313 * @return An error code
314 * @exception E_SUCCESS The method is successful.
315 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
316 * For more information, see
317 * <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">
318 * Application Filtering</a>.
319 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
320 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
321 * @see <a href="../org.tizen.native.appprogramming/html/guide/net/nfc_reserved_push.htm">
322 * The NFC Reserved Push guide</a>
323 * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue()
326 static result UnregisterNdefPushMessage(void);
330 // The implementation of this copy constructor is intentionally blank to prohibit copying of objects.
332 NdefPushManager(const NdefPushManager& value);
335 // The implementation of this copy assignment operator is intentionally blank to prohibit copying of objects.
337 NdefPushManager& operator =(const NdefPushManager& value);
340 _NdefPushManagerImpl* __pImpl;
342 friend class _NdefPushManagerImpl;
343 }; // NdefPushManager
345 } } } // Tizen::Net::Nfc
347 #endif // _FNET_NFC_NDEF_PUSH_MANAGER_H_