2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 FNetNfcNdefRecordType.h
19 * @brief This is the header file for the %NdefRecordType class.
21 * This header file contains the declarations of the %NdefRecordType class.
24 #ifndef _FNET_NFC_NDEF_RECORD_TYPE_H_
25 #define _FNET_NFC_NDEF_RECORD_TYPE_H_
27 #include <FBaseObject.h>
28 #include <FBaseString.h>
29 #include <FNetNfcNfcTypes.h>
31 namespace Tizen { namespace Base
36 namespace Tizen { namespace Net { namespace Nfc
39 class _NdefRecordTypeImpl;
43 * Defines the NDEF RTD Smart Poster type.
45 * @brief <i> [Deprecated] </i>
46 * @deprecated This object is provided only for backward compatibility and will be deleted in a future release.
47 * Use NFC_NDEF_RTD_SMART_POSTER instead of this object.
51 _OSP_EXPORT_ extern const Tizen::Base::String NDEF_RTD_SMART_POSTER;
54 * Defines the NDEF RTD Smart Poster type. ("Sp")
58 _OSP_EXPORT_ extern const wchar_t NFC_NDEF_RTD_SMART_POSTER[];
62 * Defines the NDEF RTD %Text type.
64 * @brief <i> [Deprecated] </i>
65 * @deprecated This object is provided only for backward compatibility and will be deleted in a future release.
66 * Use NFC_NDEF_RTD_TEXT instead of this object.
70 _OSP_EXPORT_ extern const Tizen::Base::String NDEF_RTD_TEXT;
73 * Defines the NDEF RTD %Text type. ("T")
77 _OSP_EXPORT_ extern const wchar_t NFC_NDEF_RTD_TEXT[];
81 * Defines the NDEF RTD URI type.
83 * @brief <i> [Deprecated] </i>
84 * @deprecated This object is provided only for backward compatibility and will be deleted in a future release.
85 * Use NFC_NDEF_RTD_URI instead of this object.
89 _OSP_EXPORT_ extern const Tizen::Base::String NDEF_RTD_URI;
92 * Defines the NDEF RTD URI type. ("U")
96 _OSP_EXPORT_ extern const wchar_t NFC_NDEF_RTD_URI[];
99 * @class NdefRecordType
100 * @brief This class represents the type of an NDEF record.
104 * The %NdefRecordType class represents the type of an NDEF record. It encapsulates the name and the name format of the NDEF record
106 * The name format is represented by the enumeration type, Tizen::Net::Nfc::NdefRecordTypeNameFormat. The name is encoded
107 * using the US_ASCII character set and follows the rules defined by the NFC forum RTDs and RFCs. The name does not
108 * include the prefix @c "urn:nfc:wkt:" and @c "urn:nfc:ext:" defined by the NFC forum.
110 * For more information on the class features, see
111 * <a href="../org.tizen.native.appprogramming/html/guide/net/nfc.htm">NFC Guide</a>.
114 class _OSP_EXPORT_ NdefRecordType
115 : public Tizen::Base::Object
119 * This is the default constructor for this class. @n
120 * Initializes this instance of %NdefRecordType with the specified parameter.
124 * @param[in] format The NDEF record type name format
126 NdefRecordType(NdefRecordTypeNameFormat format = NDEF_TNF_EMPTY);
129 * Copying of objects using this copy constructor is allowed.
133 * @param[in] recordType An instance of %NdefRecordType
135 NdefRecordType(const NdefRecordType& recordType);
138 * This destructor overrides Tizen::Base::Object::~Object().
142 virtual ~NdefRecordType(void);
145 * Copying of objects using this copy assignment operator is allowed.
149 * @param[in] rhs An instance of %NdefRecordType
151 NdefRecordType& operator =(const NdefRecordType& rhs);
154 * Compares the specified instance of an Object with the calling instance of %NdefRecordType.
158 * @return @c true if the values match, @n
160 * @param[in] obj The Object to be compared
161 * @remarks The method returns @c false if the specified object is not an %NdefRecordType instance. @n
162 * Additionally, the comparison rules for the record type name are different depending on the Type
163 * Name Format (TNF) value, as follows: @n
164 * <table border=1 cellpadding="1" cellspacing="1">
166 * <th>Type Name Format (TNF) value</th>
167 * <th>The comparison rule for the record type name</th>
170 * <td>NDEF_TNF_WELL_KNOWN</td>
171 * <td>Compares a name, character by character in a case-sensitive manner </td>
174 * <td>NDEF_TNF_MIME_MEDIA </td>
175 * <td>Compares a name, character by character in a case-insensitive manner until the first semi-colon (;)
179 * <td>NDEF_TNF_ABSOLUTE_URI </td>
180 * <td>The reserved characters must be percent encoded and the hexadecimal digits are normalized to upper-case
181 * letters. The URI scheme and host parts of the URI must be normalized to lower case. After this, the URIs
182 * are compared character by character in a case-sensitive manner. </td>
185 * <td>NDEF_TNF_EXTERNAL </td>
186 * <td>Compares a name, character by character in a case-insensitive manner </td>
189 * <td>NDEF_TNF_EMPTY | NDEF_TNF_UNKNOWN </td>
190 * <td>Both record type names must be empty </td>
194 virtual bool Equals(const Tizen::Base::Object& obj) const;
197 * Gets the hash value of the current instance.
201 * @return The hash value of the current instance
202 * @remarks The two equal %NdefRecordType instances return the same hash value.
204 virtual int GetHashCode(void) const;
207 * Gets the name format of this record type.
211 * @return The name format of this record type
213 NdefRecordTypeNameFormat GetNameFormat(void) const;
216 * Gets the name of this record type.
220 * @return The name of this record type, @n
221 * else an empty string if the name format is NDEF_TNF_EMPTY or NDEF_TNF_UNKNOWN
222 * @remarks The returned name does not have the prefix @c "urn:nfc:wkt:" and @c "urn:nfc:ext:" defined by the
224 * In case of NDEF_TNF_ABSOLUTE_URI name format, this method returns the name in the same format as it
225 * is given in the constructor, that is, with or without percent encoding. The name consists of the
226 * characters encoded using the US_ASCII character set.
228 Tizen::Base::String GetName(void) const;
231 * Sets the name of this record type.
235 * @return An error code
236 * @param[in] name The name of this record type
237 * @exception E_SUCCESS The method is successful.
238 * @exception E_INVALID_OPERATION This operation is not allowed if the name format is NDEF_TNF_EMPTY,
239 * NDEF_TNF_UNKNOWN, or NDEF_TNF_ALL.
240 * @exception E_INVALID_ENCODING_RANGE The specified input string contains the code points that are outside
241 * the bounds specified by the US_ASCII encoding scheme.
242 * @exception E_INVALID_FORMAT The specified format of the @c name is invalid as per the
243 * specifications defined for each type of the name format.
244 * @exception E_MAX_EXCEEDED The length of the name exceeds @c 256 characters.
245 * @remarks The input name must not have the prefix defined by the NFC forum such as @c "urn:nfc:wkt:" and
248 result SetName(const Tizen::Base::String& name);
251 _NdefRecordTypeImpl* __pImpl;
253 friend class _NdefRecordTypeImpl;
257 } } } // Tizen::Net::Nfc
259 #endif // _FNET_NFC_NDEF_RECORD_TYPE_H_