This tutorial describes how to read data from NFC Forum type 1, type 2 and type 3 tags.
The NFC
Tag Extension API provides access to different types of tags. An instance
of a connection class is created and is passed to a MNfcTag object which activates the connection. On activating the connection,
the tags can be accessed for reading.
Before you begin, refer to the following:
nfcconnection.h, MNfcConnection
nfctype1connection.h, CNfcType1Connection
nfctype2connection.h, CNfcType2Connection
nfctype3connection.h, CNfcType3Connection
nfctag.h, MNfcTag
Follow the steps in Discovering NFC Tags to detect the type 1 tag.
Create a new instance of the specific tag class.
CNfcType1Connection class. For example, CNfcType1Connection* Type1Connection; Type1Connection = CNfcType1Connection::NewL(iNfcServer);
CNfcType2Connection class. For example, CNfcType2Connection* Type2Connection; Type2Connection = CNfcType2Connection::NewL(iNfcServer);
CNfcType3Connection class. For example, CNfcType3Connection* Type3Connection; Type3Connection = CNfcType3Connection::NewL(iNfcServer);
Open the
connection to the tag using MNfcTag::OpenConnection() and pass the instance of the tag class.
For example for the Type 1 tag:
MNfcTag* iTag; iTag->OpenConnection( *Type1Connection );
Read the data from the tags using the specific tag methods.
Note: Only one read command can be requested at a time for a specific type of tag.
Type 1 Tag: Read data from the target Type 1 tag using CNfcType1Connection::Read(). For example, 
void CMyTagInitializer::Type1ReadL()
{
//Specify the no. of bytes of information that has to be read
TInt amount = 5 ;
//Specify the byte address
TInt byte = 0; 
//Specify the block address
Tint block =6; 
//Specify the address from which the read operation should start.
TNfcType1Address type1address( byte, block ); 
iReadBuffer.Zero();
iReadBuffer.ReAlloc(amount); 
iNfcType1Connection->Read( iReadWait->iStatus, iReadBuffer, amount, type1address );       
iReadWait->SetActive();    
//The data is read in iReadBuffer.
}Type 2 Tag: Read data from the target Type 2 tag using CNfcType2Connection::Read(). 
void CMyTagInitializer::Type2ReadL()
{
//Specify the no. of bytes of information that has to be read
TInt amount = 5 ;
//Specify the byte address
TInt byte = 0; 
//Specify the block address
Tint block =6; 
//Specify the address from which the read operation should start.
TNfcType2Address type2address( byte, block ); 
iReadBuffer.Zero();
iReadBuffer.ReAlloc(amount); 
iNfcType2Connection->Read( iReadWait->iStatus, iReadBuffer, amount, type2address );       
iReadWait->SetActive();    
//The data is read in iReadBuffer.
}Type 3 Tag: Read memory blocks from the Type 3 tag using CNfcType3Connection::Check(). 
void CMyTagInitializer::Type3ReadL()
{
//Specify the no. of bytes of information that has to be read
TInt amount = 5 ;
//Specify the byte address
TInt byte = 0; 
//Specify the block address
Tint block =6; 
//Specify the servicecode address.
TInt service = 11;	
//Specify the address from which the read operation should start.
TNfcType3Address type3address( byte, block, service ); 
iReadBuffer.Zero();
iReadBuffer.ReAlloc(amount); 
iNfcType3Connection->Check( iReadWait->iStatus, iReadBuffer, amount, type3address );       
iReadWait->SetActive();    
//The data is read in iReadBuffer.
}Note: The TNfcType1Address, TNfcType2Address and TNfcType3Address are helper classes  which
provides access to manage NFC Forum Type 1, Type 2 and Type 3 addresses
respectively. The read address is specified by aAddress parameter. If aAddress parameter is NULL, the read operation continues from where the latest read operation
had stopped.
The sequence diagram below illustrates how reading from a tag works:
