AppNearMe µNFC stack for the NXP PN532 chip License: You can use the stack free of charge to prototype with mbed; if you want to use the stack with your commercial product, get in touch!

Dependents:   IOT_sensor_nfc AppNearMe_MuNFC_PN532_Test p2p_nfc_test NFCMoodLamp ... more

Embed: (wiki syntax)

« Back to documentation index

MuNFC Class Reference

A library for embedded NFC applications using NXP's PN512/PN532 NFC transceivers. More...

#include <MuNFC.h>

Public Member Functions

 MuNFC (char appHash[16], uint32_t version, PinName mosi, PinName miso, PinName sclk, PinName cs, PinName isr)
 Instantiate the �NFC stack for the following mobile app and using the following PN512/PN532 chip.
void encode (void(*fn)(TLVList *, void *), void *arg)
 Set Encode Callback.
template<class T >
void encode (T *inst, void(T::*member)(TLVList *))
 Set Encode Callback.
void decode (void(*fn)(TLVList *, void *), void *arg)
 Set Decode Callback.
template<class T >
void decode (T *inst, void(T::*member)(TLVList *))
 Set Decode Callback.
void event (void(*fn)(NFCEvent, void *), void *arg)
 Set Event Callback.
template<class T >
void event (T *inst, void(T::*member)(NFCEvent))
 Set Event Callback.
bool init ()
 Initialize stack.
void run ()
 Start NFC thread (threaded mode)
void poll (int timeoutMs)
 Poll for NFC reader (polling mode).

Protected Member Functions

void process ()
 NFC Thread.

Detailed Description

A library for embedded NFC applications using NXP's PN512/PN532 NFC transceivers.

Visit http://www.appnearme.com/

Definition at line 35 of file MuNFC.h.


Constructor & Destructor Documentation

MuNFC ( char  appHash[16],
uint32_t  version,
PinName  mosi,
PinName  miso,
PinName  sclk,
PinName  cs,
PinName  isr 
)

Instantiate the �NFC stack for the following mobile app and using the following PN512/PN532 chip.

Parameters:
appHash16 chars-long hash of the corresponding mobile app
versionMinimum version of the mobile app to use in BCD format encoded as an uint32_t (0x01000000 is version 1.0.0.0)
mosiMOSI pin of the SPI interface
misoMISO pin of the SPI interface
sclkSCLK pin of the SPI interface
csCS pin connected to the chip
isrISR pin connected to the chip

Definition at line 34 of file MuNFC.cpp.


Member Function Documentation

void decode ( void(*)(TLVList *, void *)  fn,
void *  arg 
)

Set Decode Callback.

The decode callback will be called on each successful termination of NFC transaction. populated with the data structure that was transmitted by the reader

Parameters:
fnpointer to the function to be called
argargument that will be passed to the callback

Definition at line 83 of file MuNFC.h.

void decode ( T *  inst,
void(T::*)(TLVList *)  member 
)

Set Decode Callback.

The decode callback will be called on each successful termination of NFC transaction. populated with the data structure that was transmitted by the reader

Parameters:
instpointer to the object on which to call the member
memberpointer to the object's member to be called

Definition at line 95 of file MuNFC.h.

void encode ( T *  inst,
void(T::*)(TLVList *)  member 
)

Set Encode Callback.

The encode callback will be called on each start of NFC transaction. to populate the data structure that will be transmitted to the reader

Parameters:
instpointer to the object on which to call the member
memberpointer to the object's member to be called

Definition at line 72 of file MuNFC.h.

void encode ( void(*)(TLVList *, void *)  fn,
void *  arg 
)

Set Encode Callback.

The encode callback will be called on each start of NFC transaction. to populate the data structure that will be transmitted to the reader

Parameters:
fnpointer to the function to be called
argargument that will be passed to the callback

Definition at line 60 of file MuNFC.h.

void event ( void(*)(NFCEvent, void *)  fn,
void *  arg 
)

Set Event Callback.

The event callback will be called on each of the following event:

  • Transaction started
  • Transaction successful
  • Transaction failed
    Parameters:
    fnpointer to the function to be called
    argargument that will be passed to the callback

Definition at line 108 of file MuNFC.h.

void event ( T *  inst,
void(T::*)(NFCEvent member 
)

Set Event Callback.

The event callback will be called on each of the following event:

  • Transaction started
  • Transaction successful
  • Transaction failed
    Parameters:
    fnpointer to the function to be called
    argargument that will be passed to the callback

Definition at line 122 of file MuNFC.h.

bool init (  )

Initialize stack.

Returns:
true if stack was initialized correctly, false otherwise

Definition at line 62 of file MuNFC.cpp.

void poll ( int  timeoutMs )

Poll for NFC reader (polling mode).

Parameters:
timeoutMs(maximum polling time)

Definition at line 100 of file MuNFC.cpp.

void process (  ) [protected]

NFC Thread.

Definition at line 90 of file MuNFC.cpp.

void run (  )

Start NFC thread (threaded mode)

Definition at line 84 of file MuNFC.cpp.