mbed OS 5 example application using X-NUCLEO-NFC02A1

Dependencies:   NDefLib X_NUCLEO_NFC02A1

Fork of HelloWorld_NFC02A1 by ST

Revision:
2:6f1b1f7f8d12
Parent:
1:11ae12d41082
--- a/X_NUCLEO_NFC02A1/m24lr/m24lr.h	Tue Aug 30 09:18:50 2016 +0000
+++ b/X_NUCLEO_NFC02A1/m24lr/m24lr.h	Wed Sep 28 11:26:49 2016 +0000
@@ -41,7 +41,7 @@
 
 #include "common.h"
 #include "DevI2C.h"
-#include "Nfc_class.h"
+#include "Nfc.h"
 #include "NDefNfcTag.h"
 #include "NDefNfcTagM24LR.h"
 
@@ -242,13 +242,13 @@
     void Enable_EnergyHarvesting( void );
     NFCTAG_StatusTypeDef Initialization( void );
     
-    virtual NFC_StatusTypeDef ReadBinary(uint16_t Offset, uint8_t NbByteToRead,
+    virtual int 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,
+    virtual int UpdateBinary(uint16_t Offset,
             uint8_t NbByteToWrite,uint8_t *pDataToWrite) {
           return (NFC_StatusTypeDef) i2c_WriteData( pDataToWrite, Offset, NbByteToWrite );
     }
@@ -256,234 +256,39 @@
     M24LR(uint8_t const address, uint8_t const addressData, DevI2C &devI2C ):
       NDefTagUtil(*this), i2c_address_syst(address), i2c_address_data(addressData), dev_I2C(devI2C) {}
     
-   static uint8_t NfctagInitialized;
-   
-   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;
    
    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);
     }
-  
+  private:
+        static uint8_t NfctagInitialized;
+   
+   
+        /*
+         * Object implementing the interface to use the NDefLib.
+         */
+       NDefNfcTagM24LR NDefTagUtil;
+       
+       uint8_t i2c_address_syst;
+       uint8_t i2c_address_data;
+       DevI2C dev_I2C;
 };
   
   
 
   
 #endif /* __M24LR_H */
+
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/