Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Nucleo_NFC_Example I2C_NFC_Master Print_Entire_Nucleo_NFC01A1_Memory
Fork of lib_NDEF by
lib_NDEF.h
00001 /** 00002 ****************************************************************************** 00003 * @file lib_NDEF.h 00004 * @author MMY Application Team 00005 * @version V1.0.0 00006 * @date 20-November-2013 00007 * @brief This file help to manage NDEF file. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> 00012 * 00013 * Licensed under MMY-ST Liberty SW License Agreement V2, (the "License"); 00014 * You may not use this file except in compliance with the License. 00015 * You may obtain a copy of the License at: 00016 * 00017 * http://www.st.com/software_license_agreement_liberty_v2 00018 * 00019 * Unless required by applicable law or agreed to in writing, software 00020 * distributed under the License is distributed on an "AS IS" BASIS, 00021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00022 * See the License for the specific language governing permissions and 00023 * limitations under the License. 00024 * 00025 ****************************************************************************** 00026 */ 00027 00028 /* Define to prevent recursive inclusion -------------------------------------*/ 00029 #ifndef __LIB_NDEF_H 00030 #define __LIB_NDEF_H 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 /* Includes ------------------------------------------------------------------*/ 00037 /* include file which match the HW configuration */ 00038 #include "lib_wrapper.h" 00039 00040 #ifndef errorchk 00041 #define errorchk(fCall) if (status = (fCall), status != M24SR_ACTION_COMPLETED) \ 00042 {goto Error;} else 00043 #endif 00044 00045 00046 #define NDEF_SIZE_OFFSET 0 00047 #define FIRST_RECORD_OFFSET 2 00048 00049 #define RECORD_FLAG_FIELD 1 00050 #define TYPE_LENGTH_FIELD 1 00051 #define ID_LENGTH_FIELD 1 00052 00053 00054 #define MB_Mask ((uint8_t)(0x80)) 00055 #define ME_Mask ((uint8_t)(0x40)) 00056 #define CF_Mask ((uint8_t)(0x20)) 00057 #define SR_Mask ((uint8_t)(0x10)) 00058 #define IL_Mask ((uint8_t)(0x08)) 00059 #define TNF_Mask ((uint8_t)(0x07)) 00060 00061 #define TNF_Empty 0x00 00062 #define TNF_WellKnown 0x01 00063 #define TNF_MediaType 0x02 00064 #define TNF_AbsoluteURI 0x03 00065 #define TNF_NFCForumExternal 0x04 00066 #define TNF_Unknown 0x05 00067 #define TNF_Unchanged 0x06 00068 #define TNF_Reserved 0x07 00069 00070 #define SP_MAX_RECORD 3 00071 00072 #define AAR_TYPE_STRING "android.com:pkg" 00073 #define AAR_TYPE_STRING_LENGTH 15 00074 00075 #define M24SR_DISCOVERY_APP_STRING "st.com:m24sr_discovery_democtrl" 00076 #define M24SR_DISCOVERY_APP_STRING_LENGTH 31 00077 00078 #define VCARD_TYPE_STRING "text/vcard" 00079 #define VCARD_TYPE_STRING_LENGTH 10 00080 00081 #define XVCARD_TYPE_STRING "text/x-vCard" 00082 #define XVCARD_TYPE_STRING_LENGTH 12 00083 00084 #define SMART_POSTER_TYPE_STRING "Sp" 00085 #define SMART_POSTER_TYPE_STRING_LENGTH 2 00086 00087 #define URI_TYPE_STRING "U" 00088 #define URI_TYPE_STRING_LENGTH 1 00089 00090 #define SMS_TYPE_STRING "sms:" 00091 #define SMS_TYPE_STRING_LENGTH 4 00092 00093 #define GEO_TYPE_STRING "geo:" 00094 #define GEO_TYPE_STRING_LENGTH 4 00095 00096 #define URI_LATITUDE_END "," 00097 #define URI_LATITUDE_END_LENGTH 1 00098 00099 #define EMAIL_TYPE_STRING "mailto:" 00100 #define EMAIL_TYPE_STRING_LENGTH 7 00101 00102 #define URI_FIRST_DATA_END "?" 00103 #define URI_FIRST_DATA_END_LENGTH 1 00104 00105 #define SUBJECT_BEGIN_STRING "subject=" 00106 #define SUBJECT_BEGIN_STRING_LENGTH 8 00107 00108 #define MESSAGE_BEGIN_STRING "body=" 00109 #define MESSAGE_BEGIN_STRING_LENGTH 5 00110 00111 #define URI_SECOND_DATA_END "&" 00112 #define URI_SECOND_DATA_END_LENGTH 1 00113 00114 #define TEXT_TYPE_STRING "T" 00115 #define TEXT_TYPE_STRING_LENGTH 1 00116 00117 #define ISO_ENGLISH_CODE_STRING "en" 00118 #define ISO_ENGLISH_CODE_STRING_LENGTH 2 00119 00120 00121 #define URI_ID_0x00 0x00 00122 #define URI_ID_0x01 0x01 00123 #define URI_ID_0x02 0x02 00124 #define URI_ID_0x03 0x03 00125 #define URI_ID_0x04 0x04 00126 #define URI_ID_0x05 0x05 00127 #define URI_ID_0x06 0x06 00128 #define URI_ID_0x07 0x07 00129 #define URI_ID_0x08 0x08 00130 #define URI_ID_0x09 0x09 00131 #define URI_ID_0x0A 0x0A 00132 #define URI_ID_0x0B 0x0B 00133 #define URI_ID_0x0C 0x0C 00134 #define URI_ID_0x0D 0x0D 00135 #define URI_ID_0x0E 0x0E 00136 #define URI_ID_0x0F 0x0F 00137 #define URI_ID_0x10 0x10 00138 #define URI_ID_0x11 0x11 00139 #define URI_ID_0x12 0x12 00140 #define URI_ID_0x13 0x13 00141 #define URI_ID_0x14 0x14 00142 #define URI_ID_0x15 0x15 00143 #define URI_ID_0x16 0x16 00144 #define URI_ID_0x17 0x17 00145 #define URI_ID_0x18 0x18 00146 #define URI_ID_0x19 0x19 00147 #define URI_ID_0x1A 0x1A 00148 #define URI_ID_0x1B 0x1B 00149 #define URI_ID_0x1C 0x1C 00150 #define URI_ID_0x1D 0x1D 00151 #define URI_ID_0x1E 0x1E 00152 #define URI_ID_0x1F 0x1F 00153 #define URI_ID_0x20 0x20 00154 #define URI_ID_0x21 0x21 00155 #define URI_ID_0x22 0x22 00156 #define URI_ID_0x23 0x23 00157 #define URI_RFU 0x24 00158 00159 #define URI_ID_0x01_STRING "http://www.\0" 00160 #define URI_ID_0x02_STRING "https://www.\0" 00161 #define URI_ID_0x03_STRING "http://\0" 00162 #define URI_ID_0x04_STRING "https://\0" 00163 #define URI_ID_0x05_STRING "tel:\0" 00164 #define URI_ID_0x06_STRING "mailto:\0" 00165 #define URI_ID_0x07_STRING "ftp://anonymous:anonymous@\0" 00166 #define URI_ID_0x08_STRING "ftp://ftp.\0" 00167 #define URI_ID_0x09_STRING "ftps://\0" 00168 #define URI_ID_0x0A_STRING "sftp://\0" 00169 #define URI_ID_0x0B_STRING "smb://\0" 00170 #define URI_ID_0x0C_STRING "nfs://\0" 00171 #define URI_ID_0x0D_STRING "ftp://\0" 00172 #define URI_ID_0x0E_STRING "dav://\0" 00173 #define URI_ID_0x0F_STRING "news:\0" 00174 #define URI_ID_0x10_STRING "telnet://\0" 00175 #define URI_ID_0x11_STRING "imap:\0" 00176 #define URI_ID_0x12_STRING "rtsp://\0" 00177 #define URI_ID_0x13_STRING "urn:\0" 00178 #define URI_ID_0x14_STRING "pop:\0" 00179 #define URI_ID_0x15_STRING "sip:\0" 00180 #define URI_ID_0x16_STRING "sips:\0" 00181 #define URI_ID_0x17_STRING "tftp:\0" 00182 #define URI_ID_0x18_STRING "btspp://\0" 00183 #define URI_ID_0x19_STRING "btl2cap://\0" 00184 #define URI_ID_0x1A_STRING "btgoep://\0" 00185 #define URI_ID_0x1B_STRING "tcpobex://\0" 00186 #define URI_ID_0x1C_STRING "irdaobex://\0" 00187 #define URI_ID_0x1D_STRING "file://\0" 00188 #define URI_ID_0x1E_STRING "urn:epc:id:\0" 00189 #define URI_ID_0x1F_STRING "urn:epc:tag\0" 00190 #define URI_ID_0x20_STRING "urn:epc:pat:\0" 00191 #define URI_ID_0x21_STRING "urn:epc:raw:\0" 00192 #define URI_ID_0x22_STRING "urn:epc:\0" 00193 #define URI_ID_0x23_STRING "urn:nfc:\0" 00194 00195 typedef enum 00196 { 00197 UNKNOWN_TYPE = 0, 00198 VCARD_TYPE, 00199 WELL_KNOWN_ABRIDGED_URI_TYPE, 00200 URI_SMS_TYPE, 00201 URI_GEO_TYPE, 00202 URI_EMAIL_TYPE, 00203 SMARTPOSTER_TYPE, 00204 URL_TYPE, 00205 TEXT_TYPE, 00206 BT_TYPE, 00207 /* list of "external type" known by this demo, other external type will be addressed as UNKNWON_TYPE */ 00208 M24SR_DISCOVERY_APP_TYPE 00209 } NDEF_TypeDef; 00210 00211 typedef struct 00212 { 00213 uint8_t RecordFlags; 00214 uint8_t TypeLength; 00215 uint8_t PayloadLength3; 00216 uint8_t PayloadLength2; 00217 uint8_t PayloadLength1; 00218 uint8_t PayloadLength0; 00219 uint8_t IDLength; 00220 uint8_t Type[0xFF]; 00221 uint8_t ID[0xFF]; 00222 uint16_t PayloadOffset; 00223 uint32_t PayloadBufferAdd; /* add where payload content has been stored */ 00224 NDEF_TypeDef NDEF_Type; /* to store identification ID for application */ 00225 uint32_t SPRecordStructAdd[SP_MAX_RECORD]; /*in case of smart poster array to store add of other sRecordInfo struct */ 00226 uint8_t NbOfRecordInSPPayload; 00227 }sRecordInfo; 00228 00229 00230 uint16_t NDEF_IdentifyNDEF ( sRecordInfo *pRecordStruct, uint8_t* pNDEF ); 00231 uint16_t NDEF_ReadNDEF( uint8_t *pNDEF); 00232 uint16_t NDEF_WriteNDEF( uint8_t *pNDEF); 00233 00234 #ifdef __cplusplus 00235 } 00236 #endif 00237 #endif /* __LIB_NDEF_H */ 00238 00239 00240 /******************* (C) COPYRIGHT 2013 STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 14:05:02 by
1.7.2
