建立通话,如何连接蓝牙耳机SCO
2013-01-18 16:01
399 查看
1)通话之前,ACL是连接好的。在PoneApp里用了bluetoothhandfree这个类.在onCreate方法中,定义了bluetoothhandfree的对象,并把CM的信息传给了bluetoothhandfree类里。
if (BluetoothAdapter.getDefaultAdapter() != null) {
// Start BluetoothHandsree even if device is not voice capable.
// The device can still support VOIP.
mBtHandsfree = BluetoothHandsfree.init(this, mCM);
startService(new Intent(this, BluetoothHeadsetService.class));
} else {
// Device is not bluetooth capable
mBtHandsfree = null;
}
2)有电话被激活时,PhoneApp收到由PhoneProxy发送的intent ACTION_RADIO_TECHNOLOGY_CHANGED.
else if (action.equals(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED)) {
String newPhone = intent.getStringExtra(Phone.PHONE_NAME_KEY);
Log.d(LOG_TAG, "Radio technology switched. Now " + newPhone + " is active.");
initForNewRadioTechnology();
}
3)在initForNewRadioTechnology私有方法中
if (mBtHandsfree != null) {
mBtHandsfree.updateBtHandsfreeAfterRadioTechnologyChange();
}当RadioTechnology有变化时,交由bluetoothhandfree处理;
4)BluetoothHandfree处理:
void updateBtHandsfreeAfterRadioTechnologyChange() {
if (VDBG) Log.d(TAG, "updateBtHandsfreeAfterRadioTechnologyChange...");
mBluetoothPhoneState.updateBtPhoneStateAfterRadioTechnologyChange();
}
mBluetoothPhoneState.updateBtPhoneStateAfterRadioTechnologyChange()的处理:
//Register all events new to the new active phone
mCM.getDefaultPhone().registerForServiceStateChanged(mStateChangeHandler,SERVICE_STATE_CHANGED, null);
mCM.registerForPreciseCallStateChanged(mStateChangeHandler,PRECISE_CALL_STATE_CHANGED, null);
mCM.registerForCallWaiting(mStateChangeHandler,PHONE_CDMA_CALL_WAITING, null);
5)BluetoothHandfree处理注册的消息,在有变化时;
handlePreciseCallStateChange,这个方法将处理响铃和通话和蓝牙相关的东西,包括连接SCO,用AudioManager设置声音通道等。
if (BluetoothAdapter.getDefaultAdapter() != null) {
// Start BluetoothHandsree even if device is not voice capable.
// The device can still support VOIP.
mBtHandsfree = BluetoothHandsfree.init(this, mCM);
startService(new Intent(this, BluetoothHeadsetService.class));
} else {
// Device is not bluetooth capable
mBtHandsfree = null;
}
2)有电话被激活时,PhoneApp收到由PhoneProxy发送的intent ACTION_RADIO_TECHNOLOGY_CHANGED.
else if (action.equals(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED)) {
String newPhone = intent.getStringExtra(Phone.PHONE_NAME_KEY);
Log.d(LOG_TAG, "Radio technology switched. Now " + newPhone + " is active.");
initForNewRadioTechnology();
}
3)在initForNewRadioTechnology私有方法中
if (mBtHandsfree != null) {
mBtHandsfree.updateBtHandsfreeAfterRadioTechnologyChange();
}当RadioTechnology有变化时,交由bluetoothhandfree处理;
4)BluetoothHandfree处理:
void updateBtHandsfreeAfterRadioTechnologyChange() {
if (VDBG) Log.d(TAG, "updateBtHandsfreeAfterRadioTechnologyChange...");
mBluetoothPhoneState.updateBtPhoneStateAfterRadioTechnologyChange();
}
mBluetoothPhoneState.updateBtPhoneStateAfterRadioTechnologyChange()的处理:
//Register all events new to the new active phone
mCM.getDefaultPhone().registerForServiceStateChanged(mStateChangeHandler,SERVICE_STATE_CHANGED, null);
mCM.registerForPreciseCallStateChanged(mStateChangeHandler,PRECISE_CALL_STATE_CHANGED, null);
mCM.registerForCallWaiting(mStateChangeHandler,PHONE_CDMA_CALL_WAITING, null);
5)BluetoothHandfree处理注册的消息,在有变化时;
handlePreciseCallStateChange,这个方法将处理响铃和通话和蓝牙相关的东西,包括连接SCO,用AudioManager设置声音通道等。
相关文章推荐
- mt6735 [Audio Policy]连接蓝牙耳机,通话时声音路径切换到听筒或者喇叭,触屏时听不到触屏音
- Android与蓝牙耳机建立连接的分析
- Android跟蓝牙耳机建立连接有两种方式
- 建立到蓝牙耳机的连接
- 蓝牙耳机拨打电话和VOIP通话两种方式对于上层来说创建SCO过程的区别
- 如何用蓝牙耳机连接xp输出音频
- Android与蓝牙耳机建立连接的分析
- Android跟蓝牙耳机建立连接有两种方式
- 教你如何建立mysql远程连接root权限用户
- 蓝牙BLE如何连接连接多台设备
- 教你如何用电脑通过蓝牙连接手机上网
- 蓝牙耳机连接笔记本电脑Think E430C
- Android中如何实现蓝牙的配对与连接
- Windows Mobile中如何建立GPRS连接以便Socket能正常通信
- 在Visual C++中如何利用UDL文件来建立ADO连接
- Win7 64bit 环境如何对32bit Office建立OleDB 连接
- SecureCRT如何与GNS3上的路由建立连接
- 如何将蓝牙和802.11结合起来提供高速无线连接
- 笔记本电脑连接蓝牙耳机设备