📄 main.c
字号:
switch(current_hfp_state)
{
case headsetConnecting:
case headsetConnected:
case headsetIncomingCallEstablish:
case headsetOutgoingCallEstablish:
case headsetActiveCall:
hfpHeadsetHandleCallIndicator(&app, (HFP_CALL_IND_T *) message);
break;
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_CALL_SETUP_IND:
DEBUG(("HFP_CALL_SETUP_IND\n"));
switch(current_hfp_state)
{
case headsetConnecting:
case headsetConnected:
case headsetIncomingCallEstablish:
case headsetOutgoingCallEstablish:
case headsetActiveCall:
hfpHeadsetHandleCallSetupIndicator(&app, (HFP_CALL_SETUP_IND_T *) message);
break;
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_RING_IND:
DEBUG(("RING\n"));
switch(current_hfp_state)
{
case headsetConnected:
case headsetIncomingCallEstablish:
case headsetActiveCall:
hfpHeadsetHandleRingInd(&app, (HFP_RING_IND_T *) message);
break;
case headsetConnecting:
case headsetOutgoingCallEstablish:
/* TODO: B-4373 needed if supporting more than one SLC */
unhandledHfpState(current_hfp_state, id);
break;
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_LAST_NUMBER_REDIAL_CFM:
switch(current_hfp_state)
{
case headsetConnected:
break;
case headsetIncomingCallEstablish:
case headsetConnecting:
case headsetOutgoingCallEstablish:
case headsetActiveCall:
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_DIAL_NUMBER_CFM:
DEBUG(("dial cfm %d %d\n", current_hfp_state, ((HFP_DIAL_NUMBER_CFM_T *) message)->status));
switch(current_hfp_state)
{
case headsetConnected:
break;
case headsetIncomingCallEstablish:
case headsetConnecting:
case headsetOutgoingCallEstablish:
case headsetActiveCall:
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_DIAL_MEMORY_CFM:
DEBUG(("dial mem cfm %d %d\n", current_hfp_state, ((HFP_DIAL_MEMORY_CFM_T *) message)->status));
switch(current_hfp_state)
{
case headsetConnected:
break;
case headsetIncomingCallEstablish:
case headsetConnecting:
case headsetOutgoingCallEstablish:
case headsetActiveCall:
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_SCO_CONNECT_IND:
DEBUG(("HFP_SCO_CONNECT_IND\n"));
switch(current_hfp_state)
{
case headsetConnecting:
/*
If we have received a SCO indication before the SLC is up assume
phone has performed call transfer early and cancel the queued
button press event.
*/
(void) MessageCancelAll(&app.task, BUTTON_PLAY_PAUSE_REL);
(void) MessageCancelAll(&app.task, BUTTON_PLAY_PAUSE_LONG);
/* Still handle the SCO indication as normal */
hfpHeadsetHandleScoConnectInd(&app, (HFP_SCO_CONNECT_IND_T *) message);
break;
case headsetConnected:
case headsetIncomingCallEstablish:
case headsetOutgoingCallEstablish:
case headsetActiveCall:
hfpHeadsetHandleScoConnectInd(&app, (HFP_SCO_CONNECT_IND_T *) message);
break;
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_SCO_DISCONNECT_IND:
DEBUG(("HFP_SCO_DISCONNECT_IND\n"));
switch(current_hfp_state)
{
case headsetReady:
case headsetConnected:
case headsetIncomingCallEstablish:
case headsetOutgoingCallEstablish:
case headsetActiveCall:
hfpHeadsetHandleScoDisconnectInd(&app, (HFP_SCO_DISCONNECT_IND_T *) message);
break;
case headsetConnecting:
case headsetInitialising:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_ANSWER_CALL_CFM:
switch(current_hfp_state)
{
case headsetIncomingCallEstablish:
case headsetActiveCall:
hfpHeadsetHandleAnswerCallCfm(&app, (HFP_ANSWER_CALL_CFM_T *) message);
break;
case headsetConnected:
case headsetOutgoingCallEstablish:
case headsetConnecting:
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_REJECT_CALL_CFM:
switch(current_hfp_state)
{
case headsetIncomingCallEstablish:
hfpHeadsetHandleRejectCallCfm(&app, (HFP_REJECT_CALL_CFM_T *) message);
break;
case headsetConnected:
case headsetOutgoingCallEstablish:
case headsetActiveCall:
case headsetConnecting:
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_TERMINATE_CALL_CFM:
DEBUG(("terminate %d\n", current_hfp_state));
switch(current_hfp_state)
{
case headsetOutgoingCallEstablish:
case headsetActiveCall:
hfpHeadsetHandleTerminateCallCfm(&app, (HFP_TERMINATE_CALL_CFM_T *) message);
break;
case headsetConnected:
case headsetIncomingCallEstablish:
case headsetConnecting:
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_VOICE_RECOGNITION_IND:
switch(current_hfp_state)
{
case headsetConnected:
case headsetOutgoingCallEstablish:
hfpHeadsetHandleVoiceRecognitionInd(&app, (HFP_VOICE_RECOGNITION_IND_T *) message);
break;
case headsetActiveCall:
case headsetIncomingCallEstablish:
case headsetConnecting:
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_VOICE_RECOGNITION_ENABLE_CFM:
switch(current_hfp_state)
{
case headsetConnected:
hfpHeadsetHandleVoiceRecognitionCfm(&app, (HFP_VOICE_RECOGNITION_ENABLE_CFM_T *) message);
break;
case headsetActiveCall:
case headsetOutgoingCallEstablish:
case headsetIncomingCallEstablish:
case headsetConnecting:
case headsetInitialising:
case headsetReady:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_ENCRYPTION_CHANGE_IND:
DEBUG(("HFP_ENCRYPTION_CHANGE_IND %d\n",((HFP_ENCRYPTION_CHANGE_IND_T *)message)->encrypted));
switch(current_hfp_state)
{
case headsetConnecting:
case headsetConnected:
case headsetIncomingCallEstablish:
case headsetOutgoingCallEstablish:
case headsetActiveCall:
if (((HFP_ENCRYPTION_CHANGE_IND_T *)message)->encrypted == FALSE)
MessageSendLater(getAppTask(), APP_DISCONNECT_HFP_SLC_IND, 0, 5000);
else
MessageCancelAll(getAppTask(), APP_DISCONNECT_HFP_SLC_IND);
break;
case headsetReady:
case headsetInitialising:
default:
unhandledHfpState(current_hfp_state, id);
}
break;
case HFP_SPEAKER_VOLUME_CFM:
DEBUG(("HFP_SPEAKER_VOLUME_CFM\n"));
break;
case HFP_SPEAKER_VOLUME_IND:
DEBUG(("HFP_SPEAKER_VOLUME_IND\n"));
/* Update the local valume and the actual gain setting */
app.speaker_volume = (app.speaker_volume & 0xFF) | (((HFP_SPEAKER_VOLUME_IND_T *) message)->volume_gain << VOLUME_SHIFT);
/* Update the local volume */
#ifdef INCLUDE_CVC
CvcHeadsetVolume(app.speaker_volume);
#else
avHeadsetUpdateHfVolume(app.codec_task, app.speaker_volume);
#endif
break;
case HFP_MICROPHONE_VOLUME_CFM:
DEBUG(("HFP_MICROPHONE_VOLUME_CFM\n"));
break;
case HFP_MICROPHONE_VOLUME_IND:
DEBUG(("HFP_MICROPHONE_VOLUME_IND %d\n", ((HFP_MICROPHONE_VOLUME_IND_T *) message)->mic_gain));
break;
case HFP_CALLER_ID_IND:
{
uint16 i;
HFP_CALLER_ID_IND_T *ind = (HFP_CALLER_ID_IND_T *) message;
DEBUG(("CLI len %d\n", ind->size_caller_number));
for (i=0; i<ind->size_caller_number; i++)
{
DEBUG(("%c", ind->caller_number[i]));
}
DEBUG(("\n"));
}
break;
/* TODO B-4382 Ignore these prims for the moment */
case HFP_CALL_WAITING_IND:
{
uint16 i;
HFP_CALL_WAITING_IND_T *ind = (HFP_CALL_WAITING_IND_T *) message;
DEBUG(("call waiting ind len %d\n", ind->size_caller_number));
for (i=0; i<ind->size_caller_number; i++)
{
DEBUG(("%c", ind->caller_number[i]));
}
DEBUG(("\n"));
}
break;
case HFP_RELEASE_HELD_REJECT_WAITING_CALL_CFM:
DEBUG(("chld 0 cfm %d\n", ((HFP_RELEASE_HELD_REJECT_WAITING_CALL_CFM_T *) message)->status));
break;
case HFP_RELEASE_ACTIVE_ACCEPT_OTHER_CALL_CFM:
DEBUG(("chld 1 cfm %d\n", ((HFP_RELEASE_ACTIVE_ACCEPT_OTHER_CALL_CFM_T *) message)->status));
break;
case HFP_HOLD_ACTIVE_ACCEPT_OTHER_CALL_CFM:
DEBUG(("chld 2 cfm %d\n", ((HFP_HOLD_ACTIVE_ACCEPT_OTHER_CALL_CFM_T *) message)->status));
break;
case HFP_ADD_HELD_CALL_CFM:
DEBUG(("chld 3 cfm %d\n", ((HFP_ADD_HELD_CALL_CFM_T *) message)->status));
break;
case HFP_EXPLICIT_CALL_TRANSFER_CFM:
DEBUG(("chld 4 cfm %d\n", ((HFP_EXPLICIT_CALL_TRANSFER_CFM_T *) message)->status));
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -