NB-IoT

Dependencies:   NDefLib X_NUCLEO_NFC02A1 hdc1080 mbed

Fork of HelloWorld_NFC02A1 by ST

Files at this revision

API Documentation at this revision

Comitter:
rosarium
Date:
Tue Aug 30 09:18:50 2016 +0000
Parent:
0:892175366555
Child:
2:6f1b1f7f8d12
Commit message:
NDefLib middle-ware library ported on HelloWorld_NFC02A1. Now NFC02A1 using the same middle-ware library as NFC01A1.

Changed in this revision

Lib_NDEF/lib_NDEF.cpp Show diff for this revision Revisions of this file
Lib_NDEF/lib_NDEF.h Show diff for this revision Revisions of this file
Lib_NDEF/lib_NDEF_URI.cpp Show diff for this revision Revisions of this file
Lib_NDEF/lib_NDEF_URI.h Show diff for this revision Revisions of this file
Lib_NDEF/tagtype5_wrapper.cpp Show diff for this revision Revisions of this file
Lib_NDEF/tagtype5_wrapper.h Show diff for this revision Revisions of this file
NDefLib.lib Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/Common/component.h Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/Common/nfc.h Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/Interfaces/Component_class.h Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/Interfaces/Nfc_class.h Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/Interfaces/X_NUCLEO_NFC02A1.cpp Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/Interfaces/X_NUCLEO_NFC02A1.h Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/X_NUCLEO_COMMON/DevI2C/DevI2C.h Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/m24lr/NDefNfcTagM24LR.cpp Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/m24lr/NDefNfcTagM24LR.h Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/m24lr/m24lr.cpp Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC02A1/m24lr/m24lr.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Lib_NDEF/lib_NDEF.cpp	Wed Jul 27 09:25:33 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,591 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    lib_NDEF.c
-  * @author  MMY Application Team
-  * @version $Revision: 1583 $
-  * @date    $Date: 2016-02-03 15:06:51 +0100 (Wed, 03 Feb 2016) $
-  * @brief   This file help to manage NDEF file, to parse and identify them.
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
-  *
-  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
-  * You may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at:
-  *
-  *        http://www.st.com/myliberty  
-  *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *
-  ******************************************************************************
-  */
-
-/* Includes ------------------------------------------------------------------*/
-#include "lib_NDEF.h"
-#include <stdint.h>
-#include <string.h>
-/** @addtogroup NFC_libraries
- *  @{
- *  @brief  <b>This is the library used to manage the content of the TAG (data)
- *          But also the specific feature of the tag, for instance
- *          password, gpo... </b>
- */
-
-
-/** @addtogroup libNFC_FORUM
-  * @{
-  * @brief  This part of the library manage data which follow NFC forum organisation.
-  */
-
-/** @defgroup libNDEF_Private_Functions
-  * @{
-  */
-
-
-
-/**
-  * @brief  This function check that the tag contain a NDEF message.
-  * @retval NDEF_OK : There is a NDEF file stored in tag.
-  * @retval NDEF_ERROR : No NDEF in the tag.
-  */
-uint16_t NDEF::NDEF_IsNDEFPresent( void )
-{
-  uint16_t FileSize;
-  uint8_t uNDEFHeader [0x2];
-
-  /* Check NDEF existence */
-  ReadData( NDEF_SIZE_OFFSET, 2, uNDEFHeader );
-  FileSize = (uint16_t)( (uNDEFHeader[0x00]<<8) | uNDEFHeader[0x01] );
-
-  if( FileSize != 0 )
-    return NDEF_OK;
-  else
-    return NDEF_ERROR;
-}
-
-/**
-  * @brief  This function identify the type of record.
-  * @param  pRecordStruct : pointer on the record structure to fill.
-  * @param  pPayload : pointer on the payload.
-  * @retval Status : Status of the operation.
-  */
-uint16_t NDEF::NDEF_IdentifySPRecord( sRecordInfo *pRecordStruct, uint8_t* pPayload )
-{
-  uint16_t status = NDEF_ERROR;
-  uint16_t SizeOfRecordHeader, TypeNbByte, PayloadLengthField, IDLengthField, IDNbByte;
-
-  /* Is ID length field present */
-  if( (*pPayload) & IL_Mask )
-  {
-    IDLengthField = ID_LENGTH_FIELD;
-  }
-  else
-  {
-    IDLengthField = 0;
-  }
-
-  /* it's a SR */
-  if( (*pPayload) & SR_Mask )
-  {
-    TypeNbByte = pPayload[1];
-    PayloadLengthField = 1;
-    if( IDLengthField == ID_LENGTH_FIELD )
-      IDNbByte = pPayload[3];
-    else
-      IDNbByte = 0;
-  }
-  else
-  {
-    TypeNbByte = pPayload[1];
-    PayloadLengthField = 4;
-    if( IDLengthField == ID_LENGTH_FIELD )
-      IDNbByte = pPayload[6];
-    else
-      IDNbByte = 0;
-  }
-
-  SizeOfRecordHeader = RECORD_FLAG_FIELD + TYPE_LENGTH_FIELD + PayloadLengthField + IDLengthField + TypeNbByte + IDNbByte;
-
-  /* it's a SR */
-  if( pPayload[0] & SR_Mask )
-  {
-    pRecordStruct->RecordFlags = pPayload[0];
-    pRecordStruct->TypeLength = TypeNbByte;
-    pRecordStruct->PayloadLength3 = 0;
-    pRecordStruct->PayloadLength2 = 0;
-    pRecordStruct->PayloadLength1 = 0;
-    pRecordStruct->PayloadLength0 = pPayload[2];
-    pRecordStruct->IDLength = IDNbByte;
-    memcpy( pRecordStruct->Type, &pPayload[3+IDNbByte], TypeNbByte );
-    memcpy( pRecordStruct->ID, &pPayload[3+IDNbByte+TypeNbByte], IDNbByte );
-    pRecordStruct->PayloadOffset = SizeOfRecordHeader;
-  }
-  else
-  {
-    pRecordStruct->RecordFlags = pPayload[0];
-    pRecordStruct->TypeLength = TypeNbByte;
-    pRecordStruct->PayloadLength3 = pPayload[2];
-    pRecordStruct->PayloadLength2 = pPayload[3];
-    pRecordStruct->PayloadLength1 = pPayload[4];
-    pRecordStruct->PayloadLength0 = pPayload[5];
-    pRecordStruct->IDLength = IDNbByte;
-    memcpy( pRecordStruct->Type, &pPayload[6+IDNbByte], TypeNbByte );
-    memcpy( pRecordStruct->ID, &pPayload[6+IDNbByte+TypeNbByte], IDNbByte );
-    pRecordStruct->PayloadOffset = SizeOfRecordHeader;
-  }
-
-  pRecordStruct->PayloadBufferAdd = (uint32_t)( pPayload + SizeOfRecordHeader );
-
-  status = NDEF_ParseRecordHeader( pRecordStruct );
-
-  return status;
-}
-
-/**
-  * @brief  This function parse the record header and dispatch regarding TNF value.
-  * @param  pRecordStruct : pointer on the record structure to fill.
-  * @retval NDEF_OK : record identified and structure filled.
-  * @retval NDEF_ERROR : Not supported.
-  */
-uint16_t NDEF::NDEF_ParseRecordHeader( sRecordInfo *pRecordStruct )
-{
-  uint16_t status = NDEF_OK;
-
-  switch( (pRecordStruct->RecordFlags & TNF_Mask) )
-  {
-    case TNF_WellKnown:
-      NDEF_ParseWellKnownType( pRecordStruct );
-      break;
-
-    case TNF_MediaType:
-      NDEF_ParseMediaType( pRecordStruct );
-      break;
-
-    case TNF_NFCForumExternal:
-      NDEF_ParseForumExternalType( pRecordStruct);
-      break;
-
-  default:
-      /* currently not supported or unknown*/
-      pRecordStruct->NDEF_Type = UNKNOWN_TYPE;
-      status = NDEF_ERROR;
-  }
-  return status;
-}
-
-/**
-  * @brief  This function parse the Well Known type record.
-  * @param  pRecordStruct : pointer on the record structure to fill.
-  */
-void NDEF::NDEF_ParseWellKnownType( sRecordInfo *pRecordStruct )
-{
-  uint8_t* pPayload;
-
-  pPayload = (uint8_t*)( pRecordStruct->PayloadBufferAdd );
-
-  if( !memcmp( &(pRecordStruct->Type), SMART_POSTER_TYPE_STRING, pRecordStruct->TypeLength ) )
-  { 
-    /* special case where   we have to parse others records */
-    pRecordStruct->NDEF_Type = SMARTPOSTER_TYPE;
-    NDEF_ParseSP( pRecordStruct );
-  }
-
-  else if( !memcmp( &(pRecordStruct->Type), URI_TYPE_STRING, pRecordStruct->TypeLength ) )
-  { 
-    /* it's an URI Type check if it's an URL or SMS or ... */
-    /* check identifier */
-    if( *pPayload == URI_ID_0x00 ) 
-    {
-      NDEF_ParseURI( pRecordStruct );
-    }
-    else if( (*pPayload > URI_ID_0x00) && (*pPayload < URI_RFU) ) 
-    {
-      /* email special case  */
-      if( *pPayload == (uint8_t) URI_ID_0x06 )
-      {
-        pRecordStruct->NDEF_Type = URI_EMAIL_TYPE;
-      }
-      else
-      {
-        pRecordStruct->NDEF_Type = WELL_KNOWN_ABRIDGED_URI_TYPE;
-      }
-    }
-    else
-    {
-      pRecordStruct->NDEF_Type = UNKNOWN_TYPE;
-    }
-  }
-
-  else if( !memcmp( &(pRecordStruct->Type), TEXT_TYPE_STRING, pRecordStruct->TypeLength ) )
-  {
-    pRecordStruct->NDEF_Type = TEXT_TYPE;
-  }
-  else
-    pRecordStruct->NDEF_Type = UNKNOWN_TYPE;
-}
-
-/**
-  * @brief  This function parse the Media type record.
-  * @param  pRecordStruct : pointer on the record structure to fill.
-  */
-void NDEF::NDEF_ParseMediaType( sRecordInfo *pRecordStruct )
-{
-  if( !memcmp( &(pRecordStruct->Type), VCARD_TYPE_STRING, pRecordStruct->TypeLength ) )
-    pRecordStruct->NDEF_Type = VCARD_TYPE;
-  else if( !memcmp( &(pRecordStruct->Type), XVCARD_TYPE_STRING, pRecordStruct->TypeLength ) )
-    pRecordStruct->NDEF_Type = VCARD_TYPE;
-  else if( !memcmp( &(pRecordStruct->Type), XVCARD2_TYPE_STRING, pRecordStruct->TypeLength ) )
-    pRecordStruct->NDEF_Type = VCARD_TYPE;
-  else
-    pRecordStruct->NDEF_Type = UNKNOWN_TYPE;
-}
-
-/**
-  * @brief  This function parse the Forum External type record.
-  * @param  pRecordStruct : pointer on the record structure to fill.
-  */
-void NDEF::NDEF_ParseForumExternalType( sRecordInfo *pRecordStruct )
-{
-  if( !memcmp( &(pRecordStruct->Type), M24SR_DISCOVERY_APP_STRING, pRecordStruct->TypeLength ) )
-    pRecordStruct->NDEF_Type = M24SR_DISCOVERY_APP_TYPE;
-  else
-    pRecordStruct->NDEF_Type = UNKNOWN_TYPE;
-}
-
-/**
-  * @brief  This function parse the URI type record.
-  * @param  pRecordStruct : pointer on the record structure to fill.
-  */
-void NDEF::NDEF_ParseURI( sRecordInfo *pRecordStruct )
-{
-  uint8_t* pPayload;
-
-  pPayload = (uint8_t*)( pRecordStruct->PayloadBufferAdd );
-  pPayload++; /* to skip URI identifier first URI payload byte */
-
-  if( !memcmp( pPayload, SMS_TYPE_STRING, strlen(SMS_TYPE_STRING) ) )
-  {
-    pRecordStruct->NDEF_Type = URI_SMS_TYPE;
-  }
-  else if( !memcmp( pPayload, GEO_TYPE_STRING, strlen(GEO_TYPE_STRING) ) )
-  {
-    pRecordStruct->NDEF_Type = URI_GEO_TYPE;
-  }
-  else
-    pRecordStruct->NDEF_Type = UNKNOWN_TYPE;
-}
-
-/**
-  * @brief  This function parse the Smart Poster.
-  * @param  pRecordStruct : pointer on the record structure to fill.
-  */
-void NDEF::NDEF_ParseSP( sRecordInfo *pRecordStruct )
-{
-  uint8_t* pPayload;
-  uint32_t PayloadSize = 0;
-  uint32_t SPPayloadSize = 0;
-  uint32_t OffsetInSPPayload = 0;
-  uint32_t RecordPosition = 0;
-  sRecordInfo *pSPRecordStruct;
-
-  /* initialize variable with size of the payload and poiter on data */
-  PayloadSize = ((uint32_t)(pRecordStruct->PayloadLength3) << 24) | ((uint32_t)(pRecordStruct->PayloadLength2) << 16) |
-                ((uint32_t)(pRecordStruct->PayloadLength1) << 8)  | pRecordStruct->PayloadLength0;
-
-  pPayload = (uint8_t*)( pRecordStruct->PayloadBufferAdd );
-
-  pSPRecordStruct = SPRecordStructAdd[0];
-
-  /* Initailize the number of record find in the SP payload */
-  pRecordStruct->NbOfRecordInSPPayload = 0;
-
-  do
-  {
-    pSPRecordStruct = SPRecordStructAdd[RecordPosition];
-    /* identify the record in the SP payload */
-    if( NDEF_IdentifySPRecord( pSPRecordStruct, pPayload ) == NDEF_OK )
-    {
-      /* store add of structure that will contain the other record information */
-      pRecordStruct->NbOfRecordInSPPayload++;
-      pRecordStruct->SPRecordStructAdd[RecordPosition] = pSPRecordStruct;
-
-      /* After SPRecord + First Record check if we are at the end of NDEF file */
-      SPPayloadSize = ((uint32_t)(pSPRecordStruct->PayloadLength3) << 24) | ((uint32_t)(pSPRecordStruct->PayloadLength2) << 16) |
-                      ((uint32_t)(pSPRecordStruct->PayloadLength1) << 8)  | pSPRecordStruct->PayloadLength0;
-
-      OffsetInSPPayload += pSPRecordStruct->PayloadOffset + SPPayloadSize;
-      pPayload += OffsetInSPPayload;
-    }
-    else /* Recommended Action Record for example */
-    {
-      SPPayloadSize = 0;
-    }
-    RecordPosition++;
-  }
-  while( (OffsetInSPPayload < PayloadSize) && RecordPosition<SP_MAX_RECORD); /* there is another record */
-}
-
-/**
-  * @}
-  */
-
-/** @defgroup libNDEF_Public_Functions
-  * @{
-  */
-
-
-/**
-  * @brief  This function identify the NDEF message stored in tag.
-  * @param  pRecordStruct : Structure to fill with record information.
-  * @param  pNDEF : pointer on the NDEF message data.
-  * @retval NDEF_OK : record struct filled.
-  * @retval NDEF_ERROR : record struct not updated.
-  */
-uint16_t NDEF::NDEF_IdentifyNDEF( sRecordInfo *pRecordStruct, uint8_t* pNDEF )
-{
-  uint16_t status = NDEF_ERROR;
-  uint16_t SizeOfRecordHeader, TypeNbByte, PayloadLengthField, IDLengthField, IDNbByte;
-  uint32_t PayloadSize;
-
-  /* check NDEF present */
-  if( NDEF_IsNDEFPresent() != NDEF_OK )
-  {
-    return NDEF_ERROR;
-  }
-
-  /* Analyse record layout */
-  ReadData( FIRST_RECORD_OFFSET, 1, pNDEF );
-
-  /* Is ID length field present */
-  if( (*pNDEF) & IL_Mask )
-  {
-    IDLengthField = ID_LENGTH_FIELD;
-  }
-  else
-  {
-    IDLengthField = 0;
-  }
-
-  /* it's a SR */
-  if( (*pNDEF) & SR_Mask )
-  {
-    /* Analyse short record layout */
-    ReadData( FIRST_RECORD_OFFSET, 4, pNDEF );
-    TypeNbByte = pNDEF[1];
-    PayloadLengthField = 1;
-    if( IDLengthField == ID_LENGTH_FIELD )
-      IDNbByte = pNDEF[3];
-    else
-      IDNbByte = 0;
-  }
-  else
-  {
-    /* Analyse normal record layout */
-    ReadData( FIRST_RECORD_OFFSET, 7, pNDEF );
-    TypeNbByte = pNDEF[1];
-    PayloadLengthField = 4;
-    if( IDLengthField == ID_LENGTH_FIELD )
-      IDNbByte = pNDEF[6];
-    else
-      IDNbByte = 0;
-  }
-
-  SizeOfRecordHeader = RECORD_FLAG_FIELD + TYPE_LENGTH_FIELD + PayloadLengthField + IDLengthField + TypeNbByte + IDNbByte;
-
-  /* Read record header */
-  ReadData( FIRST_RECORD_OFFSET, SizeOfRecordHeader, pNDEF );
-  /* it's a SR */
-  if( pNDEF[0] & SR_Mask )
-  {
-    pRecordStruct->RecordFlags = pNDEF[0];
-    pRecordStruct->TypeLength = TypeNbByte;
-    pRecordStruct->PayloadLength3 = 0;
-    pRecordStruct->PayloadLength2 = 0;
-    pRecordStruct->PayloadLength1 = 0;
-    pRecordStruct->PayloadLength0 = pNDEF[2];
-    pRecordStruct->IDLength = IDNbByte;
-    memcpy( pRecordStruct->Type, &pNDEF[3+IDNbByte], TypeNbByte );
-    memcpy( pRecordStruct->ID, &pNDEF[3+IDNbByte+TypeNbByte], IDNbByte );
-    pRecordStruct->PayloadOffset = SizeOfRecordHeader;
-  }
-  else
-  {
-    pRecordStruct->RecordFlags = pNDEF[0];
-    pRecordStruct->TypeLength = TypeNbByte;
-    pRecordStruct->PayloadLength3 = pNDEF[2];
-    pRecordStruct->PayloadLength2 = pNDEF[3];
-    pRecordStruct->PayloadLength1 = pNDEF[4];
-    pRecordStruct->PayloadLength0 = pNDEF[5];
-    pRecordStruct->IDLength = IDNbByte;
-    memcpy( pRecordStruct->Type, &pNDEF[6+IDNbByte], TypeNbByte );
-    memcpy( pRecordStruct->ID, &pNDEF[6+IDNbByte+TypeNbByte], IDNbByte );
-    pRecordStruct->PayloadOffset = SizeOfRecordHeader;
-  }
-
-  PayloadSize = ((uint32_t)(pRecordStruct->PayloadLength3) << 24) | ((uint32_t)(pRecordStruct->PayloadLength2) << 16) |
-                ((uint32_t)(pRecordStruct->PayloadLength1) << 8)  | pRecordStruct->PayloadLength0;
-
-  /* read Payload */
-  status = ReadData( (uint16_t)((FIRST_RECORD_OFFSET) + pRecordStruct->PayloadOffset) , PayloadSize , pNDEF );
-
-  if( status != NDEF_OK )
-    return NDEF_ERROR;
-  else
-    pRecordStruct->PayloadBufferAdd = (uint32_t)(pNDEF);
-
-  NDEF_ParseRecordHeader( pRecordStruct );
-
-  return NDEF_OK;
-}
-
-/**
-  * @brief  This function read the NDEF content of the TAG.
-  * @param  pNDEF : pointer on the buffer to store NDEF data.
-  * @retval NDEF_OK : NDEF file data retrieve and store in the buffer.
-  * @retval NDEF_ERROR : not able to read NDEF from tag.
-  * @retval NDEF_ERROR_MEMORY_INTERNAL : Cannot read tag.
-  * @retval NDEF_ERROR_NOT_FORMATED : CCFile data not supported or not present.
-  * @retval NDEF_ERROR_MEMORY_TAG : Size not compatible with memory.
-  * @retval NDEF_ERROR_LOCKED : Tag locked, cannot be read.
-  */
-uint16_t NDEF::NDEF_ReadNDEF( uint8_t* pNDEF )
-{
-  uint16_t status = NDEF_ERROR;
-  uint16_t NDEF_Size = 0;
-
-  status = ReadData( 0, 2, pNDEF );
-
-  if( status == NDEF_OK )
-  {
-    NDEF_Size = (uint16_t)(*pNDEF << 8);
-    NDEF_Size = NDEF_Size | (uint16_t)(*++pNDEF );
-
-    status = ReadData( 0, NDEF_Size + 2, --pNDEF );
-  }
-
-  return status;
-}
-
-/**
-  * @brief  This function write the NDEF in the TAG.
-  * @param  pNDEF : pointer on the buffer containing the NDEF data.
-  * @retval NDEF_OK : NDEF file data written in the tag.
-  * @retval NDEF_ERROR : not able to store NDEF in tag.
-  * @retval NDEF_ERROR_MEMORY_INTERNAL : Cannot write to tag.
-  * @retval NDEF_ERROR_NOT_FORMATED : CCFile data not supported or not present.
-  * @retval NDEF_ERROR_MEMORY_TAG : Size not compatible with memory.
-  * @retval NDEF_ERROR_LOCKED : Tag locked, cannot be write.
-  */
-uint16_t NDEF::NDEF_WriteNDEF( uint8_t *pNDEF )
-{
-  uint16_t status = NDEF_ERROR;
-  uint16_t NDEF_Size = 0;
-
-  NDEF_Size = (uint16_t)(*pNDEF << 8);
-  NDEF_Size = NDEF_Size | (uint16_t)(*++pNDEF );
-
-  status = WriteData( 0, NDEF_Size + 2, --pNDEF );
-
-  return status;
-}
-
-/**
-  * @brief  This function identify the NDEF message stored in tag.
-  * @param  pRecordStruct : Structure to fill with record information.
-  * @param  pNDEF : pointer on the NDEF message data.
-  * @retval NDEF_OK : record struct filled.
-  * @retval NDEF_ERROR : record struct not updated.
-  */
-uint16_t NDEF::NDEF_IdentifyBuffer( sRecordInfo *pRecordStruct, uint8_t* pNDEF )
-{
-  uint16_t SizeOfRecordHeader, TypeNbByte, PayloadLengthField, IDLengthField, IDNbByte;
-
-  /* Is ID length field present */
-  if( (*pNDEF) & IL_Mask )
-  {
-    IDLengthField = ID_LENGTH_FIELD;
-  }
-  else
-  {
-    IDLengthField = 0;
-  }
-
-  /* it's a SR */
-  if( (*pNDEF) & SR_Mask )
-  {
-    /* Analyse short record layout */
-    TypeNbByte = pNDEF[1];
-    PayloadLengthField = 1;
-    if( IDLengthField == ID_LENGTH_FIELD )
-      IDNbByte = pNDEF[3];
-    else
-      IDNbByte = 0;
-  }
-  else
-  {
-    /* Analyse normal record layout */
-    TypeNbByte = pNDEF[1];
-    PayloadLengthField = 4;
-    if( IDLengthField == ID_LENGTH_FIELD )
-      IDNbByte = pNDEF[6];
-    else
-      IDNbByte = 0;
-  }
-
-  SizeOfRecordHeader = RECORD_FLAG_FIELD + TYPE_LENGTH_FIELD + PayloadLengthField + IDLengthField + TypeNbByte + IDNbByte;
-
-  /* it's a SR */
-  if( pNDEF[0] & SR_Mask )
-  {
-    pRecordStruct->RecordFlags = pNDEF[0];
-    pRecordStruct->TypeLength = TypeNbByte;
-    pRecordStruct->PayloadLength3 = 0;
-    pRecordStruct->PayloadLength2 = 0;
-    pRecordStruct->PayloadLength1 = 0;
-    pRecordStruct->PayloadLength0 = pNDEF[2];
-    pRecordStruct->IDLength = IDNbByte;
-    memcpy( pRecordStruct->Type, &pNDEF[3+IDNbByte], TypeNbByte );
-    memcpy( pRecordStruct->ID, &pNDEF[3+IDNbByte+TypeNbByte], IDNbByte );
-    pRecordStruct->PayloadOffset = SizeOfRecordHeader;
-  }
-  else
-  {
-    pRecordStruct->RecordFlags = pNDEF[0];
-    pRecordStruct->TypeLength = TypeNbByte;
-    pRecordStruct->PayloadLength3 = pNDEF[2];
-    pRecordStruct->PayloadLength2 = pNDEF[3];
-    pRecordStruct->PayloadLength1 = pNDEF[4];
-    pRecordStruct->PayloadLength0 = pNDEF[5];
-    pRecordStruct->IDLength = IDNbByte;
-    memcpy( pRecordStruct->Type, &pNDEF[6+IDNbByte], TypeNbByte );
-    memcpy( pRecordStruct->ID, &pNDEF[6+IDNbByte+TypeNbByte], IDNbByte );
-    pRecordStruct->PayloadOffset = SizeOfRecordHeader;
-  }
-
-  pRecordStruct->PayloadBufferAdd = (uint32_t)(&pNDEF[pRecordStruct->PayloadOffset]);
-
-  NDEF_ParseRecordHeader( pRecordStruct );
-
-  return NDEF_OK;
-}
-    
-/**
-  * @}
-  */
-
-/**
-  * @}
-  */
-
-/**
-  * @}
-  */
-
-/******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
--- a/Lib_NDEF/lib_NDEF.h	Wed Jul 27 09:25:33 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,297 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    lib_NDEF.h
-  * @author  MMY Application Team
-  * @version $Revision: 1329 $
-  * @date    $Date: 2015-11-05 10:34:25 +0100 (Thu, 05 Nov 2015) $
-  * @brief   This file help to manage NDEF file.
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
-  *
-  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
-  * You may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at:
-  *
-  *        http://www.st.com/myliberty  
-  *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *
-  ******************************************************************************
-  */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __LIB_NDEF_H
-#define __LIB_NDEF_H
-
-
-/* Includes ------------------------------------------------------------------*/
-/* include file which match the HW configuration */
-//#include "common.h"
-//#include "lib_wrapper.h"
-#include <stdint.h>
-#include "tagtype5_wrapper.h"
-
-#define NDEF_ACTION_COMPLETED       0x9000
-
-#ifndef errorchk
-#define errorchk(fCall) if (status = (fCall), status != NDEF_ACTION_COMPLETED) \
-  {goto Error;} else
-#endif
-
-/* Error codes for Higher level */
-    
-    
-#define NFCTAG_4M_SIZE            0x200
-#define NFCTAG_16M_SIZE           0x800
-#define NFCTAG_64M_SIZE           0x2000
-#ifndef MIN
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#endif
-
-/* Exported constants --------------------------------------------------------*/
-#define MAX_NDEF_MEM                 0x200
-#define M24LR_MAX_SIZE               NFCTAG_4M_SIZE
-#define M24LR_NDEF_MAX_SIZE          MIN(M24LR_MAX_SIZE,MAX_NDEF_MEM)
-#define NFC_DEVICE_MAX_NDEFMEMORY    M24LR_NDEF_MAX_SIZE
-    
-#define NDEF_OK                     0x00
-#define NDEF_ERROR                  1
-#define NDEF_ERROR_MEMORY_TAG       2
-#define NDEF_ERROR_MEMORY_INTERNAL  3
-#define NDEF_ERROR_LOCKED           4
-#define NDEF_ERROR_NOT_FORMATED     5
-
-#define NDEF_MAX_SIZE               NFC_DEVICE_MAX_NDEFMEMORY
-
-#define NDEF_SIZE_OFFSET            0
-#define FIRST_RECORD_OFFSET         2
-
-#define RECORD_FLAG_FIELD           1
-#define TYPE_LENGTH_FIELD           1
-#define ID_LENGTH_FIELD             1
-
-
-#define MB_Mask                     ((uint8_t)(0x80))
-#define ME_Mask                     ((uint8_t)(0x40))
-#define CF_Mask                     ((uint8_t)(0x20))
-#define SR_Mask                     ((uint8_t)(0x10))
-#define IL_Mask                     ((uint8_t)(0x08))
-#define TNF_Mask                    ((uint8_t)(0x07))
-
-#define TNF_Empty                   0x00
-#define TNF_WellKnown               0x01
-#define TNF_MediaType               0x02
-#define TNF_AbsoluteURI             0x03
-#define TNF_NFCForumExternal        0x04
-#define TNF_Unknown                 0x05
-#define TNF_Unchanged               0x06
-#define TNF_Reserved                0x07
-
-#define SP_MAX_RECORD               4
-
-#define AAR_TYPE_STRING                         "android.com:pkg"
-#define AAR_TYPE_STRING_LENGTH                  15
-
-#define M24SR_DISCOVERY_APP_STRING              "st.com:m24sr_discovery_democtrl"
-#define M24SR_DISCOVERY_APP_STRING_LENGTH       31
-
-#define VCARD_TYPE_STRING                       "text/vcard"
-#define VCARD_TYPE_STRING_LENGTH                10
-
-#define XVCARD_TYPE_STRING                      "text/x-vCard"
-#define XVCARD_TYPE_STRING_LENGTH               12
-
-#define XVCARD2_TYPE_STRING                     "text/x-vcard"
-#define XVCARD2_TYPE_STRING_LENGTH              12
-
-#define SMART_POSTER_TYPE_STRING                "Sp"
-#define SMART_POSTER_TYPE_STRING_LENGTH         2
-     
-#define URI_TYPE_STRING                         "U"
-#define URI_TYPE_STRING_LENGTH                  1
-     
-#define SMS_TYPE_STRING                         "sms:"
-#define SMS_TYPE_STRING_LENGTH                  4
-
-#define GEO_TYPE_STRING                         "geo:"
-#define GEO_TYPE_STRING_LENGTH                  4
-
-#define URI_LATITUDE_END                        ","
-#define URI_LATITUDE_END_LENGTH                 1
-
-#define EMAIL_TYPE_STRING                       "mailto:"
-#define EMAIL_TYPE_STRING_LENGTH                7
-
-#define URI_FIRST_DATA_END                      "?"
-#define URI_FIRST_DATA_END_LENGTH               1
-
-#define SUBJECT_BEGIN_STRING                    "subject="
-#define SUBJECT_BEGIN_STRING_LENGTH             8
-
-#define MESSAGE_BEGIN_STRING                    "body="
-#define MESSAGE_BEGIN_STRING_LENGTH             5
-
-#define URI_SECOND_DATA_END                     "&"
-#define URI_SECOND_DATA_END_LENGTH              1
-
-#define TEXT_TYPE_STRING                        "T"
-#define TEXT_TYPE_STRING_LENGTH                 1
-
-#define ISO_ENGLISH_CODE_STRING                 "en"
-#define ISO_ENGLISH_CODE_STRING_LENGTH          2
-
-
-#define URI_ID_0x00                 0x00
-#define URI_ID_0x01                 0x01
-#define URI_ID_0x02                 0x02
-#define URI_ID_0x03                 0x03
-#define URI_ID_0x04                 0x04
-#define URI_ID_0x05                 0x05
-#define URI_ID_0x06                 0x06
-#define URI_ID_0x07                 0x07
-#define URI_ID_0x08                 0x08
-#define URI_ID_0x09                 0x09
-#define URI_ID_0x0A                 0x0A
-#define URI_ID_0x0B                 0x0B
-#define URI_ID_0x0C                 0x0C
-#define URI_ID_0x0D                 0x0D
-#define URI_ID_0x0E                 0x0E
-#define URI_ID_0x0F                 0x0F
-#define URI_ID_0x10                 0x10
-#define URI_ID_0x11                 0x11
-#define URI_ID_0x12                 0x12
-#define URI_ID_0x13                 0x13
-#define URI_ID_0x14                 0x14
-#define URI_ID_0x15                 0x15
-#define URI_ID_0x16                 0x16
-#define URI_ID_0x17                 0x17
-#define URI_ID_0x18                 0x18
-#define URI_ID_0x19                 0x19
-#define URI_ID_0x1A                 0x1A
-#define URI_ID_0x1B                 0x1B
-#define URI_ID_0x1C                 0x1C
-#define URI_ID_0x1D                 0x1D
-#define URI_ID_0x1E                 0x1E
-#define URI_ID_0x1F                 0x1F
-#define URI_ID_0x20                 0x20
-#define URI_ID_0x21                 0x21
-#define URI_ID_0x22                 0x22
-#define URI_ID_0x23                 0x23
-#define URI_RFU                     0x24
-
-#define URI_ID_0x01_STRING          "http://www.\0"
-#define URI_ID_0x02_STRING          "https://www.\0"
-#define URI_ID_0x03_STRING          "http://\0"
-#define URI_ID_0x04_STRING          "https://\0"
-#define URI_ID_0x05_STRING          "tel:\0"
-#define URI_ID_0x06_STRING          "mailto:\0"
-#define URI_ID_0x07_STRING          "ftp://anonymous:anonymous@\0"
-#define URI_ID_0x08_STRING          "ftp://ftp.\0"
-#define URI_ID_0x09_STRING          "ftps://\0"
-#define URI_ID_0x0A_STRING          "sftp://\0"
-#define URI_ID_0x0B_STRING          "smb://\0"
-#define URI_ID_0x0C_STRING          "nfs://\0"
-#define URI_ID_0x0D_STRING          "ftp://\0"
-#define URI_ID_0x0E_STRING          "dav://\0"
-#define URI_ID_0x0F_STRING          "news:\0"
-#define URI_ID_0x10_STRING          "telnet://\0"
-#define URI_ID_0x11_STRING          "imap:\0"
-#define URI_ID_0x12_STRING          "rtsp://\0"
-#define URI_ID_0x13_STRING          "urn:\0"
-#define URI_ID_0x14_STRING          "pop:\0"
-#define URI_ID_0x15_STRING          "sip:\0"
-#define URI_ID_0x16_STRING          "sips:\0"
-#define URI_ID_0x17_STRING          "tftp:\0"
-#define URI_ID_0x18_STRING          "btspp://\0"
-#define URI_ID_0x19_STRING          "btl2cap://\0"
-#define URI_ID_0x1A_STRING          "btgoep://\0"
-#define URI_ID_0x1B_STRING          "tcpobex://\0"
-#define URI_ID_0x1C_STRING          "irdaobex://\0"
-#define URI_ID_0x1D_STRING          "file://\0"
-#define URI_ID_0x1E_STRING          "urn:epc:id:\0"
-#define URI_ID_0x1F_STRING          "urn:epc:tag\0"
-#define URI_ID_0x20_STRING          "urn:epc:pat:\0"
-#define URI_ID_0x21_STRING          "urn:epc:raw:\0"
-#define URI_ID_0x22_STRING          "urn:epc:\0"
-#define URI_ID_0x23_STRING          "urn:nfc:\0"
-
-typedef enum
-{
-  UNKNOWN_TYPE = 0,
-  VCARD_TYPE,
-  WELL_KNOWN_ABRIDGED_URI_TYPE,
-  URI_SMS_TYPE,
-  URI_GEO_TYPE,
-  URI_EMAIL_TYPE,
-  SMARTPOSTER_TYPE,
-  URL_TYPE,
-  TEXT_TYPE,
-  BT_TYPE,
-  /* list of "external type" known by this demo, other external type will be addressed as UNKNWON_TYPE */
-  M24SR_DISCOVERY_APP_TYPE
-} NDEF_TypeDef;
-
-//typedef struct sRecordInfo sRecordInfo;
-typedef struct sRecordInfo
-{
-  uint8_t RecordFlags;
-  uint8_t TypeLength;
-  uint8_t PayloadLength3;
-  uint8_t PayloadLength2;
-  uint8_t PayloadLength1;
-  uint8_t PayloadLength0;
- uint8_t IDLength;
-  uint8_t Type[0xFF];
-  uint8_t ID[0xFF];
-  uint16_t PayloadOffset;
-  uint32_t PayloadBufferAdd;    /* add where payload content has been stored */
- NDEF_TypeDef NDEF_Type;  /* to store identification ID for application */
-  sRecordInfo *SPRecordStructAdd[SP_MAX_RECORD]; /*in case of smart poster array to store add of other sRecordInfo struct */
-  uint8_t NbOfRecordInSPPayload;
-}sRecordInfo;
-
-class NDEF : public NFCType5 {
-public:
-  
-uint16_t NDEF_IsNDEFPresent( void );
- uint16_t NDEF_ParseRecordHeader( sRecordInfo *pRecordStruct );
- void NDEF_ParseWellKnownType( sRecordInfo *pRecordStruct );
-void NDEF_ParseMediaType( sRecordInfo *pRecordStruct );
-void NDEF_ParseForumExternalType( sRecordInfo *pRecordStruct );
- void NDEF_ParseURI( sRecordInfo *pRecordStruct );
-void NDEF_ParseSP( sRecordInfo *pRecordStruct );
-uint16_t NDEF_IdentifySPRecord( sRecordInfo *pRecordStruct, uint8_t* pPayload );
-uint16_t NDEF_IdentifyNDEF( sRecordInfo *pRecordStruct, uint8_t* pNDEF );
-uint16_t NDEF_ReadNDEF( uint8_t* pNDEF );
-uint16_t NDEF_WriteNDEF( uint8_t *pNDEF );
-uint16_t NDEF_IdentifyBuffer( sRecordInfo *pRecordStruct, uint8_t* pNDEF );
-
-void NDEF_initialize(void);
-uint8_t NDEF_Buffer [NDEF_MAX_SIZE];
-
-NDEF()
-{
-   SPRecordStructAdd[0] = &SPRecordStruct1;
-    SPRecordStructAdd[1] = &SPRecordStruct2;
-    SPRecordStructAdd[2] = &SPRecordStruct3;
-    SPRecordStructAdd[3] = &SPRecordStruct4;
-    
-}
-
-/* In case of smart Poster composed with different record, 3 records supported so far */
-sRecordInfo SPRecordStruct1, SPRecordStruct2, SPRecordStruct3, SPRecordStruct4;
-sRecordInfo *SPRecordStructAdd[SP_MAX_RECORD];
-};
-
-#endif /* __LIB_NDEF_H */
-
-
-/******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
--- a/Lib_NDEF/lib_NDEF_URI.cpp	Wed Jul 27 09:25:33 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,550 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    lib_NDEF_URI.c
-  * @author  MMY Application Team
-  * @version $Revision: 1583 $
-  * @date    $Date: 2016-02-03 15:06:51 +0100 (Wed, 03 Feb 2016) $
-  * @brief   This file help to manage NDEF file that represent URI.
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
-  *
-  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
-  * You may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at:
-  *
-  *        http://www.st.com/myliberty  
-  *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *
-  ******************************************************************************
-  */
-/* Includes ------------------------------------------------------------------*/
-#include "lib_NDEF_URI.h"
-#include <string.h>
-
-/** @addtogroup NFC_libraries
-  * @{
-  * @brief  <b>This is the library used to manage the content of the TAG (data)
-  *          But also the specific feature of the tag, for instance
-  *          password, gpo... </b>
-  */
-
-
-/** @addtogroup libNFC_FORUM
-  * @{
-  * @brief  This part of the library manage data which follow NFC forum organisation.
-  */
-
-/**
-  * @brief  This buffer contains the data send/received by TAG
-  */
-extern uint8_t NDEF_Buffer [];
-
-
-
-/**
-  * @brief  This function read the URI information and store data in a structure.
-  * @param  pRecordStruct : Pointer on the record structure.
-  * @param  pURI : pointer on the structure to fill.
-  */
-void NDEF_URI::NDEF_Parse_WellKnowType( sRecordInfo *pRecordStruct, sURI_Info* pURI )
-{
-  uint32_t PayloadSize;
-  uint8_t Offset;
-  uint8_t* pPayload;
-
-  pPayload = (uint8_t*)(pRecordStruct->PayloadBufferAdd);
-
-  switch( *pPayload )
-  {
-    case URI_ID_0x01:
-      memcpy( pURI->protocol, URI_ID_0x01_STRING, strlen(URI_ID_0x01_STRING) );
-      Offset = strlen( URI_ID_0x01_STRING );
-      break;
-
-    case URI_ID_0x02:
-      memcpy( pURI->protocol, URI_ID_0x02_STRING, strlen(URI_ID_0x02_STRING) );
-      Offset = strlen( URI_ID_0x02_STRING );
-      break;
-
-    case URI_ID_0x03:
-      memcpy( pURI->protocol, URI_ID_0x03_STRING, strlen(URI_ID_0x03_STRING) );
-      Offset = strlen( URI_ID_0x03_STRING );
-      break;
-
-    case URI_ID_0x04:
-      memcpy( pURI->protocol, URI_ID_0x04_STRING, strlen(URI_ID_0x04_STRING) );
-      Offset = strlen( URI_ID_0x04_STRING );
-      break;
-
-    case URI_ID_0x05:
-      memcpy( pURI->protocol, URI_ID_0x05_STRING, strlen(URI_ID_0x05_STRING) );
-      Offset = strlen( URI_ID_0x05_STRING );
-      break;
-
-    case URI_ID_0x06:
-      memcpy( pURI->protocol, URI_ID_0x06_STRING, strlen(URI_ID_0x06_STRING) );
-      Offset = strlen( URI_ID_0x06_STRING );
-      break;
-
-    case URI_ID_0x07:
-      memcpy( pURI->protocol, URI_ID_0x07_STRING, strlen(URI_ID_0x07_STRING) );
-      Offset = strlen( URI_ID_0x07_STRING );
-      break;
-
-    case URI_ID_0x08:
-      memcpy( pURI->protocol, URI_ID_0x08_STRING, strlen(URI_ID_0x08_STRING) );
-      Offset = strlen( URI_ID_0x08_STRING );
-      break;
-
-    case URI_ID_0x09:
-      memcpy( pURI->protocol, URI_ID_0x09_STRING, strlen(URI_ID_0x09_STRING) );
-      Offset = strlen( URI_ID_0x09_STRING );
-      break;
-
-    case URI_ID_0x0A:
-      memcpy( pURI->protocol, URI_ID_0x0A_STRING, strlen(URI_ID_0x0A_STRING) );
-      Offset = strlen( URI_ID_0x0A_STRING );
-      break;
-
-    case URI_ID_0x0B:
-      memcpy( pURI->protocol, URI_ID_0x0B_STRING, strlen(URI_ID_0x0B_STRING) );
-      Offset = strlen( URI_ID_0x0B_STRING );
-      break;
-
-    case URI_ID_0x0C:
-      memcpy( pURI->protocol, URI_ID_0x0C_STRING, strlen(URI_ID_0x0C_STRING) );
-      Offset = strlen( URI_ID_0x0C_STRING );
-      break;
-
-    case URI_ID_0x0D:
-      memcpy( pURI->protocol, URI_ID_0x0D_STRING, strlen(URI_ID_0x0D_STRING) );
-      Offset = strlen( URI_ID_0x0D_STRING );
-      break;
-
-    case URI_ID_0x0E:
-      memcpy( pURI->protocol, URI_ID_0x0E_STRING, strlen(URI_ID_0x0E_STRING) );
-      Offset = strlen( URI_ID_0x0E_STRING );
-      break;
-
-    case URI_ID_0x0F:
-      memcpy( pURI->protocol, URI_ID_0x0F_STRING, strlen(URI_ID_0x0F_STRING) );
-      Offset = strlen( URI_ID_0x0F_STRING );
-      break;
-
-    case URI_ID_0x10:
-      memcpy( pURI->protocol, URI_ID_0x10_STRING, strlen(URI_ID_0x10_STRING) );
-      Offset = strlen( URI_ID_0x10_STRING );
-      break;
-
-    case URI_ID_0x11:
-      memcpy( pURI->protocol, URI_ID_0x11_STRING, strlen(URI_ID_0x11_STRING) );
-      Offset = strlen( URI_ID_0x11_STRING );
-      break;
-
-    case URI_ID_0x12:
-      memcpy( pURI->protocol, URI_ID_0x12_STRING, strlen(URI_ID_0x12_STRING) );
-      Offset = strlen( URI_ID_0x12_STRING );
-      break;
-
-    case URI_ID_0x13:
-      memcpy( pURI->protocol, URI_ID_0x13_STRING, strlen(URI_ID_0x13_STRING) );
-      Offset = strlen( URI_ID_0x13_STRING );
-      break;
-
-    case URI_ID_0x14:
-      memcpy( pURI->protocol, URI_ID_0x14_STRING, strlen(URI_ID_0x14_STRING) );
-      Offset = strlen( URI_ID_0x14_STRING );
-      break;
-
-    case URI_ID_0x15:
-      memcpy( pURI->protocol, URI_ID_0x15_STRING, strlen(URI_ID_0x15_STRING) );
-      Offset = strlen( URI_ID_0x15_STRING );
-      break;
-
-    case URI_ID_0x16:
-      memcpy( pURI->protocol, URI_ID_0x16_STRING, strlen(URI_ID_0x16_STRING) );
-      Offset = strlen( URI_ID_0x16_STRING );
-      break;
-
-    case URI_ID_0x17:
-      memcpy( pURI->protocol, URI_ID_0x17_STRING, strlen(URI_ID_0x17_STRING) );
-      Offset = strlen( URI_ID_0x17_STRING );
-      break;
-
-    case URI_ID_0x18:
-      memcpy( pURI->protocol, URI_ID_0x18_STRING, strlen(URI_ID_0x18_STRING) );
-      Offset = strlen( URI_ID_0x18_STRING );
-      break;
-
-    case URI_ID_0x19:
-      memcpy( pURI->protocol, URI_ID_0x19_STRING, strlen(URI_ID_0x19_STRING) );
-      Offset = strlen( URI_ID_0x19_STRING );
-      break;
-
-    case URI_ID_0x1A:
-      memcpy( pURI->protocol, URI_ID_0x1A_STRING, strlen(URI_ID_0x1A_STRING) );
-      Offset = strlen( URI_ID_0x1A_STRING );
-      break;
-
-    case URI_ID_0x1B:
-      memcpy( pURI->protocol, URI_ID_0x1B_STRING, strlen(URI_ID_0x1B_STRING) );
-      Offset = strlen( URI_ID_0x1B_STRING );
-      break;
-
-    case URI_ID_0x1C:
-      memcpy( pURI->protocol, URI_ID_0x1C_STRING, strlen(URI_ID_0x1C_STRING) );
-      Offset = strlen( URI_ID_0x1C_STRING );
-      break;
-
-    case URI_ID_0x1D:
-      memcpy( pURI->protocol, URI_ID_0x1D_STRING, strlen(URI_ID_0x1D_STRING) );
-      Offset = strlen( URI_ID_0x1D_STRING );
-      break;
-
-    case URI_ID_0x1E:
-      memcpy( pURI->protocol, URI_ID_0x1E_STRING, strlen(URI_ID_0x1E_STRING) );
-      Offset = strlen( URI_ID_0x1E_STRING );
-      break;
-
-    case URI_ID_0x1F:
-      memcpy( pURI->protocol, URI_ID_0x1F_STRING, strlen(URI_ID_0x1F_STRING) );
-      Offset = strlen( URI_ID_0x1F_STRING );
-      break;
-
-    case URI_ID_0x20:
-      memcpy( pURI->protocol, URI_ID_0x20_STRING, strlen(URI_ID_0x20_STRING) );
-      Offset = strlen( URI_ID_0x20_STRING );
-      break;
-
-    case URI_ID_0x21:
-      memcpy( pURI->protocol, URI_ID_0x21_STRING, strlen(URI_ID_0x21_STRING) );
-      Offset = strlen( URI_ID_0x21_STRING );
-      break;
-
-    case URI_ID_0x22:
-      memcpy( pURI->protocol, URI_ID_0x22_STRING, strlen(URI_ID_0x22_STRING) );
-      Offset = strlen( URI_ID_0x22_STRING );
-      break;
-
-    case URI_ID_0x23:
-      memcpy( pURI->protocol, URI_ID_0x23_STRING, strlen(URI_ID_0x23_STRING) );
-      Offset = strlen( URI_ID_0x23_STRING );
-      break;
-
-    default:
-      Offset = 0;
-      /* Should not happened */
-      break;
-  }
-  /* add end of string character */
-  pURI->protocol[Offset] = '\0';
-
-  pPayload++; /* go after well know byte */
-
-  PayloadSize = ((uint32_t)(pRecordStruct->PayloadLength3) << 24) | ((uint32_t)(pRecordStruct->PayloadLength2) << 16) |
-                ((uint32_t)(pRecordStruct->PayloadLength1) << 8)  | pRecordStruct->PayloadLength0;
-
-  PayloadSize = PayloadSize - 1; /* remove well know byte */
-
-  memcpy( pURI->URI_Message, pPayload, PayloadSize );
-  /* add end of string character */
-  pURI->URI_Message[PayloadSize] = '\0';
-
-}
-
-/**
-  * @}
-  */
-
-/** @defgroup libURI_Public_Functions
-  * @{
-  * @brief  This file is used to manage URI (stored or loaded in tag)
-  */ 
-
-/**
-  * @brief  This function read NDEF and retrieve URI information if any.
-  * @param  pRecordStruct : Pointer on the record structure.
-  * @param  pURI : pointer on the structure to fill.
-  * @retval NDEF_OK : URI information from NDEF have been retrieved.
-  * @retval NDEF_ERROR : Not able to retrieve URI information.
-  */
-uint16_t NDEF_URI::NDEF_ReadURI( sRecordInfo *pRecordStruct, sURI_Info *pURI )
-{
-  uint16_t status = NDEF_ERROR;
-  sRecordInfo *pSPRecordStruct;
-  uint32_t PayloadSize, RecordPosition;
-  uint8_t* pData;
-
-  if( pRecordStruct->NDEF_Type == WELL_KNOWN_ABRIDGED_URI_TYPE )
-  {
-    NDEF_Parse_WellKnowType( pRecordStruct, pURI );
-    status = NDEF_OK;
-  }
-  else if( pRecordStruct->NDEF_Type == SMARTPOSTER_TYPE )
-  {
-    for( RecordPosition = 0; RecordPosition < pRecordStruct->NbOfRecordInSPPayload; RecordPosition++ )
-    {
-      pSPRecordStruct = pRecordStruct->SPRecordStructAdd[RecordPosition];
-      if( pSPRecordStruct->NDEF_Type == WELL_KNOWN_ABRIDGED_URI_TYPE )
-      {
-        NDEF_Parse_WellKnowType( pSPRecordStruct, pURI );
-        status = NDEF_OK;
-      }
-      if( pSPRecordStruct->NDEF_Type == TEXT_TYPE )
-      {
-        PayloadSize = ((uint32_t)(pSPRecordStruct->PayloadLength3) << 24) | ((uint32_t)(pSPRecordStruct->PayloadLength2) << 16) |
-                      ((uint32_t)(pSPRecordStruct->PayloadLength1) << 8)  | pSPRecordStruct->PayloadLength0;
-
-        /* The instruction content the UTF-8 language code that is not used here */
-        pData = (uint8_t*)pSPRecordStruct->PayloadBufferAdd;
-        PayloadSize -= *pData + 1; /* remove not usefull data */
-        pData += *pData + 1;
-
-        memcpy( pURI->Information, pData, PayloadSize );
-      }
-    }
-  }
-  else 
-  {
-    status = NDEF_ERROR;
-  }
-
-  return status;
-}
-
-/**
-  * @brief  This function prepare the NDEF message with the URI data given in the structure.
-  * @param  pURI : pointer on structure that contain the URI information.
-  * @param  pNDEFMessage : pointer on the NDEF message.
-  * @param  size : to store the size of the NDEF message generated.
-  */
-void NDEF_URI::NDEF_PrepareURIMessage( sURI_Info *pURI, uint8_t *pNDEFMessage, uint16_t *size )
-{
-  uint32_t uriSize, totalSize, Offset = 0;
-  uint32_t infoSize = 0;
-  char type;
-
-  /* An URI can be included in a smart poster to add text to give instruction to user for instance */
-
-  /* URI (smart poster) Record Header */
-/************************************/
-/*  7 |  6 |  5 |  4 |  3 | 2  1  0 */
-/*----------------------------------*/
-/* MB   ME   CF   SR   IL    TNF    */  /* <---- CF=0, IL=0 and SR=1 TNF=1 NFC Forum Well-known type*/
-/*----------------------------------*/
-/*          TYPE LENGTH             */
-/*----------------------------------*/
-/*        PAYLOAD LENGTH 3          */  /* <---- Used only if SR=0 */
-/*----------------------------------*/
-/*        PAYLOAD LENGTH 2          */  /* <---- Used only if SR=0 */
-/*----------------------------------*/
-/*        PAYLOAD LENGTH 1          */  /* <---- Used only if SR=0 */
-/*----------------------------------*/
-/*        PAYLOAD LENGTH 0          */
-/*----------------------------------*/
-/*          ID LENGTH               */  /* <---- Not Used  */
-/*----------------------------------*/
-/*              TYPE                */
-/*----------------------------------*/
-/*               ID                 */  /* <---- Not Used  */
-/************************************/
-
-  /* We need to know the URI type in order to define if an abreviation is available */
-  type = getUriType( pURI->protocol );
-
-  /* URI : 1+URI for abreviate protocol*/
-  if( type != URI_ID_0x00 )
-    uriSize = 1 + strlen(pURI->URI_Message);
-  else /*: 1+protocol+URI else*/
-    uriSize = 1 + strlen(pURI->protocol) + strlen(pURI->URI_Message);
-
-  /* Check if a Smart poster is needed */
-  if( pURI->Information[0] != '\0' )
-  {
-    /* Info : 1+2+info */
-    infoSize = 1 + ISO_ENGLISH_CODE_STRING_LENGTH + strlen(pURI->Information);
-    /* Total */
-    totalSize = 4 + uriSize + 4 + infoSize;
-    if( uriSize > 255 ) totalSize += 3;   /* Normal URI size */
-    if( infoSize > 255 ) totalSize += 3;  /* Normal Info size */
-
-    /* SmartPoster header */
-    if( totalSize > 255 )
-    {
-      pNDEFMessage[Offset++] = 0xC1;
-      pNDEFMessage[Offset++] = SMART_POSTER_TYPE_STRING_LENGTH;
-      pNDEFMessage[Offset++] = (totalSize & 0xFF000000) >> 24;
-      pNDEFMessage[Offset++] = (totalSize & 0x00FF0000) >> 16;
-      pNDEFMessage[Offset++] = (totalSize & 0x0000FF00) >> 8;
-      pNDEFMessage[Offset++] = totalSize & 0x000000FF;
-    }
-    else
-    {
-      pNDEFMessage[Offset++] = 0xD1;
-      pNDEFMessage[Offset++] = SMART_POSTER_TYPE_STRING_LENGTH;
-      pNDEFMessage[Offset++] = (uint8_t)totalSize;
-    }
-    memcpy( &pNDEFMessage[Offset], SMART_POSTER_TYPE_STRING, SMART_POSTER_TYPE_STRING_LENGTH );
-    Offset += SMART_POSTER_TYPE_STRING_LENGTH;
-  }
-
-  /* URI header */
-  pNDEFMessage[Offset] = 0x81;
-  if( uriSize < 256 ) pNDEFMessage[Offset] |= 0x10;                      // Set the SR bit
-  if( pURI->Information[0] == '\0' ) pNDEFMessage[Offset] |= 0x40;       // Set the ME bit
-  Offset++;
-
-  pNDEFMessage[Offset++] = URI_TYPE_STRING_LENGTH;
-  if( uriSize > 255 )
-  {
-    pNDEFMessage[Offset++] = (uriSize & 0xFF000000) >> 24;
-    pNDEFMessage[Offset++] = (uriSize & 0x00FF0000) >> 16;
-    pNDEFMessage[Offset++] = (uriSize & 0x0000FF00) >> 8;
-    pNDEFMessage[Offset++] = uriSize & 0x000000FF;
-  }
-  else
-  {
-    pNDEFMessage[Offset++] = (uint8_t)uriSize;
-  }
-  memcpy( &pNDEFMessage[Offset], URI_TYPE_STRING, URI_TYPE_STRING_LENGTH );
-  Offset += URI_TYPE_STRING_LENGTH;
-
-  pNDEFMessage[Offset++] = type;
-  if( type == URI_ID_0x00 ) // No abreviation
-  {
-    memcpy( &pNDEFMessage[Offset], pURI->protocol, strlen(pURI->protocol) );
-    Offset += strlen(pURI->protocol);
-  }
-
-  memcpy( &pNDEFMessage[Offset], pURI->URI_Message, strlen(pURI->URI_Message) );
-  Offset += strlen(pURI->URI_Message);
-
-  /* Information header */
-  if( pURI->Information[0] != '\0' )
-  {
-    if( infoSize > 255 )
-    {
-      pNDEFMessage[Offset++] = 0x41;
-      pNDEFMessage[Offset++] = TEXT_TYPE_STRING_LENGTH;
-      pNDEFMessage[Offset++] = (infoSize & 0xFF000000) >> 24;
-      pNDEFMessage[Offset++] = (infoSize & 0x00FF0000) >> 16;
-      pNDEFMessage[Offset++] = (infoSize & 0x0000FF00) >> 8;
-      pNDEFMessage[Offset++] = infoSize & 0x000000FF;
-    }
-    else
-    {
-      pNDEFMessage[Offset++] = 0x51;
-      pNDEFMessage[Offset++] = TEXT_TYPE_STRING_LENGTH;
-      pNDEFMessage[Offset++] = (uint8_t)infoSize;
-    }
-
-    memcpy( &pNDEFMessage[Offset], TEXT_TYPE_STRING, TEXT_TYPE_STRING_LENGTH );
-    Offset+=TEXT_TYPE_STRING_LENGTH;
-    pNDEFMessage[Offset++] = ISO_ENGLISH_CODE_STRING_LENGTH; /* UTF-8 with x byte language code */
-    memcpy( &pNDEFMessage[Offset], ISO_ENGLISH_CODE_STRING, ISO_ENGLISH_CODE_STRING_LENGTH );
-    Offset += ISO_ENGLISH_CODE_STRING_LENGTH;
-
-    /* Information payload */
-    memcpy( &pNDEFMessage[Offset], pURI->Information, strlen(pURI->Information) );
-    Offset += strlen(pURI->Information);
-  }
-
-  *size = Offset;
-
-}
-/**
-  * @brief  This function write the NDEF file with the URI data given in the structure.
-  * @param  pURI : pointer on structure that contain the URI information.
-  * @retval NDEF_OK : NDEF file data written in the tag.
-  * @retval NDEF_ERROR : not able to store NDEF in tag.
-  * @retval NDEF_ERROR_MEMORY_INTERNAL : Cannot write to tag.
-  * @retval NDEF_ERROR_NOT_FORMATED : CCFile data not supported or not present.
-  * @retval NDEF_ERROR_MEMORY_TAG : Size not compatible with memory.
-  * @retval NDEF_ERROR_LOCKED : Tag locked, cannot be write.
-  */
-uint16_t NDEF_URI::NDEF_WriteURI( sURI_Info *pURI )
-{
-  uint16_t status = NDEF_ERROR, Offset = 0;
-
-  NDEF_PrepareURIMessage( pURI, &NDEF_Buffer[FIRST_RECORD_OFFSET], &Offset );
-
-  /* Write NDEF */
-  NDEF_Buffer[0] = (Offset & 0xFF00) >> 8;
-  NDEF_Buffer[1] = Offset & 0x00FF;
-
-  status = WriteData( 0x00, Offset + FIRST_RECORD_OFFSET, NDEF_Buffer );
-
-  return status;
-}
-
-char NDEF_URI::getUriType( char *protocol )
-{
-  if( !memcmp( protocol, URI_ID_0x01_STRING, strlen(URI_ID_0x01_STRING) ) ) return URI_ID_0x01;
-  else if( !memcmp( protocol, URI_ID_0x02_STRING, strlen(URI_ID_0x02_STRING) ) ) return URI_ID_0x02;
-  else if( !memcmp( protocol, URI_ID_0x03_STRING, strlen(URI_ID_0x03_STRING) ) ) return URI_ID_0x03;
-  else if( !memcmp( protocol, URI_ID_0x04_STRING, strlen(URI_ID_0x04_STRING) ) ) return URI_ID_0x04;
-  else if( !memcmp( protocol, URI_ID_0x05_STRING, strlen(URI_ID_0x05_STRING) ) ) return URI_ID_0x05;
-  else if( !memcmp( protocol, URI_ID_0x06_STRING, strlen(URI_ID_0x06_STRING) ) ) return URI_ID_0x06;
-  else if( !memcmp( protocol, URI_ID_0x07_STRING, strlen(URI_ID_0x07_STRING) ) ) return URI_ID_0x07;
-  else if( !memcmp( protocol, URI_ID_0x08_STRING, strlen(URI_ID_0x08_STRING) ) ) return URI_ID_0x08;
-  else if( !memcmp( protocol, URI_ID_0x09_STRING, strlen(URI_ID_0x09_STRING) ) ) return URI_ID_0x09;
-  else if( !memcmp( protocol, URI_ID_0x0A_STRING, strlen(URI_ID_0x0A_STRING) ) ) return URI_ID_0x0A;
-  else if( !memcmp( protocol, URI_ID_0x0B_STRING, strlen(URI_ID_0x0B_STRING) ) ) return URI_ID_0x0B;
-  else if( !memcmp( protocol, URI_ID_0x0C_STRING, strlen(URI_ID_0x0C_STRING) ) ) return URI_ID_0x0C;
-  else if( !memcmp( protocol, URI_ID_0x0D_STRING, strlen(URI_ID_0x0D_STRING) ) ) return URI_ID_0x0D;
-  else if( !memcmp( protocol, URI_ID_0x0E_STRING, strlen(URI_ID_0x0E_STRING) ) ) return URI_ID_0x0E;
-  else if( !memcmp( protocol, URI_ID_0x0F_STRING, strlen(URI_ID_0x0F_STRING) ) ) return URI_ID_0x0F;
-  else if( !memcmp( protocol, URI_ID_0x10_STRING, strlen(URI_ID_0x10_STRING) ) ) return URI_ID_0x10;
-  else if( !memcmp( protocol, URI_ID_0x11_STRING, strlen(URI_ID_0x11_STRING) ) ) return URI_ID_0x11;
-  else if( !memcmp( protocol, URI_ID_0x12_STRING, strlen(URI_ID_0x12_STRING) ) ) return URI_ID_0x12;
-  else if( !memcmp( protocol, URI_ID_0x13_STRING, strlen(URI_ID_0x13_STRING) ) ) return URI_ID_0x13;
-  else if( !memcmp( protocol, URI_ID_0x14_STRING, strlen(URI_ID_0x14_STRING) ) ) return URI_ID_0x14;
-  else if( !memcmp( protocol, URI_ID_0x15_STRING, strlen(URI_ID_0x15_STRING) ) ) return URI_ID_0x15;
-  else if( !memcmp( protocol, URI_ID_0x16_STRING, strlen(URI_ID_0x16_STRING) ) ) return URI_ID_0x16;
-  else if( !memcmp( protocol, URI_ID_0x17_STRING, strlen(URI_ID_0x17_STRING) ) ) return URI_ID_0x17;
-  else if( !memcmp( protocol, URI_ID_0x18_STRING, strlen(URI_ID_0x18_STRING) ) ) return URI_ID_0x18;
-  else if( !memcmp( protocol, URI_ID_0x19_STRING, strlen(URI_ID_0x19_STRING) ) ) return URI_ID_0x19;
-  else if( !memcmp( protocol, URI_ID_0x1A_STRING, strlen(URI_ID_0x1A_STRING) ) ) return URI_ID_0x1A;
-  else if( !memcmp( protocol, URI_ID_0x1B_STRING, strlen(URI_ID_0x1B_STRING) ) ) return URI_ID_0x1B;
-  else if( !memcmp( protocol, URI_ID_0x1C_STRING, strlen(URI_ID_0x1C_STRING) ) ) return URI_ID_0x1C;
-  else if( !memcmp( protocol, URI_ID_0x1D_STRING, strlen(URI_ID_0x1D_STRING) ) ) return URI_ID_0x1D;
-  else if( !memcmp( protocol, URI_ID_0x1E_STRING, strlen(URI_ID_0x1E_STRING) ) ) return URI_ID_0x1E;
-  else if( !memcmp( protocol, URI_ID_0x1F_STRING, strlen(URI_ID_0x1F_STRING) ) ) return URI_ID_0x1F;
-  else if( !memcmp( protocol, URI_ID_0x20_STRING, strlen(URI_ID_0x20_STRING) ) ) return URI_ID_0x20;
-  else if( !memcmp( protocol, URI_ID_0x21_STRING, strlen(URI_ID_0x21_STRING) ) ) return URI_ID_0x21;
-  else if( !memcmp( protocol, URI_ID_0x22_STRING, strlen(URI_ID_0x22_STRING) ) ) return URI_ID_0x22;
-  else if( !memcmp( protocol, URI_ID_0x23_STRING, strlen(URI_ID_0x23_STRING) ) ) return URI_ID_0x23;
-  else return URI_ID_0x00; // No abreviation for this protocol  
-}
-
-NFCTAG_StatusTypeDef NDEF_URI::NFCTAG_ReadData( uint8_t * const pData, const uint16_t TarAddr, const uint16_t Size )
-{
-  return(mM24LRp->i2c_ReadData(pData, TarAddr, Size ));
-}
-NFCTAG_StatusTypeDef NDEF_URI::NFCTAG_WriteData( const uint8_t * const pData, const uint16_t TarAddr, const uint16_t Size )
-{
-  return(mM24LRp->i2c_WriteData( pData, TarAddr, Size ));
-}
-
-/**
-  * @}
-  */
-
-/**
-  * @}
-  */
-
-/**
-  * @}
-  */
-
-/******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
--- a/Lib_NDEF/lib_NDEF_URI.h	Wed Jul 27 09:25:33 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    lib_NDEF_URI.h
-  * @author  MMY Application Team
-  * @version $Revision: 1582 $
-  * @date    $Date: 2016-02-03 15:06:14 +0100 (Wed, 03 Feb 2016) $
-  * @brief   This file help to manage URI NDEF file.
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
-  *
-  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
-  * You may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at:
-  *
-  *        http://www.st.com/myliberty  
-  *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *
-  ******************************************************************************
-  */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __LIB_NDEF_URI_H
-#define __LIB_NDEF_URI_H
-
-
-
-/* Includes ------------------------------------------------------------------*/
-#include "lib_NDEF.h"
-#include "m24lr.h"
-typedef struct 
-{
-  char protocol[80];
-  char URI_Message[400];
-  char Information[400];
-}sURI_Info;
-
-typedef struct sRecordInfo sRecordInfo_t;
-
-class NDEF_URI : public NDEF 
-{
-public:
-uint16_t NDEF_ReadURI(sRecordInfo *pRecordStruct, sURI_Info *pURI);
-uint16_t NDEF_WriteURI(sURI_Info *pURI);
-void NDEF_Parse_WellKnowType( sRecordInfo *pRecordStruct, sURI_Info* pURI );
-
-virtual NFCTAG_StatusTypeDef NFCTAG_ReadData( uint8_t * const pData, const uint16_t TarAddr, const uint16_t Size );
-virtual NFCTAG_StatusTypeDef NFCTAG_WriteData( const uint8_t * const pData, const uint16_t TarAddr, const uint16_t Size );
-
-void NDEF_PrepareURIMessage( sURI_Info *pURI, uint8_t *pNDEFMessage, uint16_t *size );
-char getUriType( char *protocol );
-
-NFCTAG_StatusTypeDef (*ReadDataPtr)( uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte );
-NFCTAG_StatusTypeDef (*WriteDataPtr)( const uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte );
-
-void setM24LR (M24LR *m24LRr) {mM24LRp=m24LRr; }
-M24LR *mM24LRp;
-
-};
-
-
-#endif /* __LIB_NDEF_URI_H */
-
-/******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
--- a/Lib_NDEF/tagtype5_wrapper.cpp	Wed Jul 27 09:25:33 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,427 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    tagtype5_wrapper.c 
-  * @author  MMY Application Team
-  * @version $Revision: 1638 $
-  * @date    $Date: 2016-02-10 16:41:05 +0100 (Wed, 10 Feb 2016) $
-  * @brief   Interface for tagtype5 in order to use NDEF lib
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
-  *
-  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
-  * You may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at:
-  *
-  *        http://www.st.com/myliberty  
-  *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *
-  ******************************************************************************
-  */
-
-/* Includes ------------------------------------------------------------------*/
-#include "tagtype5_wrapper.h"
-#include "lib_NDEF.h"
-
-
-/**
-  * @brief  This function read the data stored in NDEF file at defined offset.
-  * @param  Offset : Offset in the NDEF file.
-  * @param  DataSize : Number of byte to read.
-  * @param  pData : pointer on buffer to store read data.
-  * @retval NDEF_ERROR_MEMORY_INTERNAL : Size not compatible with memory.
-  * @retval NDEF_ERROR_NOT_FORMATED : CCFile data not supported.
-  * @retval NDEF_ERROR : No NDEF in the tag.
-  * @retval NDEF_OK : The operation is completed.
-  */
-uint16_t NFCType5::ReadData( uint16_t Offset , uint16_t DataSize , uint8_t* pData )
-{
-  uint16_t status = NDEF_ERROR;
-  uint8_t atlv_detect[4];
-  uint8_t index = 0;
-  
-  /* Do not include length bytes */
-  DataSize -= FIRST_RECORD_OFFSET;
-  
-  /* If too many data to write return error */
-  if( DataSize > NDEF_MAX_SIZE )
-  {
-    return NDEF_ERROR_MEMORY_INTERNAL;
-  }
-  
-  /* Detect NDEF message in memory */
-  status = NfcType5_NDEFDetection( );
-  if( status != NDEF_OK )
-  {
-    return status;
-  }
-  
-  /* Read TL of Type 5 */
-  status = NFCTAG_ReadData( atlv_detect, CCFileStruct.NDEF_offset, 4 );
-  if( status != NDEF_OK )
-  {
-    return status;
-  }
-  
-  /* Check if L is on 3 or 1 byte and update length in buffer */
-  if( atlv_detect[1] == NFCT5_3_BYTES_L_TLV )
-  {
-    pData[0] = atlv_detect[2];
-    pData[1] = atlv_detect[3];
-    index += 4;
-  }
-  else
-  {
-    pData[0] = 0x00;
-    pData[1] = atlv_detect[1];
-    index += 2;
-  }
-  
-  /* Check CC file is in the correct mode to proceed */
-  if( CCFileStruct.State ==  TT5_INITIALIZED )
-  {
-    return NDEF_ERROR;
-  }
-
-  if( ((Offset == 0) && (DataSize > 0)) || (Offset > 0) )
-  {
-    /* Read NDEF */
-    if( NFCTAG_ReadData( (pData + FIRST_RECORD_OFFSET), CCFileStruct.NDEF_offset + index + Offset, DataSize ) != NFCTAG_OK )
-    {
-      return NDEF_ERROR;
-    }
-  }
-  
-  return NDEF_OK;
-}
-
-/**
-  * @brief  This function writes data in NDEF file at defined offset.
-  * @param  Offset : Offset in the NDEF file.
-  * @param  DataSize : Number of byte to write.
-  * @param  pData : pointer on buffer to copy.
-  * @retval NDEF_ERROR_MEMORY_INTERNAL : Size not compatible with memory.
-  * @retval NDEF_ERROR_NOT_FORMATED : CCFile data not supported.
-  * @retval NDEF_ERROR : No NDEF in the tag.
-  * @retval NDEF_OK : The operation is completed.
-  */
-uint16_t NFCType5::WriteData( uint16_t Offset , uint32_t DataSize , uint8_t *pData )
-{
-  uint8_t atlv[4];
-  uint8_t index = 0;
-  uint16_t NDEF_Size = 0;
-  NFCTAG_StatusTypeDef status;
-
-  /* Do not include length bytes */
-  DataSize -= FIRST_RECORD_OFFSET;
-  
-  /* If too many data to write return error */
-  if( DataSize > NDEF_MAX_SIZE )
-  {
-    return NDEF_ERROR_MEMORY_INTERNAL;
-  }
-  
-  /* Detect NDEF message in memory */
-  if( NfcType5_NDEFDetection( ) != NDEF_OK )
-  {
-    return NDEF_ERROR;
-  }
-  
-  /* Extract NDEF Size from buffer */
-  NDEF_Size = (uint16_t)(pData[0] << 8);
-  NDEF_Size = NDEF_Size | (uint16_t)(pData[1] );
-  
-  /* If entire NDEF is written, update Length of Type 5 */
-  if( DataSize == NDEF_Size )
-  {
-    /* Check if L is on 3 or 1 byte */
-    if( NDEF_Size >= NFCT5_3_BYTES_L_TLV )
-    {
-      /* First init L with 0, will be updated at the end */
-      atlv[1] = 0x00;
-      atlv[2] = 0x00;
-      atlv[3] = 0x00;
-      
-      status = NFCTAG_WriteData( (atlv + 1), (CCFileStruct.NDEF_offset + 1), 3 );
-      
-      index += 4; 
-    }
-    else
-    {
-      /* First inti L with 0, will be updated at the end */
-      atlv[1] = 0x00;
-      
-      status = NFCTAG_WriteData( (atlv + 1), (CCFileStruct.NDEF_offset + 1), 1 );
-      
-      index += 2;
-    }
-  }
-  
-  /* Start write NDEF message to EEPROM */
-  status = NFCTAG_WriteData( (pData + FIRST_RECORD_OFFSET), CCFileStruct.NDEF_offset + index + Offset, DataSize );
-  if( status != NFCTAG_OK )
-  {
-    return NDEF_ERROR;
-  }
-  
-  /* If entire NDEF is written, update Length of Type 5 */
-  if( DataSize == NDEF_Size )
-  {
-    /* Check if L is on 3 or 1 byte */
-    if( NDEF_Size >= NFCT5_3_BYTES_L_TLV )
-    {
-      /* Update Length value */
-      atlv[1] = NFCT5_3_BYTES_L_TLV;
-      atlv[2] = pData[0];
-      atlv[3] = pData[1];
-      
-      status = NFCTAG_WriteData( (atlv + 1), (CCFileStruct.NDEF_offset + 1), 3 );
-    }
-    else
-    {
-      /* Update Length value */
-      atlv[1] = pData[1];
-      
-      status = NFCTAG_WriteData( (atlv + 1), (CCFileStruct.NDEF_offset + 1), 1 );
-    }
-
-    /* Write Terminator TLV */
-    atlv[0] = NFCT5_TERMINATOR_TLV;
-    status = NFCTAG_WriteData( atlv, CCFileStruct.NDEF_offset + index + NDEF_Size, 1 );
-  }
-  
-  return NDEF_OK;
-}
-
-/**
-  * @brief  This functions writes CCFile in EEPROM.
-  * @Param  pCCBuffer : pointer on the buffer containnig CC file.
-  * @retval NFCTAG status.
-  */
-uint16_t NFCType5::NfcType5_WriteCCFile( const uint8_t * const pCCBuffer )
-{
-  NFCTAG_StatusTypeDef ret_value;
-  
-  /* Write first block of CCFile */
-  ret_value = NFCTAG_WriteData( pCCBuffer, 0x00, 0x4 );
- 
-  /* If extended memory writes the next 4 bytes */
-  if( (pCCBuffer[2] == 0x00) && (ret_value == NFCTAG_OK) )
-  {
-    ret_value = NFCTAG_WriteData( pCCBuffer + 4, 0x04, 4 );
-  }
-
-  if( ret_value != NFCTAG_OK )
-  {
-    return NDEF_ERROR;
-  }
-  
-    return NDEF_OK;
-}
-
-/**
-  * @brief  This functions reads CCFile in EEPROM.
-  * @Param  pCCBuffer : pointer on the buffer to store CC file.
-  * @retval NFCTAG status.
-  */
-uint16_t NFCType5::NfcType5_ReadCCFile( uint8_t * const pCCBuffer )
-{
-  NFCTAG_StatusTypeDef ret_value;
-  
-  /* Read 4 bytes of CC File */
-  ret_value = NFCTAG_ReadData( pCCBuffer, 0x00, 4 );
-
-  /* If extended memory reads the next 4 bytes */
-  if( (pCCBuffer[2] == 0x00) && (ret_value == NFCTAG_OK) )
-  {
-    ret_value = NFCTAG_ReadData( pCCBuffer + 4, 0x04, 4 );
-  }
-  
-  if( ret_value != NFCTAG_OK )
-  {
-    return NDEF_ERROR;
-  }
-  
-    return NDEF_OK;
-}
-
-/**
-  * @brief  This function initialize memory in Tag Type 5.
-  * @retval NFCTAG status.
-  */
-uint16_t NFCType5::NfcType5_TT5Init( void )
-{
-  NFCTAG_StatusTypeDef ret_value = NFCTAG_OK;
-  uint16_t status;
-  uint8_t accbuffer[8];
-  uint8_t cdata;
-
-  /* Prepare buffer to update CCFile */
-  accbuffer[0] = CCFileStruct.MagicNumber;
-  accbuffer[1] = CCFileStruct.Version;
-  accbuffer[2] = CCFileStruct.MemorySize;
-  accbuffer[3] = CCFileStruct.TT5Tag;
-  CCFileStruct.NDEF_offset = 0x04;
-  
-  /* If extended memory prepare the length bytes */
-  if( CCFileStruct.MemorySize == NFCT5_EXTENDED_CCFILE )
-  {
-    accbuffer[6] = (uint8_t)(CCFileStruct.ExtMemorySize >> 8);
-    accbuffer[7] = (uint8_t)(CCFileStruct.ExtMemorySize & 0xFF);
-    CCFileStruct.NDEF_offset = 0x08;
-  }
-  
-  /* Update CCFile */
-  status = NfcType5_WriteCCFile( accbuffer );
-  if( status != NDEF_OK )
-  {
-    return status;
-  }
-  
-  /* Update NDEF TLV for INITIALIZED state */
-  /* Update T */
-  cdata = NFCT5_NDEF_MSG_TLV;
-  ret_value = NFCTAG_WriteData( &cdata, CCFileStruct.NDEF_offset, 1 );
-  if( ret_value != NFCTAG_OK )
-  {
-    return NDEF_ERROR;
-  }
-
-  /* Update L */
-  cdata = 0x00;
-  ret_value = NFCTAG_WriteData( &cdata, (CCFileStruct.NDEF_offset + 1), 1 );
-  if( ret_value != NFCTAG_OK )
-  {
-    return NDEF_ERROR;
-  }
-  
-  return NDEF_OK;
-}
-
-/**
-  * @brief  This function detects an NDEF message Tag Type 5 in EEPROM.
-  * @retval NDEF_OK : NDEF message Tag Type 5 detected.
-  * @retval NDEF_ERROR_NOT_FORMATED : Device is not an NFC Tag Type 5 Tag.
-  * @retval NDEF_NO_NDEF_DETECTED : No NDEF Detected.
-  */
-uint16_t NFCType5::NfcType5_NDEFDetection( void )
-{
-  uint8_t acc_buffer[8];
-  uint8_t atlv_detect[4];
-  uint16_t status;
-  uint32_t memory_size;
-  
-  CCFileStruct.State = TT5_NO_NDEF;
-  
-  /* Read CCFile */
-  status = NfcType5_ReadCCFile( acc_buffer );
-  if( status != NDEF_OK )
-  {
-    return status;
-  }
-  
-  /* Check Byte 0 is equal to magic number */
-  if( ( acc_buffer[0] != NFCT5_MAGICNUMBER_E1_CCFILE ) && ( acc_buffer[0] != NFCT5_MAGICNUMBER_E2_CCFILE ) )
-  {
-    return NDEF_ERROR_NOT_FORMATED;
-  }
-  /* Check Version number */
-  else if( ( (acc_buffer[1]&0xFC) != 0x40 ) )
-  {
-    return NDEF_ERROR_NOT_FORMATED;
-  }
-  
-  /* Check if CCFile is on 4 Bytes or 8 Bytes */
-  if( acc_buffer[2] == 0x00 )
-  {
-    /* Update CCFIle structure */
-    CCFileStruct.MemorySize = 0x0;
-    CCFileStruct.ExtMemorySize = (uint16_t)acc_buffer[6];
-    CCFileStruct.ExtMemorySize = ( CCFileStruct.ExtMemorySize << 8 ) |  acc_buffer[7];
-    memory_size = CCFileStruct.ExtMemorySize;
-    CCFileStruct.NDEF_offset = 8;
-  }
-  else
-  {
-    /* Update CCFIle structure */
-    CCFileStruct.MemorySize = acc_buffer[2];
-    CCFileStruct.ExtMemorySize = 0x0;
-    memory_size = CCFileStruct.MemorySize;
-    CCFileStruct.NDEF_offset = 4;
-  }
-  
-  /* Update CCFIle structure */
-  CCFileStruct.MagicNumber = acc_buffer[0];
-  CCFileStruct.Version = acc_buffer[1];
-  CCFileStruct.TT5Tag = acc_buffer[3];
-  
-  /* Search for position of NDEF TLV in memory and tag status */
-  while( ( NFCTAG_ReadData( atlv_detect, CCFileStruct.NDEF_offset, 4 ) == NFCTAG_OK ) && ( CCFileStruct.NDEF_offset < memory_size ) )
-  {
-    /* Detect first NDEF Message in memory */
-    if( atlv_detect[0] == NFCT5_NDEF_MSG_TLV )
-    {
-      if( atlv_detect[1] == 0x00 )
-      {
-        CCFileStruct.State = TT5_INITIALIZED;
-      }
-      else
-      {
-        if( CCFileStruct.Version & 0x3 )
-        {
-          CCFileStruct.State = TT5_READ;
-        }
-        else
-        {
-          CCFileStruct.State = TT5_READ_WRITE;
-        }
-      }
-      return NDEF_OK;
-    }
-    /* If Proprietary NDEF jump to end of proprietary message */
-    else if( atlv_detect[0] == NFCT5_PROPRIETARY_TLV )
-    {
-      if( atlv_detect[1] == NFCT5_3_BYTES_L_TLV )
-      {
-        CCFileStruct.NDEF_offset = CCFileStruct.NDEF_offset + ( (uint32_t)atlv_detect[2] << 8 ) + atlv_detect[3];
-        continue;
-      }
-      else
-      {
-        CCFileStruct.NDEF_offset = CCFileStruct.NDEF_offset + atlv_detect[1];
-        continue;
-      }
-    }
-    /* if Terminator no NDEF detected */
-    else if( atlv_detect[0] == NFCT5_TERMINATOR_TLV )
-    {
-      return NDEF_ERROR_NOT_FORMATED;
-    }
-      
-    CCFileStruct.NDEF_offset++;
-  }
-  
-  return NDEF_ERROR_NOT_FORMATED;
-}
-
-/**
-  * @}
-  */ 
-
-/**
-  * @}
-  */ 
-
-/**
-  * @}
-  */ 
-
-/******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
--- a/Lib_NDEF/tagtype5_wrapper.h	Wed Jul 27 09:25:33 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    tagtype5_wrapper.h
-  * @author  MMY Application Team
-  * @version $Revision: 1638 $
-  * @date    $Date: 2016-02-10 16:41:05 +0100 (Wed, 10 Feb 2016) $
-  * @brief   Interface for tagtype5 in order to use NDEF lib
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
-  *
-  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
-  * You may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at:
-  *
-  *        http://www.st.com/myliberty  
-  *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *
-  ******************************************************************************
-  */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __TAGTYPE5_WRAPPER_H
-#define __TAGTYPE5_WRAPPER_H
-
-#include <stdint.h> 
-#include "common.h"
-    
-typedef enum
-{
-  TT5_NO_NDEF = 0,
-  TT5_INITIALIZED,
-  TT5_READ_WRITE,
-  TT5_READ
-} TT5_State;
-
-/**
-  * @brief  CCfile structure
-  */
-typedef struct
-{
-  uint8_t MagicNumber;  /* Magic Number should be E1h or E2h */
-  uint8_t Version;
-  uint8_t MemorySize;
-  uint8_t TT5Tag;
-  uint8_t rsved1;
-  uint8_t rsved2;
-  uint16_t ExtMemorySize;
-  TT5_State State;
-  uint32_t NDEF_offset;
-}sCCFileInfo;
-
-/* Exported constants --------------------------------------------------------*/
-#define NFCT5_MAGICNUMBER_E1_CCFILE       0xE1
-#define NFCT5_MAGICNUMBER_E2_CCFILE       0xE2
-#define NFCT5_EXTENDED_CCFILE             0xFF
-#define NFCT5_VERSION_V1_0                0x40
-#define NFCT5_READ_ACCESS                 0x0C
-#define NFCT5_WRITE_ACCESS                0x03
-
-#define NFCT5_NDEF_MSG_TLV                0x03
-#define NFCT5_PROPRIETARY_TLV             0xFD
-#define NFCT5_TERMINATOR_TLV              0xFE
-#define NFCT5_3_BYTES_L_TLV               0xFF
-
-/* Exported macro ------------------------------------------------------------*/
-/* External variables --------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-//typedef enum
-//{
-//  NFCTAG_OK      = 0,
-//  NFCTAG_ERROR   = 1,
-//  NFCTAG_BUSY    = 2,
-//  NFCTAG_TIMEOUT = 3
-//} NFCTAG_StatusTypeDef;
-class NFCType5 {
-
-  
- public: 
-sCCFileInfo CCFileStruct;
-
-
-uint16_t NfcType5_WriteCCFile( const uint8_t * const pCCBuffer );
-uint16_t NfcType5_ReadCCFile( uint8_t * const pCCBuffer );
-uint16_t NfcType5_TT5Init( void );
-uint16_t NfcType5_NDEFDetection( void );
-
-
-virtual NFCTAG_StatusTypeDef NFCTAG_ReadData( uint8_t * const pData, const uint16_t TarAddr, const uint16_t Size )=0;
-virtual NFCTAG_StatusTypeDef NFCTAG_WriteData( const uint8_t * const pData, const uint16_t TarAddr, const uint16_t Size )=0;
-
-uint16_t ReadData( uint16_t Offset , uint16_t DataSize , uint8_t* pData );
-uint16_t WriteData( uint16_t Offset , uint32_t DataSize , uint8_t *pData );
-
-};
-#endif /* __TAGTYPE5_WRAPPER_H */
-/**
-  * @}
-  */ 
-
-/**
-  * @}
-  */ 
-
-/**
-  * @}
-  */ 
-
-/******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NDefLib.lib	Tue Aug 30 09:18:50 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/NDefLib/#030e7ffdf512
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/X_NUCLEO_NFC02A1/Common/component.h	Tue Aug 30 09:18:50 2016 +0000
@@ -0,0 +1,91 @@
+/**
+ ******************************************************************************
+ * @file    component.h
+ * @author  AST
+ * @version V1.0.0
+ * @date    1 April 2015
+ * @brief   Header file containing generic component definitions
+ *          and I/O functions.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Prevent recursive inclusion -----------------------------------------------*/
+
+#ifndef __COMPONENT_H__
+#define __COMPONENT_H__
+
+
+/* Types ---------------------------------------------------------------------*/
+
+/**
+ * @brief  Component's Context structure definition.
+ */
+typedef struct
+{  
+    /* Identity. */
+    uint8_t who_am_i;
+
+    /* ACTION ----------------------------------------------------------------*/
+    /* There should be only a unique identifier for each component, which     */
+    /* should be the "who_am_i" parameter, hence this parameter is optional.  */
+    /* -----------------------------------------------------------------------*/
+    /* Type. */
+    uint8_t type;
+
+    /* Configuration. */
+    uint8_t address;
+
+    /* Pointer to the Data. */
+    void *pData;
+
+    /* Pointer to the Virtual Table. */
+    void *pVTable;
+
+    /* ACTION ----------------------------------------------------------------*/
+    /* There should be only a unique virtual table for each component, which  */
+    /* should be the "pVTable" parameter, hence this parameter is optional.   */
+    /* -----------------------------------------------------------------------*/
+    /* Pointer to the Extended Virtual Table. */
+    void *pExtVTable;
+} DrvContextTypeDef;
+
+/**
+ * @brief  Component's Status enumerator definition.
+ */
+typedef enum
+{
+    COMPONENT_OK = 0,
+    COMPONENT_ERROR,
+    COMPONENT_TIMEOUT,
+    COMPONENT_NOT_IMPLEMENTED
+} DrvStatusTypeDef;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/X_NUCLEO_NFC02A1/Common/nfc.h	Tue Aug 30 09:18:50 2016 +0000
@@ -0,0 +1,189 @@
+/**
+ ******************************************************************************
+ * @file    nfc.h
+ * @author  ST Central Labs
+ * @version V1.0.0
+ * @date    14-October-2015
+ * @brief   This header file contains the functions prototypes for the
+ *          NFC device driver.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+#ifndef __NFC_H_
+#define __NFC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include <stdint.h>
+#include "component.h"
+/** @addtogroup BSP
+ * @{
+ */
+
+/** @addtogroup Components
+ * @{
+ */
+
+/** @addtogroup NFC
+ * @{
+ */
+
+/** @defgroup NFC_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief  NFC status enumerator definition
+ */
+typedef enum {
+    NFC_SUCCESS=0x9000,
+    NFC_ERROR=0x6F00,
+    NFC_FILE_OVERFLOW_LE = 0x6280,
+    NFC_EOF = 0x6282,
+    NFC_PASSWORD_REQUIRED = 0x6300,
+    NFC_PASSWORD_INCORRECT = 0x63C0,
+    NFC_PASSWORD_INCORRECT1RETRY = 0x63C1,
+    NFC_PASSWORD_INCORRECT2RETRY = 0x63C2,
+    NFC_WRONG_LENGHT = 0x6700,
+    NFC_UNSUCESSFUL_UPDATING = 0x6581,
+    NFC_INCOPATIBLE_COMMAND= 0x6981,
+    NFC_SECURITY_UNSATISFIED = 0x6982,
+    NFC_REFERENCE_DATA_NOT_USABLE = 0x6984,
+
+    NFC_INCORRECT_PARAMETER = 0x6a80,
+    NFC_FILE_NOT_FOUND=0x6a82,
+    NFC_FILE_OVERFLOW_LC = 0x6A84, //TODO difference with Le??
+
+    NFC_INCORRECT_P1_OR_P2 = 0x6A86, //TODO better name?
+    NFC_RF_SESSION_KILLED=0x6500,
+    NFC_INS_NOT_SUPPORTED=0x6D00,
+    NFC_CLASS_NOT_SUPPORTED=0x6E00,
+
+    //IOError
+    NFC_IO_ERROR_I2CTIMEOUT=0x0011,
+    NFC_IO_ERROR_CRC=0x0012,
+    NFC_IO_ERROR_NACK=0x0013,
+    NFC_IO_ERROR_PARAMETER=0x0014,
+    NFC_IO_ERROR_NBATEMPT=0x0015,
+    NFC_IO_NOACKNOWLEDGE=0x0016
+} NFC_StatusTypeDef;
+
+/**
+ * @brief  NFC component identifier enumerator definition.
+ */
+typedef enum
+{
+    NFC_NONE_COMPONENT = 0,
+    NFC_M24SR_COMPONENT = 1
+} NFC_ComponentTypeDef;
+
+/**
+ * @brief  GPO state structure
+ */
+typedef enum {
+    HIGH_IMPEDANCE = 0,
+    SESSION_OPENED =1,
+    WIP=2,
+    I2C_ANSWER_READY=3,
+    INTERRUPT=4,
+    STATE_CONTROL=5
+} NFC_GPO_MGMT;
+
+
+/**
+ * @brief  NFC driver structure definition
+ */
+typedef struct {
+    /* Generic */
+    NFC_StatusTypeDef (*Init)      (void *handle, void *init);
+    NFC_StatusTypeDef (*ReadID)    (void *handle, uint8_t *id);
+
+    /* Interrupts */
+    NFC_StatusTypeDef (*SendInterrupt)(void *handle);
+
+    /* Specific */
+    //I2C session Commands:
+    NFC_StatusTypeDef (*GetSession)(void *handle);
+    NFC_StatusTypeDef (*KillSession)(void *handle);
+    NFC_StatusTypeDef (*Deselect)(void *handle);
+
+    //NFC forum type 4 commands:
+    NFC_StatusTypeDef (*SelectApplication)(void *handle);
+    NFC_StatusTypeDef (*SelectCCfile)(void *handle);
+    NFC_StatusTypeDef (*SelectNDEFfile)(void *handle, uint16_t NDEFfileId);
+    NFC_StatusTypeDef (*SelectSystemfile)(void *handle);
+    NFC_StatusTypeDef (*ReadBinary)(void *handle, uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead);
+    NFC_StatusTypeDef (*UpdateBinary)(void *handle, uint16_t Offset, uint8_t NbByteToWrite, uint8_t *pDataToWrite);
+
+    //ISO/IEC 7816-4 commands:
+    NFC_StatusTypeDef (*Verify)(void *handle, uint16_t uPwdId, uint8_t NbPwdByte, uint8_t *pPwd);
+    NFC_StatusTypeDef (*ChangeReferenceData)(void *handle, uint16_t uPwdId, uint8_t *pPwd);
+    NFC_StatusTypeDef (*EnableVerificationRequirement)(void *handle, uint16_t uReadOrWrite);
+    NFC_StatusTypeDef (*DisableVerificationRequirement)(void *handle, uint16_t uReadOrWrite);
+
+    //ST Specific
+    NFC_StatusTypeDef (*STReadBinary)(void *handle, uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead);
+    NFC_StatusTypeDef (*EnablePermanentState)(void *handle, uint16_t uReadOrWrite);
+    NFC_StatusTypeDef (*DisablePermanentState)(void *handle, uint16_t uReadOrWrite);
+
+    //??
+
+    NFC_StatusTypeDef (*StateControl)(void *handle, uint8_t uSetOrReset);
+    NFC_StatusTypeDef (*ManageI2CGPO)(void *handle, uint8_t GPO_I2Cconfig);
+    NFC_StatusTypeDef (*ManageRFGPO)(void *handle, uint8_t GPO_RFconfig);
+    NFC_StatusTypeDef (*RFConfig)(void *handle, uint8_t OnOffChoice);
+
+} NFC_DrvVTableTypeDef;
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NFC_H_ */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/X_NUCLEO_NFC02A1/Interfaces/Component_class.h	Tue Aug 30 09:18:50 2016 +0000
@@ -0,0 +1,75 @@
+/**
+ ******************************************************************************
+ * @file    Component_class.h
+ * @author  AST / EST
+ * @version V0.0.1
+ * @date    13-April-2015
+ * @brief   This file contains the abstract class describing the interface of a
+ *          generic component.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent from recursive inclusion --------------------------------*/
+
+#ifndef __COMPONENT_CLASS_H
+#define __COMPONENT_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include <stdint.h>
+
+
+/* Classes  ------------------------------------------------------------------*/
+
+/** An abstract class for Generic components.
+ */
+class Component
+{
+public:
+    /**
+     * @brief  Initializing the component.
+     * @param  init pointer to device specific initalization structure.
+     * @retval "0" in case of success, an error code otherwise.
+     */
+    virtual int Init(void *init) = 0;
+
+    /**
+     * @brief  Getting the ID of the component.
+     * @param[out]  id pointer to an allocated variable to store the ID into.
+     * @retval "0" in case of success, an error code otherwise.
+     */
+    virtual int ReadID(uint8_t *id) = 0;
+};
+
+#endif /* __COMPONENT_CLASS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/X_NUCLEO_NFC02A1/Interfaces/Nfc_class.h	Tue Aug 30 09:18:50 2016 +0000
@@ -0,0 +1,893 @@
+/**
+ ******************************************************************************
+ * @file    Nfc_class.h
+ * @author  AMG Central Lab
+ * @version V1.0.0
+ * @date    30-Aug-2016
+ * @brief   This file contains the abstract class describing the interface of a
+ *          nfc component.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Generated with Stm32CubeTOO -----------------------------------------------*/
+
+/* Define to prevent from recursive inclusion --------------------------------*/
+
+#ifndef __NFC_CLASS_H
+#define __NFC_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "Component_class.h"
+#include "../Common/nfc.h"
+
+/* Classes  ------------------------------------------------------------------*/
+
+/**
+* An abstract class for Nfc components. 
+* This component has two operation modes, sync or async.
+* In sync mode each function call returns only after the command has completed.
+* In async mode each function call returns immediately and the answer will be notified
+* through a callback.
+* The default behavior is sync mode.
+* To enable the async mode ManageI2CGPO(I2C_ANSWER_READY) function must be called.
+* When the component notifies an interrupt user must call  {@link ManageEvent} function.
+* Note that passing a parameter other than I2C_ANSWER_READY to ManageI2CGPO initialize the component in sync mode.
+*/
+class Nfc : public Component
+{
+public:
+
+    /**
+     * Possible password to set.
+     */
+    typedef enum{
+        ReadPwd,   //!< Password to use before reading the tag
+        WritePwd,  //!< Password to use before writing the tag
+        I2CPwd,    //!< Root password, used only through nfc
+    }PasswordType_t;
+
+    /**
+     * Function that will be called when an interrupt is fired,
+     * this function must be set if you want use the component in async mode.
+     */
+    typedef void(*gpoEventCallback)(void);
+
+    /**
+     * Object that contains all the callbacks fired by this class, each command has its own callback.
+     * The callback default implementation is an empty function.
+     */
+    class Callbacks{
+    public:
+
+        /** called when GetSession or ForceGetSession completes
+         * @see Nfc#GetSession
+         * @see Nfc#ForceGetSession */
+        virtual void onSessionOpen(Nfc *nfc,NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+        /** called when Deselect completes
+         * @see Nfc#Deselect */
+        virtual void onDeselect(Nfc *nfc,NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+        /** called when SelectedApplication completes
+         * @see Nfc#SelectedApplication */
+        virtual void onSelectedApplication(Nfc *nfc,NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+        
+        /** called when SelectedCCFile completes
+         * @see Nfc#SelectedCCFile */
+        virtual void onSelectedCCFile(Nfc *nfc,NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+        /** called when SelectedNDEFFile completes
+         * @see Nfc#SelectedNDEFFile */
+        virtual void onSelectedNDEFFile(Nfc *nfc,NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+        /** called when SelectedSystemFile completes
+         * @see Nfc#SelectedSystemFile */
+        virtual void onSelectedSystemFile(Nfc *nfc,NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+        /** called when ReadBinary or STReadBinary completes
+         * @see Nfc#ReadBinary
+         * @see Nfc#STReadBinary */
+        virtual void onReadByte(Nfc *nfc,NFC_StatusTypeDef status,
+                uint16_t offset,uint8_t *readByte, uint16_t nReadByte){
+            (void)nfc; (void)status;(void)offset; (void)readByte; (void)nReadByte;
+        }
+
+        /** called when UpdatedBinary completes
+         * @see Nfc#UpdatedBinary */
+        virtual void onUpdatedBinary(Nfc *nfc,NFC_StatusTypeDef status,uint16_t offset,
+                uint8_t *writeByte,uint16_t nWriteByte){
+            (void)nfc; (void)status; (void)writeByte; (void)nWriteByte; (void)offset;
+        }
+
+        /** called when Verify completes
+         * @see Nfc#Verify */   
+        virtual void onVerified(Nfc *nfc,NFC_StatusTypeDef status,PasswordType_t uPwdId,
+                const uint8_t *pwd){
+            (void)nfc; (void)status;(void)uPwdId;(void)pwd;
+        }
+
+        /** called when ManageI2CGPO completes
+         * @see Nfc#ManageI2CGPO */
+        virtual void onManageI2CGPO(Nfc *nfc,NFC_StatusTypeDef status,NFC_GPO_MGMT newStatus){
+            (void)nfc; (void)status;(void)newStatus;
+        }
+
+        /** called when ManageRFGPO completes
+         * @see Nfc#ManageRFGPO */
+        virtual void onManageRFGPO(Nfc *nfc,NFC_StatusTypeDef status,NFC_GPO_MGMT newStatus){
+            (void)nfc; (void)status;(void)newStatus;
+        }
+
+        /** called when ChangeReferenceData completes
+         * @see Nfc#ChangeReferenceData */
+        virtual void onChangeReferenceData(Nfc *nfc ,NFC_StatusTypeDef status,PasswordType_t type,
+                uint8_t *data){
+            (void)nfc; (void)status;(void)type;(void)data;
+        }
+
+        /** called when EnableVerificationRequirement completes
+         * @see Nfc#EnableVerificationRequirement */    
+        virtual void onEnableVerificationRequirement(Nfc *nfc ,NFC_StatusTypeDef status,PasswordType_t type){
+            (void)nfc; (void)status;(void)type;
+        }
+        
+        /** called when DisableVerificationRequirement completes
+         * @see Nfc#DisableVerificationRequirement */   
+        virtual void onDisableVerificationRequirement(Nfc *nfc , NFC_StatusTypeDef status,PasswordType_t type){
+            (void)nfc; (void)status;(void)type;
+        }
+
+        /** called when EnablePermanentState completes
+         * @see Nfc#EnablePermanentState */ 
+        virtual void onEnablePermanentState(Nfc *nfc, NFC_StatusTypeDef status, PasswordType_t type){
+            (void)nfc; (void)status;(void)type;
+        }
+
+        /** called when DisablePermanentState completes
+         * @see Nfc#DisablePermanentState */    
+        virtual void onDisablePermanentState(Nfc *nfc, NFC_StatusTypeDef status, PasswordType_t type){
+            (void)nfc; (void)status;(void)type;
+        }
+
+        /** called when ReadId completes
+         * @see Nfc#ReadId */
+        virtual void onReadId(Nfc *nfc, NFC_StatusTypeDef status, uint8_t *id){
+                    (void)nfc; (void)status;(void)id;
+        }
+
+        /** called when EnableReadPassword completes
+         * @see Nfc#EnableReadPassword */
+        virtual void onEnableReadPassword(Nfc *nfc, NFC_StatusTypeDef status,const uint8_t *newPwd){
+            (void)nfc; (void)status;(void)newPwd;
+        }
+
+        /** called when EnableWritePassword completes
+         * @see Nfc#EnableWritePassword */
+        virtual void onEnableWritePassword(Nfc *nfc, NFC_StatusTypeDef status,const uint8_t *newPwd){
+            (void)nfc; (void)status;(void)newPwd;
+        }
+
+        /** called when DisableReadPassword completes
+         * @see Nfc#DisableReadPassword */
+        virtual void onDisableReadPassword(Nfc *nfc, NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+        /** called when DisableWritePassword completes
+         * @see Nfc#DisableWritePassword */
+        virtual void onDisableWritePassword(Nfc *nfc, NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+        /** called when DisableAllPassword completes
+         * @see Nfc#DisableAllPassword */
+        virtual void onDisableAllPassword(Nfc *nfc, NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+
+        /** called when EnableReadOnly completes
+         * @see Nfc#EnableReadOnly */
+        virtual void onEnableReadOnly(Nfc *nfc,NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+        /** called when EnableWriteOnly completes
+         * @see Nfc#EnableWriteOnly */
+        virtual void onEnableWriteOnly(Nfc *nfc,NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+
+        /** called when DisableReadOnly completes
+         * @see Nfc#DisableReadOnly */
+        virtual void onDisableReadOnly(Nfc *nfc,NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+        /** called when DisableWriteOnly completes
+         * @see Nfc#DisableWriteOnly */
+        virtual void onDisableWriteOnly(Nfc *nfc,NFC_StatusTypeDef status){
+            (void)nfc; (void)status;
+        }
+
+        virtual ~Callbacks(){};
+    };
+
+    Nfc():mCallback(&defaultCallback),
+            mComponentCallback(NULL){ }
+
+    /**
+     * Open a I2C connection with the tag if an RF connection isn't already open.
+     * @return operation status
+     */
+    virtual NFC_StatusTypeDef GetSession(void) = 0;
+    
+    /**
+     * Force to open an I2C connection , abort the RF connection.
+     * @return NFC_SUCCESS if the session is acquired
+     */
+    virtual NFC_StatusTypeDef ForceGetSession(void) = 0;
+
+    /**
+     * Close an I2C connection.
+     * @return NFC_SUCCESS if the session is release
+     */
+    virtual NFC_StatusTypeDef Deselect(void) = 0;
+
+    /**
+     * Select the application file.
+     * @return NFC_SUCCESS if the application is selected
+     */
+    virtual NFC_StatusTypeDef SelectApplication(void) = 0;
+
+    /**
+     * Select the CC file.
+     * @return NFC_SUCCESS if the CC file is selected.
+     */
+    virtual NFC_StatusTypeDef SelectCCfile(void) = 0;
+
+    /**
+     * Select the NDEF file.
+     * @param NDEFfileId File id to open.
+     * @return NFC_SUCCESS if the file is selected
+     */
+    virtual NFC_StatusTypeDef SelectNDEFfile(uint16_t NDEFfileId) = 0;
+
+    /**
+     * Select the system file.
+     * @return NFC_SUCCESS if the system file is selected
+     */
+    virtual NFC_StatusTypeDef SelectSystemfile(void) = 0;
+
+    /**
+     * Read data from the tag.
+     * @param Offset Read offset.
+     * @param NbByteToRead Number of bytes to read.
+     * @param[out] pBufferRead Buffer to store the read data into.
+     * @return NFC_SUCCESS if no errors 
+     */
+    virtual NFC_StatusTypeDef ReadBinary(uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead) = 0;
+
+    /**
+     * Write data to the tag.
+     * @param Offset Write offset.
+     * @param NbByteToWrite Number of bytes to write.
+     * @param pDataToWrite Buffer to write.
+     * @return NFC_SUCCESS if no errors
+     */
+    virtual NFC_StatusTypeDef UpdateBinary(uint16_t Offset, uint8_t NbByteToWrite, uint8_t *pDataToWrite) = 0;
+
+    /**
+     * Check that the password is correct.
+     * @param uPwdId Password type.
+     * @param NbPwdByte Password size ( must be 0x10).
+     * @param pPwd Password buffer.
+     * @return NFC_SUCCESS if no errors and write/read permission granted
+     */
+    virtual NFC_StatusTypeDef Verify(PasswordType_t uPwdId, uint8_t NbPwdByte,const uint8_t *pPwd) = 0;
+
+    /**
+     * Replace the read or write password.
+     * @param uPwdId Password to change.
+     * @param pPwd New password.
+     * @return NFC_SUCCESS if no errors
+     */
+    virtual NFC_StatusTypeDef ChangeReferenceData(PasswordType_t uPwdId,const uint8_t *pPwd) = 0;
+    
+    /**
+     *  Activate NDEF file password protection.
+     *  When this command is successful, read or write access to the NDEF file is protected by a 128-bit password.
+     *  @param uReadOrWrite Read or write password.
+     *  @return NFC_SUCCESS if no errors
+     */
+    virtual NFC_StatusTypeDef EnableVerificationRequirement(PasswordType_t uReadOrWrite) = 0;
+    
+    /**
+     * Deactivate NDEF file password protection.
+     * When this command is successful, read or write access to the NDEF file is granted.
+     * with no security enforcement.
+     * @param uReadOrWrite Read or write password.
+     * @return NFC_SUCCESS if no errors
+     */     
+    virtual NFC_StatusTypeDef DisableVerificationRequirement(PasswordType_t uReadOrWrite) = 0;
+    
+    /**
+     * Same as {@link NFC#ReadBinary}, however permitting to read more bytes than available.
+     * @param Offset read offset.
+     * @param NbByteToRead Number of bytes to read.
+     * @param[out] pBufferRead Buffer to store the read data into.
+     * @return NFC_SUCCESS if no errors
+     */
+    virtual NFC_StatusTypeDef STReadBinary(uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead) = 0;
+    
+    /**
+     * Set the tag as read/write only, stored in the eeprom.
+     * @param  uReadOrWrite ReadPwd if write only, WritePwd if read only.
+     * @return NFC_SUCCESS if no errors
+     */
+    virtual NFC_StatusTypeDef EnablePermanentState(PasswordType_t uReadOrWrite) = 0;
+    
+    /**
+     * Unset the tag as read/write only, stored in the eeprom.
+     * @param  uReadOrWrite ReadPwd if write only, WritePwd if read only.
+     * @return NFC_SUCCESS if no errors
+     * @par Caller must have I2Csuper user permissions to call this function.
+     */
+    virtual NFC_StatusTypeDef DisablePermanentState(PasswordType_t uReadOrWrite) = 0;
+    
+    /**
+     * Set the gpo output pin.
+     * @param uSetOrReset New pin status.
+     * @return NFC_SUCCESS if no errors
+     */
+    virtual NFC_StatusTypeDef StateControl(uint8_t uSetOrReset) = 0;
+    
+    /**
+     * @brief  This function configures GPO for I2C session.
+     * @param  GPO_I2Cconfig GPO configuration to set.
+     * @return NFC_SUCCESS if no errors
+     * @par if the configuration is I2C_ANSWER_READY, the component will start to work
+     * in async mode.
+     */
+    virtual NFC_StatusTypeDef ManageI2CGPO(NFC_GPO_MGMT GPO_I2Cconfig) = 0;
+    
+    /**
+    * @brief  This function configures GPO for RF session.
+    * @param  GPO_RFconfig GPO configuration to set.
+    * @return NFC_SUCCESS if no errors
+    */
+    virtual NFC_StatusTypeDef ManageRFGPO(uint8_t GPO_RFconfig) = 0;
+    
+    /**
+     * @brief  This function enables or disables the RF communication.
+     * @param  OnOffChoice GPO configuration to set.
+     * @return NFC_SUCCESS if no errors
+     */
+    virtual NFC_StatusTypeDef RFConfig(uint8_t OnOffChoice) = 0;
+
+    /**
+     * Generates a negative pulse on the GPO pin.
+     * Pulse starts immediately after the command is issued and ends at the end of the RF response.
+     * @return NFC_SUCCESS if no errors
+     */
+    virtual NFC_StatusTypeDef SendInterrupt(void)=0;
+
+    /**
+     * Change the function to call when a command ends.
+     * @param commandCallback Object containing the callback, if NULL it will use empty callback
+     */
+    void SetCallback(Callbacks *commandCallback){
+        if(commandCallback!=NULL)
+            mCallback = commandCallback;
+        else
+            mCallback = &defaultCallback;
+    }
+
+    /**
+     * Function to call when the component fire an interrupt.
+     * @return last operation status
+     */
+    virtual NFC_StatusTypeDef ManageEvent()=0;
+
+
+    ///////////////////////HIGH LEVEL / UTILITY FUNCTIONS ////////////////////////////////////
+
+    /**
+     * Enable the request of a password before reading the tag.
+     * @param  pCurrentWritePassword Current password
+     * @param  pNewPassword Password to request before reading the tag.
+     * @return return NFC_SUCCESS if no errors
+     * @par The password must have a length of 16 chars.
+     */
+    NFC_StatusTypeDef EnableReadPassword(const uint8_t* pCurrentWritePassword,
+                const uint8_t* pNewPassword) {
+
+        //enable the callback for change the gpo
+        mComponentCallback = &mChangePasswordRequestStatusCallback;
+        mChangePasswordRequestStatusCallback.setTask(ReadPwd,pNewPassword);
+
+        return Verify(Nfc::WritePwd, 0x10, pCurrentWritePassword);
+    }
+
+    /**
+     * Disable the request of a password before reading the tag.
+     * @param  pCurrentWritePassword Current password
+     * @return return NFC_SUCCESS if no errors
+     * @par The password must have a length of 16 chars.
+     */
+    NFC_StatusTypeDef DisableReadPassword(const uint8_t* pCurrentWritePassword) {
+        mComponentCallback = &mChangePasswordRequestStatusCallback;
+        mChangePasswordRequestStatusCallback.setTask(ReadPwd,NULL);
+
+        return Verify(Nfc::WritePwd, 0x10, pCurrentWritePassword);
+    }
+
+    /**
+     * Enable the request of a password before writing to the tag.
+     * @param  pCurrentWritePassword Current password
+     * @param  pNewPassword Password to request before reading the tag.
+     * @return return NFC_SUCCESS if no errors
+     * @par The password must have a length of 16 chars.
+     */
+    NFC_StatusTypeDef EnableWritePassword(const uint8_t* pCurrentWritePassword,
+                uint8_t* pNewPassword) {
+        //enable the callback for change the gpo
+        mComponentCallback = &mChangePasswordRequestStatusCallback;
+        mChangePasswordRequestStatusCallback.setTask(WritePwd,pNewPassword);
+
+        return Verify(Nfc::WritePwd, 0x10, pCurrentWritePassword);
+    }
+
+    /**
+     * Disable the request of a password before writing the tag.
+     * @param  pCurrentWritePassword Current password.
+     * @return return NFC_SUCCESS if no errors
+     * @par The password must have a length of 16 chars.
+     */
+    NFC_StatusTypeDef DisableWritePassword(const uint8_t* pCurrentWritePassword) {
+        mComponentCallback = &mChangePasswordRequestStatusCallback;
+        mChangePasswordRequestStatusCallback.setTask(WritePwd,NULL);
+
+        return Verify(Nfc::WritePwd, 0x10, pCurrentWritePassword);
+    }
+
+    /**
+     * @brief   This function disables both read and write passwords.
+     * @param   pSuperUserPassword I2C super user password.
+     * @return  return NFC_SUCCESS if no errors
+     * @par The password must have a length of 16 chars.
+     */
+    NFC_StatusTypeDef DisableAllPassword(const uint8_t* pSuperUserPassword){
+        mComponentCallback = &mRemoveAllPasswordCallback;
+        return Verify(Nfc::I2CPwd, 0x10, pSuperUserPassword);
+    }
+
+    /**
+     * @brief   This function enables read only mode.
+     * @param   pCurrentWritePassword Write password is needed to enable read only mode.
+     * @return  return NFC_SUCCESS if no errors
+     * @par The password must have a length of 16 chars.
+     */
+    NFC_StatusTypeDef EnableReadOnly(const uint8_t* pCurrentWritePassword){
+
+        mComponentCallback = &mChangeAccessStateCallback;
+        //disable write = read only
+        mChangeAccessStateCallback.changeAccessState(ChangeAccessStateCallback::WRITE,false);
+
+        return Verify(Nfc::WritePwd, 0x10, pCurrentWritePassword);
+    }
+
+    /**
+     * @brief   This function disables read only mode.
+     * @param   pCurrentWritePassword Write password is needed to disable read only mode.
+     * @return  return NFC_SUCCESS if no errors
+     * @par The password must have a length of 16 chars.
+     */
+    NFC_StatusTypeDef DisableReadOnly(const uint8_t* pCurrentWritePassword) {
+        mComponentCallback = &mChangeAccessStateCallback;
+        mChangeAccessStateCallback.changeAccessState(ChangeAccessStateCallback::WRITE,true);
+        return Verify(Nfc::I2CPwd, 0x10,pCurrentWritePassword);
+    }
+
+
+    /**
+     * @brief   This function enables write only mode.
+     * @param   pCurrentWritePassword Write password is needed to enable write only mode.
+     * @return  return NFC_SUCCESS if no errors
+     * @par The password must have a length of 16 chars.
+     */
+    NFC_StatusTypeDef EnableWriteOnly(const uint8_t* pCurrentWritePassword) {
+
+        mComponentCallback = &mChangeAccessStateCallback;
+        //disable read = enable write only
+        mChangeAccessStateCallback.changeAccessState(ChangeAccessStateCallback::READ,false);
+
+        return Verify(Nfc::WritePwd, 0x10, pCurrentWritePassword);
+
+    }
+
+    /**
+     * @brief   This function disables write only mode.
+     * @param   pCurrentWritePassword Write password is needed to disable write only mode.
+     * @return  return NFC_SUCCESS if no errors
+     * @par The password must have a length of 16 chars.
+     */
+    NFC_StatusTypeDef DisableWriteOnly(const uint8_t* pCurrentWritePassword) {
+        mComponentCallback = &mChangeAccessStateCallback;
+        mChangeAccessStateCallback.changeAccessState(ChangeAccessStateCallback::READ,true);
+        return Verify(Nfc::I2CPwd, 0x10, pCurrentWritePassword);
+    }
+
+    virtual ~Nfc(){};
+
+protected:
+        /** object containing the callbacks to use*/
+        Callbacks *mCallback;
+
+        /**
+         * Object with private callbacks used to hide high level commands each
+         * calling multiple low level commands. This callbacks object has 
+         * higher priority comparing to the user callbacks.
+         */
+        Nfc::Callbacks *mComponentCallback;
+
+        /**
+         * get the callback object to use
+         * @return callback object to use
+         */
+        Nfc::Callbacks * getCallback(){
+            if(mComponentCallback!=NULL)
+                return mComponentCallback;
+            return mCallback;
+        }//getCallback
+
+private:
+    /** object containing empty callback to use in the default case*/
+    Callbacks defaultCallback;
+
+
+    /**
+     * This class permits to enable/disable the password request to read/write into the tag
+     * This class is equivalent to calling the methods:
+     * To enable the request:
+     * <ul>
+     *   <li> Verify </li>
+     *   <li> ChangeReferenceData </li>
+     *   <li> EnablePermanentState </li>
+     * </ul>
+     * To disable the request:
+     * <ul>
+     *   <li> Verify </li>
+     *   <li> DisableVerificationRequirement </li>
+     * </ul>
+     */
+    class ChangePasswordRequestStatusCallback : public Nfc::Callbacks{
+
+        public:
+
+            /**
+             * Build the chain of callbacks.
+             */
+            ChangePasswordRequestStatusCallback():
+                mNewPwd(NULL),mType(I2CPwd),mEnable(false){}
+
+            /**
+             * Set the password to enable/disable.
+             * @param type Type of password to enable/disable.
+             * @param newPwd Array of 16bytes with the new password, if null the request will be disabled.
+             */
+            void setTask(PasswordType_t type, const uint8_t *newPwd){
+                mNewPwd=newPwd;
+                mType=type;
+                mEnable=newPwd!=NULL;
+            }//setTask
+
+            virtual void onVerified(Nfc *nfc, NFC_StatusTypeDef status,PasswordType_t ,
+                    const uint8_t *){
+                if(status!=NFC_SUCCESS)
+                    return onFinishCommand(nfc,status);
+                if(mEnable)
+                    nfc->ChangeReferenceData(mType,mNewPwd);
+                else
+                    nfc->DisableVerificationRequirement(mType);
+            }
+
+            virtual void onDisableVerificationRequirement(Nfc *nfc,
+                    NFC_StatusTypeDef status, PasswordType_t ){
+                onFinishCommand(nfc,status);
+            }
+
+            virtual void onChangeReferenceData(Nfc *nfc, NFC_StatusTypeDef status,
+                    PasswordType_t type,
+                    uint8_t *){
+                if(status==NFC_SUCCESS)
+                    nfc->EnablePermanentState(type);
+                else
+                    onFinishCommand(nfc,status);
+            }
+
+            virtual void onEnablePermanentState(Nfc *nfc, NFC_StatusTypeDef status,
+                    PasswordType_t ){
+                onFinishCommand(nfc,status);
+            }
+
+
+        private:
+
+            /**
+             * Remove the private callbacks and call the user callback.
+             * @param nfc Object triggering the command.
+             * @param status Command status.
+             */
+            void onFinishCommand(Nfc *nfc,NFC_StatusTypeDef status){
+                nfc->mComponentCallback=NULL;
+
+                if(mEnable){
+                    if(mType==ReadPwd){
+                        nfc->getCallback()->onEnableReadPassword(nfc,status,mNewPwd);
+                    }else
+                        nfc->getCallback()->onEnableWritePassword(nfc,status,mNewPwd);
+                }else{
+                    if(mType==ReadPwd){
+                        nfc->getCallback()->onDisableReadPassword(nfc,status);
+                    }else
+                        nfc->getCallback()->onDisableWritePassword(nfc,status);
+                }//if-else enable
+            }//onFinish
+
+            const uint8_t *mNewPwd;
+            Nfc::PasswordType_t mType;
+            bool mEnable;
+
+        };
+
+
+        /**
+         * Object containing the callback chain needed to change the password request
+         */
+        ChangePasswordRequestStatusCallback mChangePasswordRequestStatusCallback;
+        friend class ChangePasswordRequestStatusCallback;
+
+        /**
+         * This class permits to disable all the password requests to read/write into the tag
+         * This class is equivalent to calling the methods:
+         * <ul>
+         *   <li> Verify(i2c) </li>
+         *   <li> DisablePermanentState(Read) </li>
+         *   <li> DisablePermanentState(write) </li>
+         *   <li> DisableVerificationRequirement(Read) </li>
+         *   <li> DisableVerificationRequirement(write) </li>
+         *   <li> ChangeReferenceData(Read) </li>
+         *   <li> ChangeReferenceData(write) </li>
+         * </ul>
+         */
+        class RemoveAllPasswordCallback : public Nfc::Callbacks{
+
+            /**
+             * Store the default password used for open a super user session
+             * it will be set as default read/write password
+             */
+            const uint8_t *mI2CPwd;
+
+            public:
+
+                /**
+                 * Build the chain of callbacks.
+                 */
+                RemoveAllPasswordCallback():mI2CPwd(NULL){}
+
+                virtual void onVerified(Nfc *nfc,NFC_StatusTypeDef status,
+                        PasswordType_t,const uint8_t* data){
+                    if(status!=NFC_SUCCESS)
+                        return onFinishCommand(nfc,status);
+                    mI2CPwd = data;
+                    nfc->DisablePermanentState(ReadPwd);
+                }
+
+                virtual void onDisablePermanentState(Nfc *nfc , NFC_StatusTypeDef status,
+                        PasswordType_t type){
+                    if(status!=NFC_SUCCESS)
+                        return onFinishCommand(nfc,status);
+                    if(type==ReadPwd)
+                        nfc->DisablePermanentState(WritePwd);
+                    else
+                        nfc->DisableVerificationRequirement(ReadPwd);
+                }
+
+                virtual void onDisableVerificationRequirement(Nfc *nfc ,
+                        NFC_StatusTypeDef status,PasswordType_t type){
+                    if(status!=NFC_SUCCESS)
+                        return onFinishCommand(nfc,status);
+                    if(type==ReadPwd)
+                        nfc->DisableVerificationRequirement(WritePwd);
+                    else
+                        nfc->ChangeReferenceData(ReadPwd,mI2CPwd);
+                }
+
+                virtual void onChangeReferenceData(Nfc *nfc ,NFC_StatusTypeDef status,PasswordType_t type,
+                        uint8_t *data){
+                    if(status!=NFC_SUCCESS)
+                        return onFinishCommand(nfc,status);
+                    if(type==ReadPwd)
+                        nfc->ChangeReferenceData(WritePwd,data);
+                    else
+                        onFinishCommand(nfc,status);
+                }
+
+            private:
+
+                /**
+                 * Remove the private callback and call the onDisableAllPassword callback.
+                 * @param nfc Object triggering the command.
+                 * @param status Command status.
+                 */
+                void onFinishCommand(Nfc *nfc,NFC_StatusTypeDef status){
+                    nfc->mComponentCallback=NULL;
+                    mI2CPwd=NULL;
+                    nfc->getCallback()->onDisableAllPassword(nfc,status);
+                }//onFinish
+
+        };
+
+
+        /**
+         * Object containing the callback chain needed to remove the password request
+         */
+        RemoveAllPasswordCallback mRemoveAllPasswordCallback;
+        friend class RemoveAllPasswordCallback;
+
+        /**
+         * This class permits to set the tag as read/write only
+         * This class is equivalent to calling the methods:
+         * <ul>
+         *   <li> Verify(i2c) </li>
+         *   <li> EnablePermanentState(Read/write) </li>
+         * </ul>
+         * or:
+         * <ul>
+         *   <li> Verify(i2c) </li>
+         *   <li> DisablePermanentState</li>
+         *   <li> DisableVerificationRequirement(Read/write) </li>
+         * </ul>
+         */
+        class ChangeAccessStateCallback : public Nfc::Callbacks{
+
+            public:
+
+                typedef enum{
+                    WRITE,
+                    READ
+                }AccessType_t;
+
+                /**
+                 * Build the chain of callbacks.
+                 */
+                ChangeAccessStateCallback():mType(WRITE),mEnable(false){}
+
+                /**
+                 * Set the access to enable/disable an access type.
+                 * @param type Access type.
+                 * @param enable True to enable the state, False to disable it.
+                 */
+                void changeAccessState(AccessType_t type,bool enable){
+                    mType=type;
+                    mEnable=enable;
+                }
+
+                virtual void onVerified(Nfc *nfc,NFC_StatusTypeDef status,
+                        PasswordType_t,const uint8_t*){
+                    if(status!=NFC_SUCCESS)
+                        return onFinishCommand(nfc,status);
+
+                    if(mEnable){
+                        nfc->DisablePermanentState(mType==WRITE? WritePwd : ReadPwd);
+                    }else
+                        nfc->EnablePermanentState(mType==WRITE? WritePwd : ReadPwd);
+
+                }
+
+                virtual void onDisablePermanentState(Nfc *nfc, NFC_StatusTypeDef status,
+                        PasswordType_t type ){
+                    if(status!=NFC_SUCCESS)
+                        return onFinishCommand(nfc,status);
+
+                    nfc->DisableVerificationRequirement(type);
+                }
+
+                virtual void onDisableVerificationRequirement(Nfc *nfc , NFC_StatusTypeDef status,
+                        PasswordType_t ){
+                    onFinishCommand(nfc,status);
+                }
+
+                virtual void onEnablePermanentState(Nfc *nfc ,NFC_StatusTypeDef status,PasswordType_t ){
+                    onFinishCommand(nfc,status);
+                }
+
+
+            private:
+
+                /**
+                 * Remove the private callback and call the user callback.
+                 * @param nfc Object triggering the command.
+                 * @param status Command status.
+                 */
+                void onFinishCommand(Nfc *nfc,NFC_StatusTypeDef status){
+                    nfc->mComponentCallback=NULL;
+                    if(mEnable){
+                        if(mType==READ){
+                            //enable read = disable write only
+                            nfc->getCallback()->onDisableWriteOnly(nfc,status);
+                        }else
+                            //enable write = disable read only
+                            nfc->getCallback()->onDisableReadOnly(nfc,status);
+                    }else{
+                        if(mType==WRITE){
+                            //disable write = enable read only
+                            nfc->getCallback()->onEnableReadOnly(nfc,status);
+                        }else{
+                            //
+                            nfc->getCallback()->onEnableWriteOnly(nfc,status);
+                        }
+                    }//if-else enable
+                }//onFinish
+
+                AccessType_t mType;
+                bool mEnable;
+
+        };
+
+
+        /**
+         * Object containing the callback chain needed to change the access state
+         */
+        ChangeAccessStateCallback mChangeAccessStateCallback;
+        friend class ChangeAccessStateCallback;
+
+};
+
+#endif /* __NFC_CLASS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- a/X_NUCLEO_NFC02A1/Interfaces/X_NUCLEO_NFC02A1.cpp	Wed Jul 27 09:25:33 2016 +0000
+++ b/X_NUCLEO_NFC02A1/Interfaces/X_NUCLEO_NFC02A1.cpp	Tue Aug 30 09:18:50 2016 +0000
@@ -1,13 +1,13 @@
 /**
   ******************************************************************************
   * @file       X_NUCLEO_NFC02A1.h
-  * @author  	ST Central Labs
-  * @date       05 Nov 2015
+  * @author  	AMG Central Lab
+  * @date       30 Aug 2016
   * @brief      Singleton class that controls all the electronics inside the 
   * 			X_NUCLEO_NFC02A1 expansion board
   ******************************************************************************
   *
-  * COPYRIGHT(c) 2015 STMicroelectronics
+  * COPYRIGHT(c) 2016 STMicroelectronics
   *
   * Redistribution and use in source and binary forms, with or without modification,
   * are permitted provided that the following conditions are met:
--- a/X_NUCLEO_NFC02A1/Interfaces/X_NUCLEO_NFC02A1.h	Wed Jul 27 09:25:33 2016 +0000
+++ b/X_NUCLEO_NFC02A1/Interfaces/X_NUCLEO_NFC02A1.h	Tue Aug 30 09:18:50 2016 +0000
@@ -1,15 +1,15 @@
 /**
   ******************************************************************************
   * @file       X_NUCLEO_NFC02A1.cpp
-  * @author  	ST Central Labs
-  * @version 	V1.0.0
-  * @date       05 Nov 2015
+  * @author  	AMG Central Lab
+  * @version 	1.0.0
+  * @date       30 Aug 2016
   * @brief      Singleton class that controls all the electronics inside the 
   * 			X_NUCLEO_NFC02A1 expansion board.
   ******************************************************************************
   * @attention
   *
-  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
   *
   * Redistribution and use in source and binary forms, with or without modification,
   * are permitted provided that the following conditions are met:
@@ -134,8 +134,8 @@
 		return mM24LR;
 	}
         
-        M24LR* getM24LR() {
-		return &mM24LR;
+        M24LR& getM24LR() {
+		return mM24LR;
 	}
 
 	virtual ~X_NUCLEO_NFC02A1() {
@@ -150,4 +150,3 @@
 
 };
 #endif /* X_NUCLEO_NFC02A1_H_ */
-
--- a/X_NUCLEO_NFC02A1/X_NUCLEO_COMMON/DevI2C/DevI2C.h	Wed Jul 27 09:25:33 2016 +0000
+++ b/X_NUCLEO_NFC02A1/X_NUCLEO_COMMON/DevI2C/DevI2C.h	Tue Aug 30 09:18:50 2016 +0000
@@ -185,4 +185,3 @@
 };
 
 #endif /* __DEV_I2C_H */
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/X_NUCLEO_NFC02A1/m24lr/NDefNfcTagM24LR.cpp	Tue Aug 30 09:18:50 2016 +0000
@@ -0,0 +1,468 @@
+/**
+  ******************************************************************************
+  * @file       NdefNfcTagM24LR.cpp
+  * @author     AMG Central Lab
+  * @version    V1.0.0
+  * @date       30 Aug 2016
+  * @brief      Wrapper class of the NDefLib library to write/read NDEF messages.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+  *
+  * Redistribution and use in source and binary forms, with or without modification,
+  * are permitted provided that the following conditions are met:
+  *   1. Redistributions of source code must retain the above copyright notice,
+  *      this list of conditions and the following disclaimer.
+  *   2. Redistributions in binary form must reproduce the above copyright notice,
+  *      this list of conditions and the following disclaimer in the documentation
+  *      and/or other materials provided with the distribution.
+  *   3. Neither the name of STMicroelectronics nor the names of its contributors
+  *      may be used to endorse or promote products derived from this software
+  *      without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  *
+  ******************************************************************************
+  */
+
+
+#include <cmath>
+
+#include "NDefNfcTagM24LR.h"
+
+
+/* wait 1sec, driver is configured to let 200ms for command to complete */
+/* which is enough for all commands except GetSession if RF session is already opened */
+/* Smartphone generally releases the session within the second, anyway the user can modify this value */
+#define OPENSESSION_NTRIALS 5
+
+#define CC_FILE_LENGTH_BYTE 15
+
+
+/**
+  * @brief  This function read the data stored in NDEF file at defined offset.
+  * @param  Offset : Offset in the NDEF file.
+  * @param  DataSize : Number of byte to read.
+  * @param  pData : pointer on buffer to store read data.
+  * @retval NDEF_ERROR_MEMORY_INTERNAL : Size not compatible with memory.
+  * @retval NDEF_ERROR_NOT_FORMATED : CCFile data not supported.
+  * @retval NDEF_ERROR : No NDEF in the tag.
+  * @retval NDEF_OK : The operation is completed.
+  */
+uint16_t  NDefNfcTagM24LR::ReadData( uint16_t Offset , uint16_t DataSize , uint8_t* pData )
+{
+  uint16_t status = NDEF_ERROR;
+  uint8_t atlv_detect[4];
+  uint8_t index = 0;
+  
+  /* Do not include length bytes */
+  DataSize -= FIRST_RECORD_OFFSET;
+  
+  /* If too many data to write return error */
+  if( DataSize > NDEF_MAX_SIZE )
+  {
+    return NDEF_ERROR_MEMORY_INTERNAL;
+  }
+  
+  /* Detect NDEF message in memory */
+  status = NfcType5_NDEFDetection( );
+  if( status != NDEF_OK )
+  {
+    return status;
+  }
+
+  /* Read TL of Type 5 */
+  status = NDefReadByte(CCFileStruct.NDEF_offset, 4, atlv_detect);
+  if( status != NDEF_OK )
+  {
+    return status;
+  }
+  
+  /* Check if L is on 3 or 1 byte and update length in buffer */
+  if( atlv_detect[1] == NFCT5_3_BYTES_L_TLV )
+  {
+    pData[0] = atlv_detect[2];
+    pData[1] = atlv_detect[3];
+    index += 4;
+  }
+  else
+  {
+    pData[0] = 0x00;
+    pData[1] = atlv_detect[1];
+    index += 2;
+  }
+  
+  /* Check CC file is in the correct mode to proceed */
+  if( CCFileStruct.State ==  TT5_INITIALIZED )
+  {
+    return NDEF_ERROR;
+  }
+
+  if( ((Offset == 0) && (DataSize > 0)) || (Offset > 0) )
+  {
+    /* Read NDEF */
+    if( NDefReadByte(CCFileStruct.NDEF_offset + index + Offset, DataSize, (pData + FIRST_RECORD_OFFSET)) != NFC_OK )
+    {
+      return NDEF_ERROR;
+    }
+  }
+  
+  return NDEF_OK;
+}
+
+/**
+  * @brief  This function writes data in NDEF file at defined offset.
+  * @param  Offset : Offset in the NDEF file.
+  * @param  DataSize : Number of byte to write.
+  * @param  pData : pointer on buffer to copy.
+  * @retval NDEF_ERROR_MEMORY_INTERNAL : Size not compatible with memory.
+  * @retval NDEF_ERROR_NOT_FORMATED : CCFile data not supported.
+  * @retval NDEF_ERROR : No NDEF in the tag.
+  * @retval NDEF_OK : The operation is completed.
+  */
+uint16_t NDefNfcTagM24LR::WriteData( uint16_t Offset , uint32_t DataSize , uint8_t *pData )
+{
+  uint8_t atlv[4];
+  uint8_t index = 0;
+  uint16_t NDEF_Size = 0;
+  bool status;
+
+  /* Do not include length bytes */
+  DataSize -= FIRST_RECORD_OFFSET;
+  
+  /* If too many data to write return error */
+  if( DataSize > NDEF_MAX_SIZE )
+  {
+    return NDEF_ERROR_MEMORY_INTERNAL;
+  }
+  
+  /* Detect NDEF message in memory */
+  if( NfcType5_NDEFDetection( ) != NDEF_OK )
+  {
+    return NDEF_ERROR;
+  }
+ 
+  /* Extract NDEF Size from buffer */
+  NDEF_Size = (uint16_t)(pData[0] << 8);
+  NDEF_Size = NDEF_Size | (uint16_t)(pData[1] );
+  
+  /* If entire NDEF is written, update Length of Type 5 */
+  if( DataSize == NDEF_Size )
+  {
+    /* Check if L is on 3 or 1 byte */
+    if( NDEF_Size >= NFCT5_3_BYTES_L_TLV )
+    {
+      /* First init L with 0, will be updated at the end */
+      atlv[1] = 0x00;
+      atlv[2] = 0x00;
+      atlv[3] = 0x00;
+      
+      status = NDefWriteByte( (atlv + 1), 3, (CCFileStruct.NDEF_offset + 1));
+      
+      index += 4; 
+    }
+    else
+    {
+      /* First inti L with 0, will be updated at the end */
+      atlv[1] = 0x00;
+      
+      status = NDefWriteByte( (atlv + 1), 1, (CCFileStruct.NDEF_offset + 1));
+      
+      index += 2;
+    }
+  }
+  
+  /* Start write NDEF message to EEPROM */
+  status = NDefWriteByte( (pData + FIRST_RECORD_OFFSET), DataSize, CCFileStruct.NDEF_offset + index + Offset);
+  if( status != NFC_OK )
+  {
+    return NDEF_ERROR;
+  }
+  
+  /* If entire NDEF is written, update Length of Type 5 */
+  if( DataSize == NDEF_Size )
+  {
+    /* Check if L is on 3 or 1 byte */
+    if( NDEF_Size >= NFCT5_3_BYTES_L_TLV )
+    {
+      /* Update Length value */
+      atlv[1] = NFCT5_3_BYTES_L_TLV;
+      atlv[2] = pData[0];
+      atlv[3] = pData[1];
+      
+      status = NDefWriteByte( (atlv + 1), 3, (CCFileStruct.NDEF_offset + 1));
+    }
+    else
+    {
+      /* Update Length value */
+      atlv[1] = pData[1];
+      
+      status = NDefWriteByte( (atlv + 1), 1, (CCFileStruct.NDEF_offset + 1));
+    }
+
+    /* Write Terminator TLV */
+    atlv[0] = NFCT5_TERMINATOR_TLV;
+    status = NDefWriteByte( atlv, 1, CCFileStruct.NDEF_offset + index + NDEF_Size);
+  }
+  
+  return NDEF_OK;
+}
+
+/**
+  * @brief  This functions writes CCFile in EEPROM.
+  * @Param  pCCBuffer : pointer on the buffer containnig CC file.
+  * @retval NFCTAG status.
+  */
+uint16_t NDefNfcTagM24LR::NfcType5_WriteCCFile( const uint8_t * const pCCBuffer )
+{
+  bool ret_value;
+  
+  /* Write first block of CCFile */
+  ret_value = NDefWriteByte( pCCBuffer, 0x4, 0x00);
+ 
+  /* If extended memory writes the next 4 bytes */
+  if( (pCCBuffer[2] == 0x00) && (ret_value == NFC_OK) )
+  {
+    ret_value = NDefWriteByte( pCCBuffer + 4, 4, 0x04);
+  }
+
+  if( ret_value != NFC_OK )
+  {
+    return NDEF_ERROR;
+  }
+  
+    return NDEF_OK;
+}
+
+
+
+
+uint16_t NDefNfcTagM24LR::NfcType5_ReadCCFile( uint8_t * const pCCBuffer )
+{
+  bool ret_value;
+  
+  /* Read 4 bytes of CC File */
+  ret_value = NDefReadByte(0x00, 4, pCCBuffer);
+
+  /* If extended memory reads the next 4 bytes */
+  if( (pCCBuffer[2] == 0x00) && (ret_value == NFC_OK) )
+  {
+    ret_value = NDefReadByte(0x04, 4, pCCBuffer + 4 );
+  }
+  
+  if( ret_value != NFC_OK )
+  {
+    return NDEF_ERROR;
+  }
+  
+  return NDEF_OK;
+}
+uint16_t NDefNfcTagM24LR::NfcType5_TT5Init( void )
+{
+  bool ret_value = NFC_OK;
+  uint16_t status;
+  uint8_t accbuffer[8];
+  uint8_t cdata;
+
+  /* Prepare buffer to update CCFile */
+  accbuffer[0] = CCFileStruct.MagicNumber;
+  accbuffer[1] = CCFileStruct.Version;
+  accbuffer[2] = CCFileStruct.MemorySize;
+  accbuffer[3] = CCFileStruct.TT5Tag;
+  CCFileStruct.NDEF_offset = 0x04;
+  
+  /* If extended memory prepare the length bytes */
+  if( CCFileStruct.MemorySize == NFCT5_EXTENDED_CCFILE )
+  {
+    accbuffer[6] = (uint8_t)(CCFileStruct.ExtMemorySize >> 8);
+    accbuffer[7] = (uint8_t)(CCFileStruct.ExtMemorySize & 0xFF);
+    CCFileStruct.NDEF_offset = 0x08;
+  }
+  
+  /* Update CCFile */
+  status = NfcType5_WriteCCFile( accbuffer );
+  if( status != NDEF_OK )
+  {
+    return status;
+  }
+  
+  /* Update NDEF TLV for INITIALIZED state */
+  /* Update T */
+  cdata = NFCT5_NDEF_MSG_TLV;
+  ret_value = NDefWriteByte( &cdata, 1, CCFileStruct.NDEF_offset);
+  if( ret_value != NFC_OK )
+  {
+    return NDEF_ERROR;
+  }
+
+  /* Update L */
+  cdata = 0x00;
+  ret_value = NDefWriteByte( &cdata, 1, (CCFileStruct.NDEF_offset + 1));
+  if( ret_value != NFC_OK )
+  {
+    return NDEF_ERROR;
+  }
+  
+  return NDEF_OK;
+}
+
+
+uint16_t NDefNfcTagM24LR::NfcType5_NDEFDetection( void )
+{
+  uint8_t acc_buffer[8];
+  uint8_t atlv_detect[4];
+  uint16_t status;
+  uint32_t memory_size;
+  
+  CCFileStruct.State = TT5_NO_NDEF;
+  
+  /* Read CCFile */
+  status = NfcType5_ReadCCFile( acc_buffer );
+  if( status != NDEF_OK )
+  {
+    return status;
+  }
+  
+  /* Check Byte 0 is equal to magic number */
+  if( ( acc_buffer[0] != NFCT5_MAGICNUMBER_E1_CCFILE ) && ( acc_buffer[0] != NFCT5_MAGICNUMBER_E2_CCFILE ) )
+  {
+    return NDEF_ERROR_NOT_FORMATED;
+  }
+  /* Check Version number */
+  else if( ( (acc_buffer[1]&0xFC) != 0x40 ) )
+  {
+    return NDEF_ERROR_NOT_FORMATED;
+  }
+  
+  /* Check if CCFile is on 4 Bytes or 8 Bytes */
+  if( acc_buffer[2] == 0x00 )
+  {
+    /* Update CCFIle structure */
+    CCFileStruct.MemorySize = 0x0;
+    CCFileStruct.ExtMemorySize = (uint16_t)acc_buffer[6];
+    CCFileStruct.ExtMemorySize = ( CCFileStruct.ExtMemorySize << 8 ) |  acc_buffer[7];
+    memory_size = CCFileStruct.ExtMemorySize;
+    CCFileStruct.NDEF_offset = 8;
+  }
+  else
+  {
+    /* Update CCFIle structure */
+    CCFileStruct.MemorySize = acc_buffer[2];
+    CCFileStruct.ExtMemorySize = 0x0;
+    memory_size = CCFileStruct.MemorySize;
+    CCFileStruct.NDEF_offset = 4;
+  }
+  
+  /* Update CCFIle structure */
+  CCFileStruct.MagicNumber = acc_buffer[0];
+  CCFileStruct.Version = acc_buffer[1];
+  CCFileStruct.TT5Tag = acc_buffer[3];
+  
+  /* Search for position of NDEF TLV in memory and tag status */
+  while( ( NDefReadByte(CCFileStruct.NDEF_offset, 4, atlv_detect) == NFC_OK ) && ( CCFileStruct.NDEF_offset < memory_size ) )
+  {
+    /* Detect first NDEF Message in memory */
+    if( atlv_detect[0] == NFCT5_NDEF_MSG_TLV )
+    {
+      if( atlv_detect[1] == 0x00 )
+      {
+        CCFileStruct.State = TT5_INITIALIZED;
+      }
+      else
+      {
+        if( CCFileStruct.Version & 0x3 )
+        {
+          CCFileStruct.State = TT5_READ;
+        }
+        else
+        {
+          CCFileStruct.State = TT5_READ_WRITE;
+        }
+      }
+      return NDEF_OK;
+    }
+    /* If Proprietary NDEF jump to end of proprietary message */
+    else if( atlv_detect[0] == NFCT5_PROPRIETARY_TLV )
+    {
+      if( atlv_detect[1] == NFCT5_3_BYTES_L_TLV )
+      {
+        CCFileStruct.NDEF_offset = CCFileStruct.NDEF_offset + ( (uint32_t)atlv_detect[2] << 8 ) + atlv_detect[3];
+        continue;
+      }
+      else
+      {
+        CCFileStruct.NDEF_offset = CCFileStruct.NDEF_offset + atlv_detect[1];
+        continue;
+      }
+    }
+    /* if Terminator no NDEF detected */
+    else if( atlv_detect[0] == NFCT5_TERMINATOR_TLV )
+    {
+      return NDEF_ERROR_NOT_FORMATED;
+    }
+      
+    CCFileStruct.NDEF_offset++;
+  }
+  
+  return NDEF_ERROR_NOT_FORMATED;
+}
+
+bool NDefNfcTagM24LR::openSession(bool force) {
+bool status;
+//  if (isSessionOpen()){
+//      mCallBack->onSessionOpen(this,true);
+//      return true;
+//  }
+//
+//  mDevice.SetCallback(&mOpenSessionCallback);
+//  if(force)
+//      return mDevice.ForceGetSession() == NFC_SUCCESS;
+//  else
+//      return mDevice.GetSession() == NFC_SUCCESS;
+
+      status = NfcType5_NDEFDetection();
+      if ( status != NFC_SUCCESS )
+      {
+        CCFileStruct.MagicNumber = NFCT5_MAGICNUMBER_E1_CCFILE;
+      CCFileStruct.Version = NFCT5_VERSION_V1_0;
+      CCFileStruct.MemorySize = ( M24LR_MAX_SIZE / 8 ) & 0xFF;
+      CCFileStruct.TT5Tag = 0x05;
+      /* Init of the Type Tag 5 component (M24LR) */
+      while( NfcType5_TT5Init( ) != NFC_OK );
+      }
+      mIsSessionOpen = 1;
+      return NFC_SUCCESS;
+
+}
+
+bool NDefNfcTagM24LR::closeSession() {
+    
+    return NFC_SUCCESS;
+}
+bool NDefNfcTagM24LR::writeByte(const uint8_t *buffer, uint16_t length,uint16_t offset,
+        byteOperationCallback_t callback,CallbackStatus_t *callbackStatus){
+                  return WriteData(offset + FIRST_RECORD_OFFSET, length, (uint8_t*)buffer);
+                }
+bool NDefNfcTagM24LR::readByte(const uint16_t byteOffset, const uint16_t length,
+        uint8_t *buffer, byteOperationCallback_t callback,CallbackStatus_t *callbackStatus){
+                  return ReadData(byteOffset, length, (uint8_t*)buffer);
+                }
+
+bool NDefNfcTagM24LR::NDefWriteByte(const uint8_t *buffer, uint16_t length,uint16_t offset){
+      return mDevice.UpdateBinary(offset, length, (uint8_t*)buffer);
+}
+
+
+bool NDefNfcTagM24LR::NDefReadByte(const uint16_t byteOffset, const uint16_t length, uint8_t *buffer){
+  return mDevice.ReadBinary(byteOffset, length, (uint8_t*)buffer);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/X_NUCLEO_NFC02A1/m24lr/NDefNfcTagM24LR.h	Tue Aug 30 09:18:50 2016 +0000
@@ -0,0 +1,189 @@
+/**
+  ******************************************************************************
+  * @file       NdefNfcTagM24LR.h
+  * @author     AMG Central Lab
+  * @version    V1.0.0
+  * @date       30 Aug 2016
+  * @brief      M24LR specific NDefLib derived class
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * Redistribution and use in source and binary forms, with or without modification,
+  * are permitted provided that the following conditions are met:
+  *   1. Redistributions of source code must retain the above copyright notice,
+  *      this list of conditions and the following disclaimer.
+  *   2. Redistributions in binary form must reproduce the above copyright notice,
+  *      this list of conditions and the following disclaimer in the documentation
+  *      and/or other materials provided with the distribution.
+  *   3. Neither the name of STMicroelectronics nor the names of its contributors
+  *      may be used to endorse or promote products derived from this software
+  *      without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  *
+  ******************************************************************************
+  */
+
+#ifndef X_NUCLEO_NFC02A1_M24LR_NDEFNFCTAGM24LR_H_
+#define X_NUCLEO_NFC02A1_M24LR_NDEFNFCTAGM24LR_H_
+
+#include <cstdlib>
+#include <stdint.h>
+
+#include "NDefNfcTag.h"
+#include "Nfc_class.h"
+
+//#include "m24lr.h"
+
+#define NFCT5_MAGICNUMBER_E1_CCFILE       0xE1
+#define NFCT5_MAGICNUMBER_E2_CCFILE       0xE2
+#define NFCT5_EXTENDED_CCFILE             0xFF
+#define NFCT5_VERSION_V1_0                0x40
+#define NFCT5_READ_ACCESS                 0x0C
+#define NFCT5_WRITE_ACCESS                0x03
+
+#define NFCT5_NDEF_MSG_TLV                0x03
+#define NFCT5_PROPRIETARY_TLV             0xFD
+#define NFCT5_TERMINATOR_TLV              0xFE
+#define NFCT5_3_BYTES_L_TLV               0xFF
+    
+#define NFC_OK                   0
+#define NDEF_OK                     0
+#define NDEF_ERROR                  1
+#define NDEF_ERROR_MEMORY_TAG       2
+#define NDEF_ERROR_MEMORY_INTERNAL  3
+#define NDEF_ERROR_LOCKED           4
+#define NDEF_ERROR_NOT_FORMATED     5
+
+#define NDEF_MAX_SIZE               NFC_DEVICE_MAX_NDEFMEMORY
+
+#define NDEF_SIZE_OFFSET            0
+#define FIRST_RECORD_OFFSET         2
+
+#ifndef MIN
+#define MIN(x, y) (((x) < (y)) ? (x) : (y))
+#endif
+
+#define NFCTAG_4M_SIZE            0x200
+#define NFCTAG_16M_SIZE           0x800
+#define NFCTAG_64M_SIZE           0x2000
+
+    
+#define MAX_NDEF_MEM                 0x200
+#define M24LR_MAX_SIZE               NFCTAG_4M_SIZE
+#define M24LR_NDEF_MAX_SIZE          MIN(M24LR_MAX_SIZE,MAX_NDEF_MEM)
+#define NFC_DEVICE_MAX_NDEFMEMORY    M24LR_NDEF_MAX_SIZE
+    
+
+
+typedef enum
+{
+  TT5_NO_NDEF = 0,
+  TT5_INITIALIZED,
+  TT5_READ_WRITE,
+  TT5_READ
+} TT5_State;
+
+/**
+  * @brief  CCfile structure
+  */
+typedef struct
+{
+  uint8_t MagicNumber;  /* Magic Number should be E1h or E2h */
+  uint8_t Version;
+  uint8_t MemorySize;
+  uint8_t TT5Tag;
+  uint8_t rsved1;
+  uint8_t rsved2;
+  uint16_t ExtMemorySize;
+  TT5_State State;
+  uint32_t NDEF_offset;
+}sCCFileInfo;
+
+
+/**
+ * Helper class to use the NDefLib
+ */
+
+
+class NDefNfcTagM24LR: public NDefLib::NDefNfcTag {
+
+public:
+
+    /**
+     *
+     * @param device device to use
+     */
+    NDefNfcTagM24LR(Nfc &device) :
+        NDefLib::NDefNfcTag(),
+        mDevice(device),mIsSessionOpen(false),
+        mMaxReadBytes(0xFF), mMaxWriteBytes(0xFF){}
+
+    virtual bool openSession(bool force = false);
+
+    virtual bool closeSession();
+
+    virtual bool isSessionOpen(){
+        return mIsSessionOpen;
+    }
+        uint16_t ReadData( uint16_t Offset , uint16_t DataSize , uint8_t* pData );
+        uint16_t WriteData( uint16_t Offset , uint32_t DataSize , uint8_t *pData );
+        uint16_t NfcType5_WriteCCFile( const uint8_t * const pCCBuffer );
+        uint16_t NfcType5_ReadCCFile( uint8_t * const pCCBuffer );
+        uint16_t NfcType5_TT5Init( void );
+        uint16_t NfcType5_NDEFDetection( void );
+    /**
+    * Close the open session.
+    */
+    virtual ~NDefNfcTagM24LR(){
+        if(isSessionOpen())
+            closeSession();
+    }//~NDefNfcTagM24SR
+
+    protected:
+
+        virtual bool writeByte(const uint8_t *buffer, uint16_t length,uint16_t offset,
+                byteOperationCallback_t callback,CallbackStatus_t *callbackStatus);
+
+        virtual bool readByte(const uint16_t byteOffset, const uint16_t byteLength,
+                uint8_t *buffer, byteOperationCallback_t callback,CallbackStatus_t *callbackStatus);
+                bool NDefWriteByte(const uint8_t *buffer, uint16_t length,uint16_t offset);
+
+
+                bool NDefReadByte(const uint16_t byteOffset, const uint16_t length, uint8_t *buffer);
+
+    private:
+
+        Nfc &mDevice;
+
+        /**
+         * true if the session is open
+         */
+        bool mIsSessionOpen;
+
+        /**
+        * Max length for a read operation
+        */
+        uint16_t mMaxReadBytes;
+
+        /**
+        * Max length for a write operation
+        */
+        uint16_t mMaxWriteBytes;
+                
+                sCCFileInfo CCFileStruct;
+
+    };
+
+#endif /* X_NUCLEO_NFC02A1_M24LR_NDEFNFCTAGM24LR_H_ */
--- a/X_NUCLEO_NFC02A1/m24lr/m24lr.cpp	Wed Jul 27 09:25:33 2016 +0000
+++ b/X_NUCLEO_NFC02A1/m24lr/m24lr.cpp	Tue Aug 30 09:18:50 2016 +0000
@@ -1,3 +1,42 @@
+/**
+  ******************************************************************************
+  * @file       m24lr.cpp
+  * @author     AMG Central Lab
+  * @version    V1.0.0
+  * @date       30 Aug 2016
+  * @brief      M24LR driver file.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * Redistribution and use in source and binary forms, with or without modification,
+  * are permitted provided that the following conditions are met:
+  *   1. Redistributions of source code must retain the above copyright notice,
+  *      this list of conditions and the following disclaimer.
+  *   2. Redistributions in binary form must reproduce the above copyright notice,
+  *      this list of conditions and the following disclaimer in the documentation
+  *      and/or other materials provided with the distribution.
+  *   3. Neither the name of STMicroelectronics nor the names of its contributors
+  *      may be used to endorse or promote products derived from this software
+  *      without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  *
+  ******************************************************************************
+  */
+
+
+
 #include "m24lr.h"
 
 uint8_t M24LR::NfctagInitialized = 0; 
@@ -31,13 +70,13 @@
   {
     
     /* M24LR Init */
-    if( i2c_Init() != NFCTAG_OK )
+   if( i2c_Init() != NFCTAG_OK )
     {
       return NFCTAG_ERROR;
     }
     
     /* Check M24LR driver ID */
-    i2c_ReadID(&nfctag_id);
+   i2c_ReadID(&nfctag_id);
     if( (nfctag_id == I_AM_M24LR04) || (nfctag_id == I_AM_M24LR16) || (nfctag_id == I_AM_M24LR64) )
     {
       NfctagInitialized = 1;
--- a/X_NUCLEO_NFC02A1/m24lr/m24lr.h	Wed Jul 27 09:25:33 2016 +0000
+++ b/X_NUCLEO_NFC02A1/m24lr/m24lr.h	Tue Aug 30 09:18:50 2016 +0000
@@ -1,8 +1,50 @@
+/**
+  ******************************************************************************
+  * @file       m24lr.h
+  * @author     AMG Central Lab
+  * @version    V1.0.0
+  * @date       30 Aug 2016
+  * @brief      header file for M24LR driver .
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+  *
+  * Redistribution and use in source and binary forms, with or without modification,
+  * are permitted provided that the following conditions are met:
+  *   1. Redistributions of source code must retain the above copyright notice,
+  *      this list of conditions and the following disclaimer.
+  *   2. Redistributions in binary form must reproduce the above copyright notice,
+  *      this list of conditions and the following disclaimer in the documentation
+  *      and/or other materials provided with the distribution.
+  *   3. Neither the name of STMicroelectronics nor the names of its contributors
+  *      may be used to endorse or promote products derived from this software
+  *      without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  *
+  ******************************************************************************
+  */
+
+
 #ifndef __M24LR_H
 #define __M24LR_H
 
 #include "common.h"
 #include "DevI2C.h"
+#include "Nfc_class.h"
+#include "NDefNfcTag.h"
+#include "NDefNfcTagM24LR.h"
+
 //#include "lib_NDEF_URI.h"
   /* Exported constants --------------------------------------------------------*/
 /** @defgroup M24LR_Exported_Constants
@@ -51,7 +93,8 @@
 #define M24LR_CTRL_EHEN_MASK    0x01
 #define M24LR_CTRL_FIELD_MASK   0x02
 #define M24LR_CTRL_TPROG_MASK   0x80
-  
+
+
  
 /**
  * @brief  M24LR VOUT Configuration enumerator definition
@@ -157,7 +200,7 @@
   * @}
   */
   
-class   M24LR {
+class   M24LR : public Nfc {
 public:
     NFCTAG_StatusTypeDef i2c_Init( void );
     NFCTAG_StatusTypeDef i2c_ReadID( uint8_t * const pICRef );
@@ -199,25 +242,248 @@
     void Enable_EnergyHarvesting( void );
     NFCTAG_StatusTypeDef Initialization( void );
     
+    virtual NFC_StatusTypeDef ReadBinary(uint16_t Offset, uint8_t NbByteToRead,
+            uint8_t *pBufferRead) {
+           return  (NFC_StatusTypeDef) i2c_ReadData( pBufferRead, Offset, NbByteToRead );
+        
+    }
+
+   virtual NFC_StatusTypeDef UpdateBinary(uint16_t Offset,
+            uint8_t NbByteToWrite,uint8_t *pDataToWrite) {
+          return (NFC_StatusTypeDef) i2c_WriteData( pDataToWrite, Offset, NbByteToWrite );
+    }
+    
     M24LR(uint8_t const address, uint8_t const addressData, DevI2C &devI2C ):
-      i2c_address_syst(address), i2c_address_data(addressData), dev_I2C(devI2C) {}
+      NDefTagUtil(*this), i2c_address_syst(address), i2c_address_data(addressData), dev_I2C(devI2C) {}
     
    static uint8_t NfctagInitialized;
-  //  M24LR_IO mM24LR_IO;
+   
+   friend class NDEF_URI;
+   
+    /*
+     * Object implementing the interface to use the NDefLib.
+     */
+   NDefNfcTagM24LR NDefTagUtil;
+   
    uint8_t i2c_address_syst;
-   
    uint8_t i2c_address_data;
    DevI2C dev_I2C;
-   friend class NDEF_URI;
-   //NDEF_URI mM24LR_URI;
-   //M24LR *ptr;
-//   ReadFnDataPtr i2c_ReadData;
-//   WriteFnDataPtr i2c_WriteData;
-                                
+   
+   NDefLib::NDefNfcTag& getNDefTag(){
+      return NDefTagUtil;
+  }
+  
+  // Not Required from Nfc Class
+  /**
+     * Open a I2C connection with the tag if an RF connection isn't already open.
+     * @return operation status
+     */
+  virtual NFC_StatusTypeDef GetSession(void){
+    return(NFC_SUCCESS);
+  }
+    
+    /**
+     * Force to open an I2C connection , abort the RF connection.
+     * @return NFC_SUCCESS if the session is acquired
+     */
+  virtual NFC_StatusTypeDef ForceGetSession(void){
+     return(NFC_SUCCESS);
+  }
+
+    /**
+     * Close an I2C connection.
+     * @return NFC_SUCCESS if the session is release
+     */
+  virtual NFC_StatusTypeDef Deselect(void){
+     return(NFC_SUCCESS);
+  }
+
+    /**
+     * Select the application file.
+     * @return NFC_SUCCESS if the application is selected
+     */
+   virtual NFC_StatusTypeDef SelectApplication(void){
+      return(NFC_SUCCESS);
+   }
+
+    /**
+     * Select the CC file.
+     * @return NFC_SUCCESS if the CC file is selected.
+     */
+   virtual NFC_StatusTypeDef SelectCCfile(void){
+      return(NFC_SUCCESS);
+   }
+
+    /**
+     * Select the NDEF file.
+     * @param NDEFfileId File id to open.
+     * @return NFC_SUCCESS if the file is selected
+     */
+   virtual NFC_StatusTypeDef SelectNDEFfile(uint16_t NDEFfileId){
+     (void)NDEFfileId;
+      return(NFC_SUCCESS);
+   }
+
+    /**
+     * Select the system file.
+     * @return NFC_SUCCESS if the system file is selected
+     */
+   virtual NFC_StatusTypeDef SelectSystemfile(void){
+      return(NFC_SUCCESS);
+        }
+
+
+
+
+
+    /**
+     * Check that the password is correct.
+     * @param uPwdId Password type.
+     * @param NbPwdByte Password size ( must be 0x10).
+     * @param pPwd Password buffer.
+     * @return NFC_SUCCESS if no errors and write/read permission granted
+     */
+   virtual NFC_StatusTypeDef Verify(PasswordType_t uPwdId, uint8_t NbPwdByte,const uint8_t *pPwd){
+     (void)uPwdId; (void)NbPwdByte; (void)pPwd;
+      return(NFC_SUCCESS);
+   }
+
+    /**
+     * Replace the read or write password.
+     * @param uPwdId Password to change.
+     * @param pPwd New password.
+     * @return NFC_SUCCESS if no errors
+     */
+   virtual NFC_StatusTypeDef ChangeReferenceData(PasswordType_t uPwdId,const uint8_t *pPwd){
+     (void)uPwdId;  (void)pPwd;
+      return(NFC_SUCCESS);
+   }
+    
+    /**
+     *  Activate NDEF file password protection.
+     *  When this command is successful, read or write access to the NDEF file is protected by a 128-bit password.
+     *  @param uReadOrWrite Read or write password.
+     *  @return NFC_SUCCESS if no errors
+     */
+   virtual NFC_StatusTypeDef EnableVerificationRequirement(PasswordType_t uReadOrWrite){
+     (void)uReadOrWrite;
+      return(NFC_SUCCESS);
+   }
+    
+    /**
+     * Deactivate NDEF file password protection.
+     * When this command is successful, read or write access to the NDEF file is granted.
+     * with no security enforcement.
+     * @param uReadOrWrite Read or write password.
+     * @return NFC_SUCCESS if no errors
+     */     
+   virtual NFC_StatusTypeDef DisableVerificationRequirement(PasswordType_t uReadOrWrite){
+     (void)uReadOrWrite;
+      return(NFC_SUCCESS);
+   }
+    
+    /**
+     * Same as {@link NFC#ReadBinary}, however permitting to read more bytes than available.
+     * @param Offset read offset.
+     * @param NbByteToRead Number of bytes to read.
+     * @param[out] pBufferRead Buffer to store the read data into.
+     * @return NFC_SUCCESS if no errors
+     */
+   virtual NFC_StatusTypeDef STReadBinary(uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead){
+     (void)Offset; (void)NbByteToRead; (void)pBufferRead;
+      return(NFC_SUCCESS);
+   }
+    
+    /**
+     * Set the tag as read/write only, stored in the eeprom.
+     * @param  uReadOrWrite ReadPwd if write only, WritePwd if read only.
+     * @return NFC_SUCCESS if no errors
+     */
+   virtual NFC_StatusTypeDef EnablePermanentState(PasswordType_t uReadOrWrite){
+     (void)uReadOrWrite;
+      return(NFC_SUCCESS);
+   }
+    
+    /**
+     * Unset the tag as read/write only, stored in the eeprom.
+     * @param  uReadOrWrite ReadPwd if write only, WritePwd if read only.
+     * @return NFC_SUCCESS if no errors
+     * @par Caller must have I2Csuper user permissions to call this function.
+     */
+   virtual NFC_StatusTypeDef DisablePermanentState(PasswordType_t uReadOrWrite){
+     (void)uReadOrWrite;
+      return(NFC_SUCCESS);
+   }
+    
+    /**
+     * Set the gpo output pin.
+     * @param uSetOrReset New pin status.
+     * @return NFC_SUCCESS if no errors
+     */
+   virtual NFC_StatusTypeDef StateControl(uint8_t uSetOrReset){
+     (void)uSetOrReset;
+      return(NFC_SUCCESS);
+   }
+    
+    /**
+     * @brief  This function configures GPO for I2C session.
+     * @param  GPO_I2Cconfig GPO configuration to set.
+     * @return NFC_SUCCESS if no errors
+     * @par if the configuration is I2C_ANSWER_READY, the component will start to work
+     * in async mode.
+     */
+   virtual NFC_StatusTypeDef ManageI2CGPO(NFC_GPO_MGMT GPO_I2Cconfig){
+     (void)GPO_I2Cconfig;
+      return(NFC_SUCCESS);
+   }
+    
+    /**
+    * @brief  This function configures GPO for RF session.
+    * @param  GPO_RFconfig GPO configuration to set.
+    * @return NFC_SUCCESS if no errors
+    */
+   virtual NFC_StatusTypeDef ManageRFGPO(uint8_t GPO_RFconfig){
+     (void)GPO_RFconfig;
+      return(NFC_SUCCESS);
+   }
+    
+    /**
+     * @brief  This function enables or disables the RF communication.
+     * @param  OnOffChoice GPO configuration to set.
+     * @return NFC_SUCCESS if no errors
+     */
+   virtual NFC_StatusTypeDef RFConfig(uint8_t OnOffChoice){
+     (void)OnOffChoice;
+      return(NFC_SUCCESS);
+   }
+
+    /**
+     * Generates a negative pulse on the GPO pin.
+     * Pulse starts immediately after the command is issued and ends at the end of the RF response.
+     * @return NFC_SUCCESS if no errors
+     */
+    virtual NFC_StatusTypeDef SendInterrupt(void){
+           return(NFC_SUCCESS);
+        }
+
+   virtual NFC_StatusTypeDef ManageEvent(){
+      return(NFC_SUCCESS);
+   }
+   
+   virtual int Init(void *ptr) {
+                (void)ptr;
+        return (NFC_StatusTypeDef) i2c_Init();
+                 //return(NFC_SUCCESS);
+    }
+
+  virtual int ReadID(uint8_t *id) {
+        return (NFC_StatusTypeDef) i2c_ReadID(id);
+    // return(NFC_SUCCESS);
+    }
+  
 };
   
   
 
   
 #endif /* __M24LR_H */
-
--- a/main.cpp	Wed Jul 27 09:25:33 2016 +0000
+++ b/main.cpp	Tue Aug 30 09:18:50 2016 +0000
@@ -1,14 +1,14 @@
 /**
   ******************************************************************************
   * @file       main.cpp
-  * @author     ST Central Labs
+  * @author     AMG Central Lab
   * @version    V1.0.0
-  * @date       21 Dic 2015
+  * @date       30 Aug 2016
   * @brief      This demo writes an ndef message with an url inside.
   ******************************************************************************
   * @attention
   *
-  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
   *
   * Redistribution and use in source and binary forms, with or without modification,
   * are permitted provided that the following conditions are met:
@@ -40,17 +40,15 @@
 #include "X_NUCLEO_NFC02A1.h"
 #include "DevI2C.h"
 #include "m24lr.h"
-#include "lib_NDEF_URI.h"
+
+#include "NDefLib/NDefNfcTag.h"
+#include "NDefLib/RecordType/RecordURI.h"
 /**
  * Write a Ndef URI message linking to st.com site.
  */
 int main(void)
 {
   
-  sURI_Info URI;
-  NDEF_URI mNDEF_URI;
-  M24LR *mM24LRp;
-  
   /*use default board pinout*/
   DevI2C i2cChannel(X_NUCLEO_NFC02A1::DEFAULT_SDA_PIN,X_NUCLEO_NFC02A1::DEFAULT_SDL_PIN);
   X_NUCLEO_NFC02A1 *nfcNucleo = X_NUCLEO_NFC02A1::Instance(i2cChannel,
@@ -58,38 +56,51 @@
                                                            X_NUCLEO_NFC02A1::DEFAULT_LED1_PIN,X_NUCLEO_NFC02A1::DEFAULT_LED2_PIN,
                                                            X_NUCLEO_NFC02A1::DEFAULT_LED3_PIN);
   
-  mM24LRp = nfcNucleo->getM24LR();
-  mNDEF_URI.setM24LR(mM24LRp);
+ NDefLib::NDefNfcTag& tag =nfcNucleo->getM24LR().getNDefTag();
+ M24LR & mM24LRp = nfcNucleo->getM24LR();
+ // mNDEF_URI.setM24LR(mM24LRp);
   /* Enable Energy Harvesting */
-  mM24LRp->Enable_EnergyHarvesting();
+  mM24LRp.Enable_EnergyHarvesting();
   
   printf("System Initialization done: !\n\r");
   
-  /* Check if no NDEF detected, init mem in Tag Type 5 */
-  if( mNDEF_URI.NfcType5_NDEFDetection() != NDEF_OK)
-  {
-    mNDEF_URI.CCFileStruct.MagicNumber = NFCT5_MAGICNUMBER_E1_CCFILE;
-    mNDEF_URI.CCFileStruct.Version = NFCT5_VERSION_V1_0;
-    mNDEF_URI.CCFileStruct.MemorySize = ( M24LR_MAX_SIZE / 8 ) & 0xFF;
-    mNDEF_URI.CCFileStruct.TT5Tag = 0x05;
-    
-    /* Init of the Type Tag 5 component (M24LR) */
-    while( mNDEF_URI.NfcType5_TT5Init( ) != NFCTAG_OK);
-  }
+  //open the i2c session with the nfc chip
+    if(tag.openSession())
+    {
+        printf("Session opened\n\r");
+        nfcNucleo->getLed1()=1;
+        
+        //create the NDef message and record
+        NDefLib::Message msg;
+        NDefLib::RecordURI rUri(NDefLib::RecordURI::HTTP_WWW,"st.com");
+        msg.addRecord(&rUri);
+
+        //write the tag
+        if(tag.write(msg) == NDEF_OK)
+        {
+            printf("Tag written\n\r");
+            nfcNucleo->getLed2()=1;
+        }
+        else
+        {
+            printf("Error writing \n\r");
+            nfcNucleo->getLed1()=0;
+        }//if-else
+
+        //close the i2c session
+        if(tag.closeSession())
+        {
+           printf("Session closed\n\r");
+           nfcNucleo->getLed3()=1;
+        }
+        else
+        {
+           printf("Error closing the session\n\r");
+        }//if-else
+            
+    }
+    else
+        printf("Error opening the session\n\r");
   
-  /* Set the LED2 on to indicate Init done */
-  nfcNucleo->getLed2()=1;
-  
-  /* Prepare URI NDEF message content */
-  strcpy( URI.protocol,URI_ID_0x01_STRING );
-  strcpy( URI.URI_Message,"st.com/st25" );
-  strcpy( URI.Information,"\0" );
-  
-  /* Write NDEF to EEPROM */
-  while( mNDEF_URI.NDEF_WriteURI( &URI ) != NDEF_OK);
-  
-  /* Set the LED3 on to indicate Programing done */
-  nfcNucleo->getLed3()=1; 
 }
 
-