⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 针对bluelab3.42的handsfree车载蓝牙的参考
💻 C
📖 第 1 页 / 共 5 页
字号:
            
        case A2DP_OPEN_IND:
            MAIN_DEBUG(("A2DP_OPEN_IND\n"));
                    
            switch(current_a2dp_state)
            {
                case avHeadsetA2dpReady:
                    avHeadsetHandleA2dpOpenInd(&app, (A2DP_OPEN_IND_T*) message);
                    break;
                    
                case avHeadsetA2dpInitialising:
                case avHeadsetA2dpConnected:
                case avHeadsetA2dpStreaming:
                case avHeadsetA2dpInitiating:
                default:
                    unhandledA2dpState(current_a2dp_state, id);
                    break;      
            }
            break;
            
        case A2DP_OPEN_CFM:
            MAIN_DEBUG(("A2DP_OPEN_CFM\n"));
            
            switch(current_a2dp_state)
            {
                case avHeadsetA2dpInitiating:
                    avHeadsetHandleA2dpOpenCfm(&app, (A2DP_OPEN_CFM_T*) message);
                    break;
                    
                case avHeadsetA2dpStreaming:
                case avHeadsetA2dpConnected:
                case avHeadsetA2dpReady:
                case avHeadsetA2dpInitialising:
                default:
                    unhandledA2dpState(current_a2dp_state, id);
                    break;      
            }
            break;
                        
        case A2DP_START_IND:
            MAIN_DEBUG(("A2DP_START_IND\n"));
                    
            switch(current_a2dp_state)
            {
                case avHeadsetA2dpConnected:
                    avHeadsetHandleA2dpStartInd(&app, (A2DP_START_IND_T*) message);
                    break;
                    
                case avHeadsetA2dpReady:
                case avHeadsetA2dpInitialising:
                case avHeadsetA2dpStreaming:
                case avHeadsetA2dpInitiating:
                default:
                    unhandledA2dpState(current_a2dp_state, id);
                    break;      
            }
            break;
            
        case A2DP_START_CFM:
            MAIN_DEBUG(("A2DP_START_CFM\n"));
                    
            switch(current_a2dp_state)
            {
                case avHeadsetA2dpInitiating:
                case avHeadsetA2dpConnected:
                    avHeadsetHandleA2dpStartCfm(&app, (A2DP_START_CFM_T*) message);
                    break;
                    
                case avHeadsetA2dpReady:
                case avHeadsetA2dpStreaming:
                    break;
                    
                case avHeadsetA2dpInitialising:
                default:
                    unhandledA2dpState(current_a2dp_state, id);
                    break;      
            }
            break;
            
        case A2DP_SUSPEND_IND:
            MAIN_DEBUG(("A2DP_SUSPEND_IND\n"));
                    
            switch(current_a2dp_state)
            {
                case avHeadsetA2dpStreaming:
                    avHeadsetHandleA2dpSuspendInd(&app);
                    break;
                    
                case avHeadsetA2dpReady:
                case avHeadsetA2dpInitialising:
                case avHeadsetA2dpConnected:
                case avHeadsetA2dpInitiating:
                default:
                    unhandledA2dpState(current_a2dp_state, id);
                    break;      
            }
            break;
            
        case A2DP_SUSPEND_CFM:
            MAIN_DEBUG(("A2DP_SUSPEND_CFM\n"));
                    
            switch(current_a2dp_state)
            {
                case avHeadsetA2dpStreaming:
				case avHeadsetA2dpConnected:
                    avHeadsetHandleA2dpSuspendCfm(&app, (A2DP_SUSPEND_CFM_T*) message);
                    break;
                    
                case avHeadsetA2dpReady:
                case avHeadsetA2dpInitialising:
                case avHeadsetA2dpInitiating:
                default:
                    unhandledA2dpState(current_a2dp_state, id);
                    break;      
            }
            break;
            
        case A2DP_CLOSE_IND:
            MAIN_DEBUG(("A2DP_CLOSE_IND\n"));
                    
            switch(current_a2dp_state)
            {
                case avHeadsetA2dpStreaming:
                case avHeadsetA2dpConnected:
				case avHeadsetA2dpReady:
                    avHeadsetHandleA2dpCloseInd(&app, (A2DP_CLOSE_IND_T *) message);
                    break;

                case avHeadsetA2dpInitialising:
                case avHeadsetA2dpInitiating:
                default:
                    unhandledA2dpState(current_a2dp_state, id);
                    break;      
            }
            break;
            
        case A2DP_CLOSE_CFM:
            MAIN_DEBUG(("A2DP_CLOSE_CFM\n"));
                    
            switch(current_a2dp_state)
            {
                case avHeadsetA2dpStreaming:
                case avHeadsetA2dpConnected:
                    avHeadsetHandleA2dpCloseCfm(&app);
                    headsetCheckPowerDownStatus(&app);
                    break;
                    
                case avHeadsetA2dpReady:
                    break;
                    
                case avHeadsetA2dpInitialising:
                case avHeadsetA2dpInitiating:
                default:
                    unhandledA2dpState(current_a2dp_state, id);
                    break;      
            }
            break;
            
            case A2DP_CODEC_SETTINGS_IND:
                MAIN_DEBUG(("A2DP_CODEC_SETTINGS_IND\n"));
                
                switch(current_a2dp_state)
                {
                case avHeadsetA2dpReady:
                case avHeadsetA2dpConnected:
                case avHeadsetA2dpInitiating:
                    avHeadsetHandleA2dpCodecSettingsInd(&app, (A2DP_CODEC_SETTINGS_IND_T *) message);
                    break;
                    
                case avHeadsetA2dpStreaming:
                case avHeadsetA2dpInitialising:
                default:
                    unhandledA2dpState(current_a2dp_state, id);
                    break;      
                }
                break;

        default:
            MAIN_DEBUG(("AV Headset - Unhandled a2dp msg 0x%x\n",id));
            break;
    }
}


