我正在尝试理解dumpsys bluetooth_manager的结果。更具体地说,我想通过查看dumpsys输出来了解蓝牙适配器的不同状态。例如,如果蓝牙已启用/禁用、是否可连接/可发现、是否正在扫描或是否已配对或绑定。
通过查看虚拟心理的输出,我可以说Bluetooth Status部分下的state: 12应该可以回答我的问题。然而,我无法解释状态值是什么意思。例如,12表示bluetooth_on,10表示bluetooth_off。
我尝试查看Android蓝牙适配器文档来解决这个问题。然而,并非dumpsys报告中的所有状态值都与Android文档中的常量值匹配。如果有人能帮我的话我会很感激的。
下面是一个虚拟心理结果的例子:
Bluetooth Status
enabled: true
state: 12
address: 64:BC:0C:F9:3A:59
name: Nexus 5X
Bonded devices:
Profile: BtGatt.GattService
mAdvertisingServiceUuids:
mMaxScanFilters: 0
GATT Client Map
Entries: 0
GATT Server Map
Entries: 0
GATT Handle Map
Entries: 0
Requests: 0
Profile: HeadsetService
mCurrentDevice: null
mTargetDevice: null
mIncomingDevice: null
mActiveScoDevice: null
mMultiDisconnectDevice: null
mVirtualCallStarted: false
mVoiceRecognitionStarted: false
mWaitingForVoiceRecognition: false
StateMachine: HeadsetStateMachine:
total records=4
rec[0]: time=07-31 14:49:06.420 processed=Disconnected org=Disconnected dest=<null> what=10(0xa)
rec[1]: time=07-31 14:49:06.420 processed=<null> org=Disconnected dest=<null> what=11(0xb)
rec[2]: time=07-31 14:49:07.048 processed=Disconnected org=Disconnected dest=<null> what=10(0xa)
rec[3]: time=07-31 14:49:37.126 processed=Disconnected org=Disconnected dest=<null> what=10(0xa)
curState=Disconnected
mPhoneState: com.android.bluetooth.hfp.HeadsetPhoneState@14b5ce6
mAudioState: 10
Profile: A2dpService
mCurrentDevice: null
mTargetDevice: null
mIncomingDevice: null
mPlayingA2dpDevice: null
StateMachine: A2dpStateMachine:
total records=0
curState=Disconnected
AVRCP:
mMetadata: Metadata[artist=null trackTitle=null albumTitle=null]
mTransportControlFlags: 0
mCurrentPlayState: 0
mPlayStatusChangedNT: 1
mTrackChangedNT: 1
mTrackNumber: -1
mCurrentPosMs: 0
mPlayStartTimeMs: -1
mSongLengthMs: 0
mPlaybackIntervalMs: 0
mPlayPosChangedNT: 1
mNextPosMs: 0
mPrevPosMs: 0
mSkipStartTime: 0
mFeatures: 0
mAbsoluteVolume: -1
mLastSetVolume: -1
mLastDirection: 0
mVolumeStep: 8
mAudioStreamMax: 15
mVolCmdInProgress: false
mAbsVolRetryTimes: 0
mSkipAmount: 0
Profile: HidService
mTargetDevice: null
mInputDevices:
Profile: HealthService
mHealthChannels:
mApps:
mHealthDevices:
Profile: PanService
mMaxPanDevices: 5
mPanIfName: bt-pan
mTetherOn: false
mPanDevices:
mBluetoothIfaceAddresses:
Profile: BluetoothMapService
mRemoteDevice: null
sRemoteDeviceName: null
mState: 0
mAppObserver: com.android.bluetooth.map.BluetoothMapAppObserver@348d227
mIsWaitingAuthorization: false
mRemoveTimeoutMsg: false
mPermission: 0
mAccountChanged: false
mBluetoothMnsObexClient: null
mMasInstanceMap:
null : MasId: 0 Uri:null SMS/MMS:true
mEnabledAccounts:
Profile: SapService
Connection Events:
None发布于 2019-08-20 01:09:26
对于开源项目,查看source code通常比阅读文档更好:
public @interface AdapterState {}
/**
* Indicates the local Bluetooth adapter is off.
*/
public static final int STATE_OFF = 10;
/**
* Indicates the local Bluetooth adapter is turning on. However local
* clients should wait for {@link #STATE_ON} before attempting to
* use the adapter.
*/
public static final int STATE_TURNING_ON = 11;
/**
* Indicates the local Bluetooth adapter is on, and ready for use.
*/
public static final int STATE_ON = 12;
/**
* Indicates the local Bluetooth adapter is turning off. Local clients
* should immediately attempt graceful disconnection of any remote links.
*/
public static final int STATE_TURNING_OFF = 13;
/**
* Indicates the local Bluetooth adapter is turning Bluetooth LE mode on.
*
* @hide
*/
public static final int STATE_BLE_TURNING_ON = 14;
/**
* Indicates the local Bluetooth adapter is in LE only mode.
*
* @hide
*/
public static final int STATE_BLE_ON = 15;
/**
* Indicates the local Bluetooth adapter is turning off LE only mode.
*
* @hide
*/
public static final int STATE_BLE_TURNING_OFF = 16;https://stackoverflow.com/questions/57299411
复制相似问题