Fork for the GitHub
lib_NDEF_Text.h@0:de13951f30f6, 2019-11-14 (annotated)
- Committer:
- DiegoOstuni
- Date:
- Thu Nov 14 10:34:11 2019 +0000
- Revision:
- 0:de13951f30f6
Add files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DiegoOstuni | 0:de13951f30f6 | 1 | /** |
DiegoOstuni | 0:de13951f30f6 | 2 | ****************************************************************************** |
DiegoOstuni | 0:de13951f30f6 | 3 | * @file lib_NDEF_Text.h |
DiegoOstuni | 0:de13951f30f6 | 4 | * @author MMY Application Team |
DiegoOstuni | 0:de13951f30f6 | 5 | * @version $Revision: 3210 $ |
DiegoOstuni | 0:de13951f30f6 | 6 | * @date $Date: 2016-12-05 15:37:48 +0100 (Mon, 05 Dec 2016) $ |
DiegoOstuni | 0:de13951f30f6 | 7 | * @brief This file help to manage Text NDEF file. |
DiegoOstuni | 0:de13951f30f6 | 8 | ****************************************************************************** |
DiegoOstuni | 0:de13951f30f6 | 9 | * @attention |
DiegoOstuni | 0:de13951f30f6 | 10 | * |
DiegoOstuni | 0:de13951f30f6 | 11 | * <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> |
DiegoOstuni | 0:de13951f30f6 | 12 | * |
DiegoOstuni | 0:de13951f30f6 | 13 | * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License"); |
DiegoOstuni | 0:de13951f30f6 | 14 | * You may not use this file except in compliance with the License. |
DiegoOstuni | 0:de13951f30f6 | 15 | * You may obtain a copy of the License at: |
DiegoOstuni | 0:de13951f30f6 | 16 | * |
DiegoOstuni | 0:de13951f30f6 | 17 | * http://www.st.com/myliberty |
DiegoOstuni | 0:de13951f30f6 | 18 | * |
DiegoOstuni | 0:de13951f30f6 | 19 | * Unless required by applicable law or agreed to in writing, software |
DiegoOstuni | 0:de13951f30f6 | 20 | * distributed under the License is distributed on an "AS IS" BASIS, |
DiegoOstuni | 0:de13951f30f6 | 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, |
DiegoOstuni | 0:de13951f30f6 | 22 | * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY, |
DiegoOstuni | 0:de13951f30f6 | 23 | * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
DiegoOstuni | 0:de13951f30f6 | 24 | * See the License for the specific language governing permissions and |
DiegoOstuni | 0:de13951f30f6 | 25 | * limitations under the License. |
DiegoOstuni | 0:de13951f30f6 | 26 | * |
DiegoOstuni | 0:de13951f30f6 | 27 | ****************************************************************************** |
DiegoOstuni | 0:de13951f30f6 | 28 | */ |
DiegoOstuni | 0:de13951f30f6 | 29 | |
DiegoOstuni | 0:de13951f30f6 | 30 | /* Define to prevent recursive inclusion -------------------------------------*/ |
DiegoOstuni | 0:de13951f30f6 | 31 | #ifndef __LIB_NDEF_TEXT_H |
DiegoOstuni | 0:de13951f30f6 | 32 | #define __LIB_NDEF_TEXT_H |
DiegoOstuni | 0:de13951f30f6 | 33 | |
DiegoOstuni | 0:de13951f30f6 | 34 | /* Includes ------------------------------------------------------------------*/ |
DiegoOstuni | 0:de13951f30f6 | 35 | #include "lib_NDEF.h" |
DiegoOstuni | 0:de13951f30f6 | 36 | |
DiegoOstuni | 0:de13951f30f6 | 37 | /** @brief NDEF Text buffer length. */ |
DiegoOstuni | 0:de13951f30f6 | 38 | #define NDEF_TEXT_MAX_LENGTH 40 |
DiegoOstuni | 0:de13951f30f6 | 39 | /** @brief NDEF Language code buffer length. */ |
DiegoOstuni | 0:de13951f30f6 | 40 | #define NDEF_TEXT_LANGUAGE_CODE_MAX_LENGTH 10 |
DiegoOstuni | 0:de13951f30f6 | 41 | |
DiegoOstuni | 0:de13951f30f6 | 42 | /** @brief NDEF Text encoding possible values. */ |
DiegoOstuni | 0:de13951f30f6 | 43 | typedef enum { |
DiegoOstuni | 0:de13951f30f6 | 44 | NDEF_TEXT_UTF8 = 0, |
DiegoOstuni | 0:de13951f30f6 | 45 | NDEF_TEXT_UTF16 = 1 |
DiegoOstuni | 0:de13951f30f6 | 46 | } NDEF_Text_encoding_t; |
DiegoOstuni | 0:de13951f30f6 | 47 | |
DiegoOstuni | 0:de13951f30f6 | 48 | /** @brief This structure is used to handle information from a NDEF Text record. */ |
DiegoOstuni | 0:de13951f30f6 | 49 | typedef struct { |
DiegoOstuni | 0:de13951f30f6 | 50 | NDEF_Text_encoding_t encoding; /**< metadata: UTF-8 / UTF-16. */ |
DiegoOstuni | 0:de13951f30f6 | 51 | char language_code[NDEF_TEXT_LANGUAGE_CODE_MAX_LENGTH]; /**< metadata: Language code as specified by IANA. */ |
DiegoOstuni | 0:de13951f30f6 | 52 | char text[NDEF_TEXT_MAX_LENGTH]; /**< The text itself. */ |
DiegoOstuni | 0:de13951f30f6 | 53 | } NDEF_Text_info_t; |
DiegoOstuni | 0:de13951f30f6 | 54 | |
DiegoOstuni | 0:de13951f30f6 | 55 | |
DiegoOstuni | 0:de13951f30f6 | 56 | /** @brief This structure is used to parse the raw data from a text record and access its metadata. */ |
DiegoOstuni | 0:de13951f30f6 | 57 | typedef struct { |
DiegoOstuni | 0:de13951f30f6 | 58 | uint8_t language_length:4; /**< Language code length. */ |
DiegoOstuni | 0:de13951f30f6 | 59 | uint8_t rfu:3; /**< reserved for futur usage */ |
DiegoOstuni | 0:de13951f30f6 | 60 | uint8_t encoding:1; /**< UTF-8 (0) or UTF-16 (1) encoding. */ |
DiegoOstuni | 0:de13951f30f6 | 61 | char language[1]; /**< IANA language code. */ |
DiegoOstuni | 0:de13951f30f6 | 62 | } NDEF_Text_metadata_t; |
DiegoOstuni | 0:de13951f30f6 | 63 | |
DiegoOstuni | 0:de13951f30f6 | 64 | uint16_t NDEF_WriteText( char *text, I2C * mi2cChannel ); |
DiegoOstuni | 0:de13951f30f6 | 65 | uint16_t NDEF_ReadText( sRecordInfo_t *pRecordStruct, NDEF_Text_info_t *pText ); |
DiegoOstuni | 0:de13951f30f6 | 66 | |
DiegoOstuni | 0:de13951f30f6 | 67 | |
DiegoOstuni | 0:de13951f30f6 | 68 | #endif /* __LIB_NDEF_TEXT_H */ |
DiegoOstuni | 0:de13951f30f6 | 69 | |
DiegoOstuni | 0:de13951f30f6 | 70 | /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/ |