2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <net_nfc_typedef.h>
21 #ifndef __NET_NFC_DATA_H__
22 #define __NET_NFC_DATA_H__
31 @addtogroup NET_NFC_MANAGER_INFO
33 This document is for the APIs reference document
35 NFC Manager defines are defined in <nfc-manager-def.h>
37 @li @c #net_nfc_initialize Initialize the nfc device.
42 create data handler only.
44 @param[out] data data handler
46 @return return the result of this operation
48 @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illigal NULL pointer(s)
49 @exception NET_NFC_ALLOC_FAIL memory allocation is failed
52 net_nfc_error_e net_nfc_create_data_only (data_h* data);
55 create data handler with initial values, bytes will be copied into the data handler.
57 @param[out] data data handler
58 @param[in] bytes binary data
59 @param[in] length size of binary data;
61 @return return the result of this operation
63 @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illigal NULL pointer(s)
64 @exception NET_NFC_ALLOC_FAIL memory allocation is failed
66 net_nfc_error_e net_nfc_create_data (data_h* data, const uint8_t* bytes, const uint32_t length);
69 get the byes and length from data handler. data handler assume bytes may have '0x0' value.
70 that's why this function also provides the length.
72 @param[in] data data handler
73 @param[out] bytes binary pointer (it returns the direct pointer of handler's data) do not free this
74 @param[out] length length of the binary data;
76 @return return the result of this operation
78 @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illigal NULL pointer(s)
80 net_nfc_error_e net_nfc_get_data (const data_h data, uint8_t** bytes, uint32_t * length);
83 replace the data handler with given bytes. binary data (bytes) will be copied to data hander.
84 application should free or use local variable for given byte pointer.
86 @param[in] data data handler
87 @param[in] bytes binary data
88 @param[in] length size of binary data
90 @return return the result of this operation
92 @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illigal NULL pointer(s)
95 net_nfc_error_e net_nfc_set_data (const data_h data, const uint8_t* bytes, const uint32_t length);
98 get length of data handler's bytes.
100 @param[in] data data handler
102 @return length of bytes length
104 @exception 0 is returned if data is NULL
107 uint32_t net_nfc_get_data_length (const data_h data);
110 get pointer of the handler's bytes (do not free this. it wll be freed when the application call "net_nfc_free_data" function
112 @param[in] data data handler
114 @return the pointer of bytes.
116 @exception NULL is returned if data is NULL
119 uint8_t * net_nfc_get_data_buffer (const data_h data);
122 free data handler. (it also free the copied bytes)
124 @param[in] data data handler
126 @return return the result of this operation
128 @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illigal NULL pointer(s)
131 net_nfc_error_e net_nfc_free_data (data_h data);