mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-27 23:30:47 +01:00
Sound (Android): adds new bluetooth device type
the Bluetooth LE hearing aid, the two Bluetooth peripheral-mode paths and the proxy endpoint.
This commit is contained in:
@@ -104,11 +104,11 @@ typedef enum FFSoundAndroidUsage : int32_t {
|
||||
#define FF_SOUND_ANDROID_NAME_REPLY_SIZE 512
|
||||
|
||||
// `AudioDeviceInfo.TYPE_*`, as the test device's own dex declares them (read out of
|
||||
// `Landroid/media/AudioDeviceInfo;`). The value is what `AudioDeviceAttributes.type` carries in the
|
||||
// reply; the names are the AOSP constant names without the prefix, which is what goes into
|
||||
// `identifier`, and a spelled out name, which is what the module prints. An unrecognised value is
|
||||
// reported rather than guessed at: a vendor is free to add types, and a wrong name is worse than
|
||||
// "Unknown Device".
|
||||
// `Landroid/media/AudioDeviceInfo;` -- most recently on Android 17, which had added four). The
|
||||
// value is what `AudioDeviceAttributes.type` carries in the reply; the names are the AOSP constant
|
||||
// names without the prefix, which is what goes into `identifier`, and a spelled out name, which is
|
||||
// what the module prints. An unrecognised value is reported rather than guessed at: a vendor is
|
||||
// free to add types, and a wrong name is worse than "Unknown Device".
|
||||
typedef enum FFSoundAndroidDeviceType : int32_t {
|
||||
FF_SOUND_ANDROID_TYPE_UNKNOWN = 0,
|
||||
FF_SOUND_ANDROID_TYPE_BUILTIN_EARPIECE = 1,
|
||||
@@ -143,6 +143,11 @@ typedef enum FFSoundAndroidDeviceType : int32_t {
|
||||
FF_SOUND_ANDROID_TYPE_BLE_BROADCAST = 30,
|
||||
FF_SOUND_ANDROID_TYPE_DOCK_ANALOG = 31,
|
||||
FF_SOUND_ANDROID_TYPE_MULTICHANNEL_GROUP = 32,
|
||||
FF_SOUND_ANDROID_TYPE_BLE_HEARING_AID = 33,
|
||||
FF_SOUND_ANDROID_TYPE_BLE_CENTRAL = 34,
|
||||
FF_SOUND_ANDROID_TYPE_BLE_CENTRAL_BROADCAST = 35,
|
||||
// 36 to 79 have no constant in the Android 17 release, and 80 is the highest it declares.
|
||||
FF_SOUND_ANDROID_TYPE_PROXY = 80,
|
||||
} FFSoundAndroidDeviceType;
|
||||
|
||||
typedef struct FFSoundAndroidDeviceName {
|
||||
@@ -185,6 +190,10 @@ static const FFSoundAndroidDeviceName FF_SOUND_ANDROID_DEVICE_NAMES[] = {
|
||||
{ FF_SOUND_ANDROID_TYPE_BLE_BROADCAST, "BLE_BROADCAST", "Bluetooth LE Broadcast" },
|
||||
{ FF_SOUND_ANDROID_TYPE_DOCK_ANALOG, "DOCK_ANALOG", "Dock (Analog)" },
|
||||
{ FF_SOUND_ANDROID_TYPE_MULTICHANNEL_GROUP, "MULTICHANNEL_GROUP", "Multichannel Group" },
|
||||
{ FF_SOUND_ANDROID_TYPE_BLE_HEARING_AID, "BLE_HEARING_AID", "Bluetooth LE Hearing Aid" },
|
||||
{ FF_SOUND_ANDROID_TYPE_BLE_CENTRAL, "BLE_CENTRAL", "Bluetooth LE Central" },
|
||||
{ FF_SOUND_ANDROID_TYPE_BLE_CENTRAL_BROADCAST, "BLE_CENTRAL_BROADCAST", "Bluetooth LE Central Broadcast" },
|
||||
{ FF_SOUND_ANDROID_TYPE_PROXY, "PROXY", "Proxy" },
|
||||
};
|
||||
|
||||
static const FFSoundAndroidDeviceName* soundAndroidDeviceName(int32_t type) {
|
||||
@@ -199,12 +208,16 @@ static const FFSoundAndroidDeviceName* soundAndroidDeviceName(int32_t type) {
|
||||
// The types that stand for a Bluetooth device. They are the ones whose own name is worth asking the
|
||||
// service for: everything else is described well enough by its type, and the request is one more
|
||||
// round trip to system_server. A hearing aid is on the list because it is a Bluetooth LE link with
|
||||
// a name of its own, the same as a headset.
|
||||
// a name of its own, the same as a headset. The other three types Android 17 added stay off it:
|
||||
// BLE_CENTRAL and BLE_CENTRAL_BROADCAST name an audio path inside this device while it operates in
|
||||
// a Bluetooth peripheral mode rather than a device on the far end of a link, and PROXY is a logical
|
||||
// endpoint rather than a link at all.
|
||||
static bool soundAndroidIsBluetooth(int32_t type) {
|
||||
switch ((FFSoundAndroidDeviceType) type) {
|
||||
case FF_SOUND_ANDROID_TYPE_BLUETOOTH_SCO:
|
||||
case FF_SOUND_ANDROID_TYPE_BLUETOOTH_A2DP:
|
||||
case FF_SOUND_ANDROID_TYPE_HEARING_AID:
|
||||
case FF_SOUND_ANDROID_TYPE_BLE_HEARING_AID:
|
||||
case FF_SOUND_ANDROID_TYPE_BLE_HEADSET:
|
||||
case FF_SOUND_ANDROID_TYPE_BLE_SPEAKER:
|
||||
case FF_SOUND_ANDROID_TYPE_BLE_BROADCAST:
|
||||
|
||||
Reference in New Issue
Block a user