|
|
|
@ -65,16 +65,16 @@ public class ClassicBluetoothHelper: NSObject, CBCentralManagerDelegate { |
|
|
|
case .stateChanged: |
|
|
|
if let state = data["state"] as? String { |
|
|
|
print("蓝牙状态变化: \(state)") |
|
|
|
configureAudioRouteBasedOnBluetoothState() |
|
|
|
// configureAudioRouteBasedOnBluetoothState() |
|
|
|
} |
|
|
|
case .deviceConnected: |
|
|
|
print("蓝牙设备已连接") |
|
|
|
// 蓝牙设备连接时:末端在手机,输出端在耳机 |
|
|
|
configureAudioForBluetoothConnected() |
|
|
|
// configureAudioForBluetoothConnected() |
|
|
|
case .deviceDisconnected: |
|
|
|
print("蓝牙设备已断开") |
|
|
|
// 蓝牙设备断开时:末端和输出端都在手机 |
|
|
|
configureAudioForBluetoothDisconnected() |
|
|
|
/*configureAudioForBluetoothDisconnected*/() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -382,4 +382,4 @@ public class ClassicBluetoothHelper: NSObject, CBCentralManagerDelegate { |
|
|
|
print("向Flutter端报告的蓝牙状态: \(state.rawValue)") |
|
|
|
stateCallback?(.stateChanged, ["state": state.rawValue]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|