#include "legato.h"
#include "interfaces.h"
typedef struct
{
char * name;
TestFunc ptrfunc;
} myStruct;
static bool ClirValid = true;
static le_mcc_CallRef_t TestCallRef;
static char DestinationNumber[LE_MDMDEFS_PHONE_NUM_MAX_BYTES];
static bool AmrWbCapState = true;
static void HangUpTimerHandler
(
)
{
}
static void MyCallEventHandler
(
le_mcc_CallRef_t callRef,
le_mcc_Event_t callEvent,
void* contextPtr
)
{
static bool firstConnectCall = true;
LE_INFO(
"MCC TEST: New Call event: %d for Call %p", callEvent, callRef);
if (callEvent == LE_MCC_EVENT_ALERTING)
{
LE_INFO(
"Check MyCallEventHandler passed, event is LE_MCC_EVENT_ALERTING.");
if (firstConnectCall)
{
LE_INFO(
"---!!!! PLEASE CHECK ON THE REMOTE SIDE IF THE PHONE NUMBER IS %s !!!!---",
((ClirStatus == LE_ON) ? "HIDED" : "DISPLAYED"));
LE_INFO(
"---!!!! PLEASE HANG UP ON THE REMOTE SIDE !!!!---");
}
}
else if (callEvent == LE_MCC_EVENT_CONNECTED)
{
LE_INFO(
"Check MyCallEventHandler passed, event is LE_MCC_EVENT_CONNECTED.");
if (firstConnectCall)
{
LE_INFO(
"---!!!! PLEASE TERMINATE THE CALL on THE REMOTE SIDE !!!!---");
firstConnectCall = false;
}
}
else if (callEvent == LE_MCC_EVENT_TERMINATED)
{
LE_INFO(
"Check MyCallEventHandler passed, event is LE_MCC_EVENT_TERMINATED.");
switch(term)
{
case LE_MCC_TERM_NETWORK_FAIL:
LE_ERROR(
"Termination reason is LE_MCC_TERM_NETWORK_FAIL");
exit(EXIT_FAILURE);
break;
case LE_MCC_TERM_UNASSIGNED_NUMBER:
LE_ERROR(
"Termination reason is LE_MCC_TERM_UNASSIGNED_NUMBER");
exit(EXIT_FAILURE);
break;
case LE_MCC_TERM_USER_BUSY:
LE_ERROR(
"Termination reason is LE_MCC_TERM_USER_BUSY");
exit(EXIT_FAILURE);
break;
case LE_MCC_TERM_LOCAL_ENDED:
LE_INFO(
"Termination reason is LE_MCC_TERM_LOCAL_ENDED");
LE_INFO(
"mccTest Sequence SUCCESS");
exit(EXIT_SUCCESS);
break;
case LE_MCC_TERM_REMOTE_ENDED:
LE_INFO(
"Termination reason is LE_MCC_TERM_REMOTE_ENDED");
LE_INFO(
"---!!!! PLEASE CREATE AN INCOMING CALL !!!!---");
break;
case LE_MCC_TERM_NO_SERVICE:
LE_INFO(
"Termination reason is LE_MCC_TERM_NO_SERVICE");
exit(EXIT_FAILURE);
break;
case LE_MCC_TERM_OPERATOR_DETERMINED_BARRING:
LE_INFO(
"Termination reason is LE_MCC_TERM_OPERATOR_DETERMINED_BARRING");
exit(EXIT_FAILURE);
break;
case LE_MCC_TERM_UNDEFINED:
LE_ERROR(
"Termination reason is LE_MCC_TERM_UNDEFINED");
LE_ERROR(
"---!!!! PLEASE CREATE AN INCOMING CALL !!!!---");
break;
default:
LE_ERROR(
"Termination reason is %d", term);
exit(EXIT_FAILURE);
break;
}
LE_INFO(
"Termination code is 0x%X", code);
if (HangUpTimer)
{
}
}
else if (callEvent == LE_MCC_EVENT_INCOMING)
{
LE_INFO(
"Check MyCallEventHandler passed, event is LE_MCC_EVENT_INCOMING.");
{
LE_INFO(
"Check MyCallEventHandler passed, I answered the call");
LE_INFO(
"All calls will be hung-up in 10 seconds");
}
else
{
LE_ERROR(
"Check MyCallEventHandler failed to answer the call.");
}
}
else if (callEvent == LE_MCC_EVENT_ORIGINATING)
{
LE_INFO(
"Check MyCallEventHandler passed, event is LE_MCC_EVENT_ORIGINATING.");
}
else if (callEvent == LE_MCC_EVENT_SETUP)
{
LE_INFO(
"Check MyCallEventHandler passed, event is LE_MCC_EVENT_SETUP.");
}
else
{
LE_ERROR(
"Check MyCallEventHandler failed, unknowm event %d.", callEvent);
}
}
(
void
)
{
bool amrWbCapabilityState;
if (TestCallRef == NULL)
{
}
if (ClirValid == true)
{
{
LE_ERROR(
"Failed to set Caller Id Restriction");
return res;
}
}
if (((ClirValid ==
true) && (res !=
LE_OK)) ||
{
LE_ERROR(
"Failed to get Caller Id Restriction");
return res;
}
if ((res ==
LE_OK) && (localClirStatus != ClirStatus))
{
LE_ERROR(
"CLIR status doesn't match with CLIR set");
}
{
LE_ERROR(
"Set AMR Wideband capability Error");
}
{
LE_ERROR(
"Get AMR Wideband capability Error");
}
if (amrWbCapabilityState != AmrWbCapState)
{
LE_ERROR(
"AMR Wideband capability Error");
}
{
switch(reason)
{
case LE_MCC_TERM_FDN_ACTIVE:
LE_ERROR(
"Term reason LE_MCC_TERM_FDN_ACTIVE");
break;
case LE_MCC_TERM_NOT_ALLOWED:
LE_ERROR(
"Term reason LE_MCC_TERM_NOT_ALLOWED");
break;
case LE_MCC_TERM_UNDEFINED:
LE_ERROR(
"Term reason LE_MCC_TERM_UNDEFINED");
break;
default:
}
}
else
{
LE_INFO(
"le_mcc_Start() LE_BUSY test OK");
}
}
(
void
)
{
}
{
int i, nbArgument = 0;
myStruct mcctest[] =
{
{ "Test le_mcc_Call()", Testle_mcc_Call },
{ "Test le_mcc_HangUpAll()", Testle_mcc_HangUpAll },
{ "", NULL }
};
if (3 == nbArgument)
{
if (NULL == phoneNumber)
{
exit(EXIT_FAILURE);
}
strncpy(DestinationNumber, phoneNumber, LE_MDMDEFS_PHONE_NUM_MAX_BYTES);
if (clirStatusStr)
{
if (0 == strcmp(clirStatusStr, "NO_CLIR"))
{
ClirValid = false;
LE_INFO(
"Phone number %s, No CLIR", DestinationNumber);
}
else if (0 == strcmp(clirStatusStr, "CLIR_ON"))
{
ClirValid = true;
ClirStatus = LE_ON;
LE_INFO(
"Phone number %s, CLIR ON", DestinationNumber);
}
else if (0 == strcmp(clirStatusStr, "CLIR_OFF"))
{
ClirValid = true;
ClirStatus = LE_OFF;
LE_INFO(
"Phone number %s, CLIR OFF", DestinationNumber);
}
else
{
LE_ERROR(
"Incorrect argument '%s'", clirStatusStr);
exit(EXIT_FAILURE);
}
}
if (amrWbCapStr)
{
if (0 == strcmp(amrWbCapStr, "AMR_WB_DISABLE"))
{
AmrWbCapState = false;
}
else if (0 == strcmp(amrWbCapStr, "AMR_WB_ENABLE"))
{
AmrWbCapState = true;
}
else
{
LE_ERROR(
"Incorrect AMR Widband Capability argument '%s'", amrWbCapStr);
exit(EXIT_FAILURE);
}
}
for (i=0; mcctest[i].ptrfunc != NULL; i++)
{
LE_INFO(
"Test %s STARTED\n", mcctest[i].name);
res = mcctest[i].ptrfunc();
{
LE_ERROR(
"Test %s FAILED\n", mcctest[i].name);
LE_INFO(
"mccTest sequence FAILED");
exit(EXIT_FAILURE);
}
LE_INFO(
"Test %s PASSED\n", mcctest[i].name);
}
}
else
{
LE_ERROR(
"PRINT USAGE => app runProc mccTest --exe=mccTest -- <Destination phone number>" " <CLIR_ON | CLIR_OFF | NO_CLIR> <AMR_WB_ENABLE | AMR_WB_DISABLE>");
exit(EXIT_SUCCESS);
}
}