📄 outgoingcallmanagement.c
字号:
if (strlen((void*)num) > MAX_DIGIT)
{
PRINT_INFORMATION(("XXX Number too big XXX \n"));
ShowCallManagementErrorMessage(ERR_INVALID_NUMBER_FORMAT);
return;
}
if (length > 0)
{
AnsiiToUnicodeString((PS8) gCurrOutcall.Number, (PS8) num);
}
SetPreviousState((CALL_STATE) GetCurrentState());
SetCurrentState(CM_OUTGOING_STATE);
gtmpOutgoingIndex = GetFirstFreeIndex();
AddNewCallInfo(
(PU8) gCurrOutcall.Number,
GetCurrentState(),
GetPreviousState(),
CM_CALL_MO,
(CM_CALL_HANDLE) (gtmpOutgoingIndex + 1),
callType);
SetCCFlag(TRUE);
SetDialIndication(FALSE);
/* MO call */
/* look up dialed number from phonebook first anyway */
if (length > 0)
{
phb_data = mmi_phb_call_get_data_for_call_mgnt((PU8) gCurrOutcall.Number, FALSE);
SetCMPhoneBookStruct(&phb_data);
SetOutgoingNamefromPhonebook();
}
if (callType == CM_CSD_CALL)
{
stopRequestedTone(MESSAGE_TONE);
}
#ifdef __MMI_BT_PROFILE__
else
{
/* stop audio background play before sco link */
mdi_audio_suspend_background_play();
/* establish sco link here */
mmi_profiles_bt_call_start_callback();
}
#endif /* __MMI_BT_PROFILE__ */
AlmDisableExpiryHandler();
SetProtocolEventHandler(OutgoingCallConnected, PRT_OUTGOINGCALL_CONNECTED);
OutgoingProcessCMEvent(CM_PS_SHOW_OUTGOING_CALL_SCREEN, NULL);
}
/*****************************************************************************
* FUNCTION
* OutgoingProcessCMEvent
* DESCRIPTION
* This is the Entry function for all the Events while the Call-Management application
* is Active.
*
* This function handles the events from both keyboard and protocol stack.
* The keyboard events have KB in there defination and Protocol has PS.
* PARAMETERS
* inEvenType [IN]
* MsgStruct [?]
* pointer(?) [IN] To the event's associated structure)
* RETURNS
* void
*****************************************************************************/
void OutgoingProcessCMEvent(CM_EVENT_TYPES inEvenType, void *MsgStruct)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
ACTION_RESULT result = CM_CALL_FAILURE;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
PRINT_INFORMATION(("XXX In OutgoingProcessCMEvent\n"));
switch (inEvenType)
{
case CM_PS_SHOW_OUTGOING_CALL_SCREEN:
ProcessShowOutgoingCallScreen();
break;
case CM_PS_SHOW_REQUESTING_CALL_SCREEN:
if (GetActiveScreenId() == SCR_CM_REQUESTINGUSSD)
{
/* current active screen is SS requesting, display and remove previous*/
EntryScrUSSDReq();
RemoveSSReqScr();
SetDelScrnIDCallbackHandler(SCR_CM_REQUESTINGUSSD, (HistoryDelCBPtr) SSReqHistoryDelHdlr);
}
else if (IsScreenPresent(SCR_CM_REQUESTINGUSSD))
{
/* SS requesting screen is in history, do nothing */
}
else
{
/* current active screen is NOT SS requesting, not in history also, display requesting screen*/
EntryScrUSSDReq();
}
/* if (IsScreenPresent(CM_SCR_MARKER) == FALSE)
AddMarkerToHistory(); */
break;
case CM_PS_USSD_RECVD:
ProcessUSSDrecieved(MsgStruct);
break;
case CM_KB_OUTGOINGCALL:
/* MO SEND key */
result = ProcessKBOutgoingEvent(MsgStruct);
break;
case CM_PS_CALLCONNECTED:
/* connect ind */
result = ProcessPSCallconnectedEvent(MsgStruct);
break;
case CM_KB_HANGUPREQ:
/* 1X send, drop single call */
result = ProcessKBHangupReqEvent(MsgStruct);
break;
case CM_PS_HANGUPSUC:
result = ProcessPSHangupSucEvent(MsgStruct);
break;
case CM_KB_HANGUPALLREQ:
/* END key in CM */
result = ProcessKBHangupallReqEvent(MsgStruct);
break;
case CM_PS_HANGUPALLSUC:
result = ProcessPSHangupallSucEvent(MsgStruct);
break;
case CM_KB_HANGUPALLACTREQ:
/* Menu End All Active */
result = ProcessKBHangupallActReqEvent(MsgStruct);
break;
case CM_PS_HANGUPALLACTSUC:
result = ProcessPSHangupallActSucEvent(MsgStruct);
break;
case CM_KB_HANGUPALLHLDREQ:
result = ProcessKBHangupallHldReqEvent(MsgStruct);
break;
case CM_PS_HANGUPALLHLDSUC:
result = ProcessPSHangupallHldSucEvent(MsgStruct);
break;
case CM_KB_HOLDREQ:
result = ProcessKBHoldReqEvent(MsgStruct);
break;
case CM_PS_HOLDSUC:
result = ProcessPSHoldSucEvent(MsgStruct);
break;
case CM_KB_RETRIEVEREQ:
result = ProcessKBRetrieveReqEvent(MsgStruct);
break;
case CM_PS_RETRIEVESUC:
result = ProcessPSRetrieveSucEvent(MsgStruct);
break;
case CM_KB_SWAPREQ:
result = ProcessKBSwapReqEvent(MsgStruct);
break;
case CM_PS_SWAPSUC:
result = ProcessPSSwapSucEvent(MsgStruct);
break;
case CM_KB_CONFREQ:
result = ProcessKBConfReqEvent(MsgStruct);
break;
case CM_PS_CONFSUC:
result = ProcessPSConfSucEvent(MsgStruct);
break;
case CM_KB_SPLITREQ:
result = ProcessKBSplitReqEvent(MsgStruct);
break;
case CM_PS_SPLITSUC:
result = ProcessPSSplitSucEvent(MsgStruct);
break;
case CM_KB_ECT_REQ:
result = ProcessKBEctReqEvent(MsgStruct);
break;
case CM_PS_ECT_SUC:
result=ProcessPSEctSuccessful(MsgStruct);
break;
case CM_KB_CALL_DEFLECT_REQ:
MakePsCallDeflect((void*)PsCBackCallDeflected, (PU8) MsgStruct);
ShowCategory302Screen(NULL);
break;
case CM_PS_INCOMING_CALL_DEFLECT:
ShowCategory302Screen(NULL);
break;
default:
PRINT_INFORMATION(("\n CM Event Handler does not exist \n"));
break;
}
PRINT_INFORMATION_2((MMI_TRACE_G5_CM, "*-------[OutgoingCallManagement.c] OutgoingProcessCMEvent: result = "
" %d-------*\n", (int)result));
}
/*****************************************************************************
* FUNCTION
* ProcessShowOutgoingCallScreen
* DESCRIPTION
* This is the function to show outgoing call only when the Call list is recieved
*
* This invokes the protocol function if the state is in Idle/hold state.
* In Active state,it makes the request to hold and after success it initiates the call.
* PARAMETERS
* void
* void(?) [IN] *(this points to OUTGOING_CALL structure)
* ACTION_RESULT(?) [OUT]
* RETURNS
* This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.(?)
*****************************************************************************/
void ProcessShowOutgoingCallScreen(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
PRINT_INFORMATION(("XXX In ProcessShowOutgoingCallScreen \n"));
switch (GetPreviousState())
{
case CM_IDLE_STATE:
/* do not have to suspend audio for CSD call */
EntryScr1001OutgoingCall();
if (GetOutgoingCallType() != CM_CSD_CALL)
{
mdi_audio_suspend_background_play();
}
if (IsScreenPresent(CM_SCR_MARKER) == FALSE)
{
AddMarkerToHistory();
}
break;
case CM_INCOMING_STATE:
case CM_HOLD_STATE:
case CM_ACTIVE_STATE:
EntryScr1001OutgoingCall();
if (GetOutgoingCallOrigin() == CM_CALL_MO_STK)
{
AddMarkerToHistory();
}
break;
default:
PRINT_INFORMATION(("\n KBOutgoingEvent CM State Machine is in incorrect state \n"));
break;
}
}
/*****************************************************************************
* FUNCTION
* ProcessKBOutgoingEvent
* DESCRIPTION
* This is the function to process Keyboard(Request) Event CM_KB_OUTGOINGCALL.
*
* This invokes the protocol function if the state is in Idle/hold state.
* In Active state,it makes the request to hold and after success it initiates the call.
* PARAMETERS
* MsgStruct [?]
* ACTION_RESULT(?) [OUT]
* this(?) [IN] Points to OUTGOING_CALL structure)
* RETURNS
* This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
*****************************************************************************/
ACTION_RESULT ProcessKBOutgoingEvent(void *MsgStruct)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
memcpy(&gCurrOutcall, MsgStruct, sizeof(OUTGOING_CALL));
switch (GetCurrentState())
{
case CM_IDLE_STATE:
if (AllowMoreCalls() && DTMFPadCallBuffer[0] != 0)
{
SetPreviousState(CM_IDLE_STATE);
SetCurrentState(CM_OUTGOING_STATE);
gtmpOutgoingIndex = GetFirstFreeIndex();
AddNewCallInfo(
gCurrOutcall.Number,
CM_OUTGOING_STATE,
CM_IDLE_STATE,
CM_CALL_MO,
(CM_CALL_HANDLE) (gtmpOutgoingIndex + 1),
CSMCC_VOICE_CALL);
MakePsInitiateCall((PU8) DTMFPadCallBuffer, (void*)OutgoingCallConnected);
}
else
{
ShowCallManagementErrorMessage(NO_ACTIVE_CALL);
return CM_CALL_FAILURE;
}
break;
case CM_OUTGOING_STATE:
PRINT_INFORMATION(("XXX In ProcessKBOutgoingEvent already outgoing, can't make MO\n"));
ShowCallManagementErrorMessage(ERR_L4C_GEN_CAUSE);
return CM_CALL_FAILURE;
case CM_INCOMING_STATE:
case CM_HOLD_STATE:
case CM_ACTIVE_STATE:
/* send SS when MT call and previous USSR seession exists,
need to abort previous session */
DeleteScreenIfPresent(ITEM_SCR_USSN_MSG);
DeleteScreenIfPresent(ITEM_SCR_USSR_EDIT);
if (AllowMoreCalls())
{
SetPreviousState(GetCurrentState());
SetCurrentState(CM_OUTGOING_STATE);
gtmpOutgoingIndex = GetFirstFreeIndex();
AddNewCallInfo(
gCurrOutcall.Number,
GetCurrentState(),
CM_IDLE_STATE,
CM_CALL_MO,
(CM_CALL_HANDLE) (gtmpOutgoingIndex + 1),
CSMCC_VOICE_CALL);
MakePsInitiateCall((PU8) DTMFPadCallBuffer, (void*)OutgoingCallConnected);
}
else
{
ShowCallManagementErrorMessage(NO_ACTIVE_CALL);
return CM_CALL_FAILURE;
}
break;
default:
PRINT_INFORMATION(("\n KBOutgoingEvent CM State m/c Corrupted \n"));
return CM_CALL_FAILURE;
}
return CM_CALL_SUCCESS;
}
/*****************************************************************************
* FUNCTION
* ProcessPSCallconnectedEvent
* DESCRIPTION
* This is the function to process Protocol(Response) Event CM_PS_CALLCONNECTED.
*
* This change the state of the call to ACTIVE & also changes the
* state of the State m/c.
* PARAMETERS
* MsgStruct [?]
* ACTION_RESULT(?) [OUT]
* this(?) [IN] Points to CM_CALL_HANDLE of the call which requested CM_KB_OUTGOINGCALL)
* RETURNS
* This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
*****************************************************************************/
ACTION_RESULT ProcessPSCallconnectedEvent(void *MsgStruct)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
CM_CALL_HANDLE callHandle;
CM_CALL_HANDLE *handle;
/*----------------------------------------------------------------*/
/* Code Body */
/*---------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -