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

📄 main.c

📁 CSR蓝牙芯片 无线蓝牙耳机的语音网关程序 蓝牙耳机程序已经上传
💻 C
📖 第 1 页 / 共 5 页
字号:
        case HFP_VOICE_TAG_NUMBER_CFM:
            break;

        case HFP_UNRECOGNISED_AT_CMD_IND:
            {
                uint16 i;
                HFP_UNRECOGNISED_AT_CMD_IND_T *ind = (HFP_UNRECOGNISED_AT_CMD_IND_T *) message;
    
				DEBUG(("HFP_UNRECOGNISED_AT_CMD_IND len %d\n", ind->size_data));
                for (i=0; i<ind->size_data; i++)
                {
                    DEBUG(("%c", ind->data[i]));
                }
                DEBUG(("\n"));
            }
            break;

        case HFP_EXTRA_INDICATOR_INDEX_IND:
            {
                /*
                HFP_EXTRA_INDICATOR_INDEX_IND_T *ind = (HFP_EXTRA_INDICATOR_INDEX_IND_T *)message;
                DEBUG(("extra ind in %d ci %d min %d max %d\n",
                    ind->indicator_register_index, ind->indicator_index, ind->min_range, ind->max_range));
                */
            }
            break;

        case HFP_EXTRA_INDICATOR_UPDATE_IND:
            DEBUG(("extra ind update\n"));
            break;      
            
        case HFP_DISABLE_NREC_CFM:
        case HFP_CALLER_ID_ENABLE_CFM:
        case HFP_CALL_WAITING_ENABLE_CFM:
        case HFP_DTMF_CFM:
		case HFP_SINK_CFM:
            break;
        
        case HFP_HS_BUTTON_PRESS_CFM:
            DEBUG(("HFP msg\n"));
            unhandledHfpState(current_hfp_state, id);
            break;

        case CL_SM_PIN_CODE_IND:
            DEBUG(("CL_SM_PIN_IND\n"));
            headsetHandlePinCodeInd((CL_SM_PIN_CODE_IND_T*) message);
            break;
            
        case CL_SM_AUTHORISE_IND:
            DEBUG(("CL_SM_AUTHORISE_IND\n"));
            headsetHandleAuthoriseInd((CL_SM_AUTHORISE_IND_T*) message);
            break;
            
        case CL_SM_AUTHENTICATE_CFM:
            DEBUG(("CL_SM_AUTHENTICATE_CFM\n"));
            headsetHandleAuthenticateCfm((CL_SM_AUTHENTICATE_CFM_T*) message);
            break;
            
        case CL_DM_REMOTE_FEATURES_CFM:
            headsetHandleRemoteSuppFeatures(&app, (CL_DM_REMOTE_FEATURES_CFM_T *) message);
            break;

		case CL_SM_ENCRYPTION_CHANGE_IND:
        case CL_DM_ROLE_CFM:
        case CL_DM_INQUIRE_RESULT:
        case CL_DM_REMOTE_NAME_COMPLETE:
        case CL_DM_CLASS_OF_DEVICE_CFM:
        case CL_DM_SCO_CONNECT_CFM:
        case CL_DM_SCO_CONNECT_IND:
        case CL_DM_SCO_DISCONNECT_IND:
        case CL_DM_LOCAL_BD_ADDR_CFM:
        case CL_DM_LINK_QUALITY_CFM:
        case CL_DM_RSSI_CFM:
        case CL_DM_CLOCK_OFFSET_CFM:
		case CL_DM_ACL_OPENED_IND:
		case CL_DM_ACL_CLOSED_IND:
        case CL_SM_SECURITY_LEVEL_CFM:
        case CL_SDP_UNREGISTER_CFM:
        case CL_SDP_OPEN_SEARCH_CFM:
        case CL_SDP_CLOSE_SEARCH_CFM:
        case CL_SDP_SERVICE_SEARCH_CFM:
        case CL_SDP_ATTRIBUTE_SEARCH_CFM:
        case CL_SDP_SERVICE_SEARCH_ATTRIBUTE_CFM:
        case CL_L2CAP_REGISTER_CFM:
        case CL_L2CAP_UNREGISTER_CFM:
        case CL_L2CAP_CONNECT_CFM:
        case CL_L2CAP_CONNECT_IND:
        case CL_L2CAP_DISCONNECT_IND:
        case CL_RFCOMM_REGISTER_CFM:
        case CL_RFCOMM_CONNECT_CFM:
        case CL_RFCOMM_CONNECT_IND:
        case CL_RFCOMM_DISCONNECT_IND:
        case CL_RFCOMM_CONTROL_IND:
        case CL_DM_LINK_POLICY_IND:
            DEBUG(("Ignored Connection Lib msg 0x%x\n",id));
            break;
            
        case APP_LED_UPDATE_IND:
            app.led_state = updateLED(&app, app.led_state);
            break;
            
        case APP_MUSIC_RESTART_IND:
            DEBUG(("APP_MUSIC_RESTART_IND\n"));
            if (app.a2dp_state != avHeadsetA2dpStreaming)
            {
                DEBUG(("Av not streaming\n"));
                if(app.sent_suspend && app.av_stream_stopped)
                    avHeadsetAvStreamStart(&app);
            }
            else
            {
                avHeadsetAvStreamStart(&app);
            }
            break;
            
        case APP_DISCONNECT_HFP_SLC_IND:
            DEBUG(("APP_DISCONNECT_HFP_SLC_IND\n"));
            /* The remote end disabled encryption so close down the SLC */
            hfpHeadsetDisconnectSlc(&app);
            break;
            
        case APP_HFP_SLC_REQ:
            switch(current_hfp_state)
            {           
            case headsetReady:
                hfpHeadsetHandleSlcConnectRequest(&app, hfp_handsfree_profile);
                break;
                
            case headsetConnecting:
                app.button_action_pending_lock = 1;
                break;
                
            case headsetConnected:
            case headsetIncomingCallEstablish:
            case headsetActiveCall:
            case headsetOutgoingCallEstablish:
            case headsetInitialising:
            default:
                app.button_action_pending_lock = 0;
            }    
            break;
            
        case APP_HFP_SLC_TIMEOUT_IND:
			switch(current_hfp_state)
            {           
            case headsetConnecting:  
                /* Now connect timeout has occured, don't try another reconnect attempt */
				app.button_action_pending_lock = 1;
				break;   
            
            case headsetReady:
            case headsetConnected:
            case headsetIncomingCallEstablish:
            case headsetActiveCall:
            case headsetOutgoingCallEstablish:
            case headsetInitialising:
            default:
				app.button_action_pending_lock = 0;
            }    
            break;

        case VOL_UP:
            DEBUG(("VOL_UP\n"));
            if (app.active_profile == av_active)
            {
                switch(current_a2dp_state)
                {
                    case avHeadsetA2dpReady:
                    case avHeadsetA2dpConnected:
                    case avHeadsetA2dpStreaming:
                    case avHeadsetA2dpDisconnecting:
                    case avHeadsetA2dpInitiating:
                        avHeadsetHandleAvVolUp(&app);
                        break;
                    
                    case avHeadsetA2dpInitialising:
                    default:
                        unhandledA2dpState(current_a2dp_state, id);
                        break;      
                }
            }
            else if ((app.active_profile == hfp_active) && !app.button_action_pending_lock)
            {
                switch(current_hfp_state)
                {           
                case headsetReady:
                case headsetConnecting:
                    break;

                case headsetConnected:
                case headsetIncomingCallEstablish:
                case headsetActiveCall:
                case headsetOutgoingCallEstablish:
                    {
                        HFP *instance = 0;
						DEBUG(("Volume UP hfp_active.\n"));

                        /* If HFP send volume cmd but if HSP make sure we have a SCO open. */
                        if (app.profile_connected == hfp_handsfree_profile)
                            instance = app.hfp;
                        else if ((app.profile_connected == hfp_headset_profile) && app.sco_sink)
                            instance = app.hsp;
                        else
                            break;

                        /* Send a volume up request */
                        avHeadsetHandleHfVolUp(&app);

                        /* Send the AT cmd to inform the AG of the vol change */
                        HfpSendSpeakerVolume(instance, app.speaker_volume >> VOLUME_SHIFT);
                    }
                    break;

                case headsetInitialising:
                default:
                    unhandledHfpState(current_hfp_state, id);
                }
            }
            break;
            
        case VOL_DOWN:
            DEBUG(("VOL_DOWN\n"));
            if (app.active_profile == av_active)
            {
                switch(current_a2dp_state)
                {
                    case avHeadsetA2dpReady:
                    case avHeadsetA2dpConnected:
                    case avHeadsetA2dpStreaming:
                    case avHeadsetA2dpDisconnecting:
                    case avHeadsetA2dpInitiating:
                        avHeadsetHandleAvVolDown(&app);
                        break;
                    
                    case avHeadsetA2dpInitialising:
                    default:
                        unhandledA2dpState(current_a2dp_state, id);
                        break;      
                }
            }
            else if ((app.active_profile == hfp_active) && !app.button_action_pending_lock)
            {
                switch(current_hfp_state)
                {           
                case headsetReady:
                case headsetConnecting:
                    break;

                case headsetConnected:
                case headsetIncomingCallEstablish:
                case headsetActiveCall:
                case headsetOutgoingCallEstablish:
                    {
                        HFP *instance = 0;

                        /* If HFP send volume cmd but if HSP make sure we have a SCO open. */
                        if (app.profile_connected == hfp_handsfree_profile)
                            instance = app.hfp;
                        else if ((app.profile_connected == hfp_headset_profile) && app.sco_sink)
                            instance = app.hsp;
                        else 
                            break;

                        /* Send a volume down request */
                        avHeadsetHandleHfVolDown(&app);

                        /* Send the AT cmd to inform the AG of the vol change */
                        HfpSendSpeakerVolume(instance, app.speaker_volume >> VOLUME_SHIFT);
                    }
                    break;

                case headsetInitialising:
                default:
                    unhandledHfpState(current_hfp_state, id);
                }
            }
            break;
            
        case BUTTON_FORWARD_PRESS:
            DEBUG(("BUTTON_FORWARD_PRESS\n"));
            if (app.active_profile == av_active)
            {
                switch(current_avrcp_state)
                {
                    case avHeadsetAvrcpConnected:
                    case avHeadsetAvrcpDisconnecting:
                        avHeadsetForwardPress(&app);
                        break;
                    case avHeadsetAvrcpReady:
                    case avHeadsetAvrcpInitialising:
                    case avHeadsetAvrcpConnecting:
                    default:
                        unhandledAvrcpState(current_avrcp_state, id);
                        break;      
                }
            }
            break;
        case BUTTON_FORWARD_REL:
            DEBUG(("BUTTON_FORWARD_REL\n"));
            if (app.active_profile == av_active)
            {
                switch(current_avrcp_state)
                {
                    case avHeadsetAvrcpConnected:
                    case avHeadsetAvrcpDisconnecting:
                        avHeadsetForwardRelease(&app);
                        break;
                    case avHeadsetAvrcpReady:
                    case avHeadsetAvrcpInitialising:
                    case avHeadsetAvrcpConnecting:
                    default:
                        unhandledAvrcpState(current_avrcp_state, id);
                        break;      
                }
            }
            break;
        case BUTTON_BACKWARD_PRESS:
            DEBUG(("BUTTON_BACKWARD_PRESS\n"));
            if (app.active_profile == av_active)
            {
                switch(current_avrcp_state)
                {
                    case avHeadsetAvrcpConnected:
                    case avHeadsetAvrcpDisconnecting:
                        avHeadsetBackwardPress(&app);
                        break;
                    case avHeadsetAvrcpReady:
                    case avHeadsetAvrcpInitialising:
                    case avHeadsetAvrcpConnecting:
                    default:
                        unhandledAvrcpState(current_avrcp_state, id);
                        break;      
                }
            }
#ifdef INCLUDE_CVC			
			if (app.active_profile == hfp_active)
				CvcHeadsetRewind(getApp());
#endif
            break;
        case BUTTON_BACKWARD_REL:
            DEBUG(("BUTTON_BACKWARD_REL\n"));
            if (app.active_profile == av_active)
            {
                switch(current_avrcp_state)
                {
                    case avHeadsetAvrcpConnected:
                    case avHeadsetAvrcpDisconnecting:
                        avHeadsetBackwardRelease(&app);
                        break;
                    case avHeadsetAvrcpReady:

⌨️ 快捷键说明

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