I am working with Android BluetoothAdapter class to scan and connect to BLE devices. While testing, one log that came up from this class logged a BluetoothAdapter State of "STATE_BLE_ON". After some research, there are modes that the Adapter can be placed in so the user can turn off the classic bluetooth but leave LE on. However, when I dug into the code of the BluetoothAdapter class, there is no way to access this state. The only states that can be accessed are STATE_ON, STATE_OFF, STATE_TURNING_ON, STATE_TURNING_OFF. So how is the testing device Logging this state? Even on Android Developers website they do not mention the STATE_BLE_ON state. This state is in the BluetoothAdapter class, I just do not see anywhere it is accessed, nor do I know how it could Log this state on a testing device. BluetoothAdapter.getState() below.
* Get the current state of the local Bluetooth adapter.
* <p>Possible return values are
* {@link #STATE_OFF},
* {@link #STATE_TURNING_ON},
* {@link #STATE_ON},
* {@link #STATE_TURNING_OFF}.
*
* @return current state of Bluetooth adapter
@RequiresPermission(Manifest.permission.BLUETOOTH)
@AdapterState
public int getState() {
int state = getStateInternal();
// Consider all internal states as OFF
if (state == BluetoothAdapter.STATE_BLE_ON || state == BluetoothAdapter.STATE_BLE_TURNING_ON
|| state == BluetoothAdapter.STATE_BLE_TURNING_OFF) {
if (VDBG) {
Log.d(TAG, "Consider " + BluetoothAdapter.nameForState(state) + " state as OFF");
}
state = BluetoothAdapter.STATE_OFF;
}
if (VDBG) {
Log.d(TAG, "" + hashCode() + ": getState(). Returning " + BluetoothAdapter.nameForState(
state));
}
return state;
}***