static void DisplaySimState
(
le_sim_States_t state,
le_sim_Id_t simId
)
{
char string[100];
memset(string,0,100);
switch(state)
{
case LE_SIM_INSERTED:
sprintf(string, "\nSIM Card state LE_SIM_INSERTED for SIM card.%d \n", simId);
break;
case LE_SIM_ABSENT:
sprintf(string, "\nSIM Card state LE_SIM_ABSENT for SIM card.%d \n", simId);
break;
case LE_SIM_READY:
sprintf(string, "\nSIM Card state LE_SIM_READY for SIM card.%d \n", simId);
break;
case LE_SIM_BLOCKED:
sprintf(string, "\nSIM Card state LE_SIM_BLOCKED for SIM card.%d \n", simId);
break;
case LE_SIM_BUSY:
sprintf(string, "\nSIM Card state LE_SIM_BUSY for SIM card.%d \n", simId);
break;
case LE_SIM_POWER_DOWN:
sprintf(string, "\nSIM Card state LE_SIM_POWER_DOWN for SIM card.%d \n", simId);
break;
case LE_SIM_STATE_UNKNOWN:
sprintf(string, "\nSIM Card state LE_SIM_STATE_UNKNOWN for SIM card.%d \n", simId);
break;
default:
sprintf(string, "\nSIM Card state %d for SIM card.%d \n", state, simId);
break;
}
Print(string);
}
static void TestSimStateHandler
(
le_sim_Id_t simId,
le_sim_States_t simState,
void* contextPtr
)
{
switch (simState)
{
case LE_SIM_INSERTED:
LE_INFO(
"-TEST- New state LE_SIM_INSERTED for SIM card.%d", simId);
break;
case LE_SIM_ABSENT:
LE_INFO(
"-TEST- New state LE_SIM_ABSENT for SIM card.%d", simId);
break;
case LE_SIM_READY:
LE_INFO(
"-TEST- New state LE_SIM_READY for SIM card.%d", simId);
if (SimPowerCycleStarted)
{
SimPowerCycleStarted = false;
}
break;
case LE_SIM_BLOCKED:
LE_INFO(
"-TEST- New state LE_SIM_BLOCKED for SIM card.%d", simId);
break;
case LE_SIM_BUSY:
LE_INFO(
"-TEST- New state LE_SIM_BUSY for SIM card.%d", simId);
break;
case LE_SIM_POWER_DOWN:
LE_INFO(
"-TEST- New state LE_SIM_POWER_DOWN for SIM card.%d", simId);
if (SimPowerCycleStarted)
{
}
break;
case LE_SIM_STATE_UNKNOWN:
LE_INFO(
"-TEST- New state LE_SIM_STATE_UNKNOWN for SIM card.%d", simId);
break;
default:
LE_INFO(
"-TEST- New state %d for SIM card.%d", simState, simId);
break;
}
}
void simTest_State
(
le_sim_Id_t simId,
const char* pinPtr
)
{
le_sim_States_t state;
le_sim_NewStateHandlerRef_t testHdlrRef;
char string[100];
memset(string, 0, 100);
LE_ASSERT((state >= LE_SIM_INSERTED) && (state <= LE_SIM_BUSY));
sprintf(string, "\nSIM Card.%d state:\n", simId);
Print(string);
DisplaySimState(state, simId);
if (LE_SIM_INSERTED == state)
{
LE_ASSERT((state>=LE_SIM_INSERTED) && (state<=LE_SIM_BUSY));
}
}