📄 headset_init.c
字号:
/****************************************************************************Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006Part of BlueLab 3.5.2-releaseFILE NAME headset_init.cDESCRIPTION NOTES*//**************************************************************************** Header files*/#include "headset_private.h"#include "headset_init.h"#include "headset_config.h"#include <connection.h>#include <hfp.h>#include <panic.h>/****************************************************************************NAME headsetHfpInit DESCRIPTION Initialise HFP libraryRETURNS void*/void headsetHfpInit( hsTaskData * pApp ){ hfp_init_params init; /*make sure the features we are using are configured*/ uint16 lSupportedFeatures = configManagerSupportedFeatures (pApp) ; configManagerHFP_1_5_SupportedFeatures(pApp) ; DEBUG(("INIT: HFP Supp[%x] HFP1.5[%c]\n", lSupportedFeatures , (pApp->HFP_1_5_supp_features.HFP_1_5_Is_Enabled)?'T':'F' )) ; /* Initialise an HFP profile instance */ /*default to handsfree 1.0*/ init.supported_profile = hfp_handsfree_profile; if ( pApp->HFP_1_5_supp_features.HFP_1_5_Is_Enabled) { init.supported_profile = hfp_handsfree_15_profile ; } init.supported_features = lSupportedFeatures; init.size_service_record = 0 ; init.service_record = 0 ; init.priority = 255 ; HfpInit(getAppTask(), &init ); /* Initialise an HSP profile instance */ init.supported_profile = hfp_headset_profile; init.supported_features = 0; init.priority = 255 ; init.size_service_record = 0 ; init.service_record = 0 ; HfpInit(getAppTask(), &init );}/****************************************************************************NAME headsetInitComplete DESCRIPTION Headset initialisation has completed. RETURNS void*/void headsetInitComplete(hsTaskData *app, const HFP_INIT_CFM_T *cfm){ /* Make sure the profile instance initialisation succeeded. */ if (cfm->status == hfp_init_success) { /* Check for an hfp instance, that's registered first */ if (!app->hfp) { /* This must be the hfp instance */ app->hfp = cfm->hfp; } else { /* Its not HFP so must be HSP */ app->hsp = cfm->hfp; /* Set the class of device to indicate this is a headset */ ConnectionWriteClassOfDevice(AUDIO_MAJOR_SERV_CLASS | AV_MAJOR_DEVICE_CLASS | AV_MINOR_HEADSET); /* Disable SDP security */ ConnectionSmSetSdpSecurityIn(TRUE); /* Register a service record if there is one to be found */ if (get_service_record_length() ) { ConnectionRegisterServiceRecord(getAppTask(), get_service_record_length(), get_service_record() ); } /* Send an internal message to indicate init has completed */ MessageSend(getAppTask(), HEADSET_INIT_CFM, 0); } } else /* If the profile initialisation has failed then things are bad so panic. */ Panic();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -