Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Can anyone help me to find total record numbers in sim card using smart card API.

thanks in advance
Posted
Comments
Oshtri Deka 28-Feb-12 5:51am    
Do you have any code?
Dean Oliver 28-Feb-12 8:48am    
Please supply your code.
Swarup Waghade 29-Feb-12 0:45am    
this is the code i want to read all records but this code is only for 10 records.

// Select the EFadn (6F3A)
apduParam.Data = new byte[] { 0x6F, 0x3A };
apduSelectFile.Update(apduParam);
apduResp = iCard.Transmit(apduSelectFile);
if (apduResp.Status != SC_OK && apduResp.SW1 != SC_PENDING)
throw new Exception("Select command failed: " + apduResp.ToString());
MessageBox.Show("EFadn (Phone numbers) selected");

// Read the response
if (apduResp.SW1 == SC_PENDING)
{
apduParam.Reset();
apduParam.Le = apduResp.SW2;
apduParam.Data = null;
apduGetResponse.Update(apduParam);
apduResp = iCard.Transmit(apduGetResponse);
if (apduResp.Status != SC_OK)
// throw new Exception("Select command failed: " + apduResp.ToString());
MessageBox.Show("Select command failed: " + apduResp.ToString());
}

// Get the length of the record
int recordLength = apduResp.Data[14];


// Read the 10 first record of the file
for (int nI = 0; nI < 10; nI++)
{

apduParam.Reset();
apduParam.Le = (byte)recordLength;
apduParam.P1 = (byte)(nI + 1);
apduReadRecord.Update(apduParam);
apduResp = iCard.Transmit(apduReadRecord);

if (apduResp.Status != SC_OK)
throw new Exception("ReadRecord command failed: " + apduResp.ToString());
PhoneNumber phone = new PhoneNumber(apduResp.Data);
ADNrecords.Add(phone.ToString());
}

iCard.Disconnect(DISCONNECT.Unpower);


}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900