/**************************************************************************/
static void hfp_msg_handler(MessageId id, Message message)
{
    headsetHfpState current_hfp_state = app.hfp_state;

    switch (id)
    {
        case HFP_INIT_CFM:
            MAIN_DEBUG(("HFP_INIT_CFM\n"));
            switch(current_hfp_state)
            {
            case headsetInitialising:
                {
                    HFP_INIT_CFM_T *msg = (HFP_INIT_CFM_T *) message;
                    if (msg->status == hfp_init_success)
                        hfpHeadsetInitComplete(&app, msg);
                    else
                        Panic();
                }
                break;

            case headsetReady:
            case headsetConnecting:
            case headsetConnected:
            case headsetOutgoingCallEstablish:
            case headsetIncomingCallEstablish:
            case headsetActiveCall:
            default:
                unhandledHfpState(current_hfp_state, id);
            }
            break;

        case HFP_SLC_CONNECT_IND:
            MAIN_DEBUG(("HFP_SLC_CONNECT_IND\n"));

            switch(current_hfp_state)
            {
            case headsetReady:
            case headsetConnecting:
            case headsetConnected:
            case headsetOutgoingCallEstablish:
            case headsetIncomingCallEstablish:
            case headsetActiveCall:
                hfpHeadsetHandleSlcConnectInd(&app, (HFP_SLC_CONNECT_IND_T *) message);
                break;

            case headsetInitialising:           
            default:
                unhandledHfpState(current_hfp_state, id);
            }
            break;

        case HFP_SLC_CONNECT_CFM:
            MAIN_DEBUG(("HFP_SLC_CONNECT_CFM %d\n",((HFP_SLC_CONNECT_CFM_T *) message)->status));
            
            switch(current_hfp_state)
            {
            case headsetConnecting:
            case headsetConnected:
            case headsetOutgoingCallEstablish:
            case headsetIncomingCallEstablish:
            case headsetActiveCall:
                hfpHeadsetHandleSlcConnectCfm(&app, (HFP_SLC_CONNECT_CFM_T *) message);
                break;

            case headsetReady:
            case headsetInitialising:           
            default:
                unhandledHfpState(current_hfp_state, id);
            }
            break;

        case HFP_SLC_DISCONNECT_IND:
            MAIN_DEBUG(("HFP_SLC_DISCONNECT_IND %d\n",((HFP_SLC_DISCONNECT_IND_T *) message)->status));
            
            switch(current_hfp_state)
            {
            case headsetConnecting:         
            case headsetConnected:
            case headsetOutgoingCallEstablish:
            case headsetIncomingCallEstablish:
            case headsetActiveCall:
                hfpHeadsetHandleSlcDisconnectInd(&app, (HFP_SLC_DISCONNECT_IND_T *) message);
                headsetCheckPowerDownStatus(&app);
                break;

            case headsetReady:
            case headsetInitialising:           
            default:
                unhandledHfpState(current_hfp_state, id);
            }
            break;

        case HFP_IN_BAND_RING_IND:
            MAIN_DEBUG(("HFP_IN_BAND_RING_IND\n"));
            switch(current_hfp_state)
            {
            case headsetConnecting:
            case headsetConnected:
            case headsetOutgoingCallEstablish:
            case headsetIncomingCallEstablish:
            case headsetActiveCall:
                hfpHeadsetHandleInBandRingInd(&app, (HFP_IN_BAND_RING_IND_T *) message);
                break;

            case headsetInitialising:
            case headsetReady:
            default:
                unhandledHfpState(current_hfp_state, id);
            }
            break;        

        case HFP_CALL_IND:
            MAIN_DEBUG(("HFP_CALL_IND %d\n",((HFP_CALL_IND_T *) message)->call));
            
            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:
            MAIN_DEBUG(("HFP_CALL_SETUP_IND %d\n",((HFP_CALL_SETUP_IND_T *) message)->call_setup));
            
            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:
            MAIN_DEBUG(("HFP_RING_IND\n"));
            
            switch(current_hfp_state)
            {
            case headsetConnected:
            case headsetIncomingCallEstablish:
            case headsetActiveCall:
                hfpHeadsetHandleRingInd(&app, (HFP_RING_IND_T *) message);
                break;

            case headsetConnecting:
            case headsetOutgoingCallEstablish:
                unhandledHfpState(current_hfp_state, id);
                break;

            case headsetInitialising:
            case headsetReady:
            default:
                unhandledHfpState(current_hfp_state, id);
            }
            break;
            
        case HFP_VOICE_RECOGNITION_IND:
            MAIN_DEBUG(("HFP_VOICE_RECOGNITION_IND %d\n",((HFP_VOICE_RECOGNITION_IND_T *) message)->enable));
            switch(current_hfp_state)
            {
            case headsetConnected:
            case headsetOutgoingCallEstablish:
                hfpHeadsetHandleVoiceRecognitionInd(&app, (HFP_VOICE_RECOGNITION_IND_T *) message);
                break;

            case headsetActiveCall:
            case headsetIncomingCallEstablish:
            case headsetConnecting:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -