Skip to content

Instantly share code, notes, and snippets.

@sontqq
Created October 16, 2021 08:05
Show Gist options
  • Save sontqq/a9a4e25639732d19247b829a88907020 to your computer and use it in GitHub Desktop.
Save sontqq/a9a4e25639732d19247b829a88907020 to your computer and use it in GitHub Desktop.
private String getDeviceClass(BluetoothDevice bluetoothDevice) {
int devclass = bluetoothDevice.getBluetoothClass().getDeviceClass();
if (devclass == BluetoothClass.Device.Major.COMPUTER) {
return "PC";
} else if (devclass == BluetoothClass.Device.Major.PHONE) {
return "PHONE";
} else if (devclass == BluetoothClass.Device.Major.AUDIO_VIDEO) {
return "AUDIO_VIDEO";
} else if (devclass == BluetoothClass.Device.Major.HEALTH) {
return "HEALTH";
} else if (devclass == BluetoothClass.Device.Major.IMAGING) {
return "IMAGING";
} else if (devclass == BluetoothClass.Device.Major.MISC) {
return "MISC";
} else if (devclass == BluetoothClass.Device.Major.NETWORKING) {
return "NETWORKING";
} else if (devclass == BluetoothClass.Device.Major.PERIPHERAL) {
return "PERIPHERAL";
} else if (devclass == BluetoothClass.Device.Major.TOY) {
return "TOY";
} else if (devclass == BluetoothClass.Device.Major.WEARABLE) {
return "WEARABLE";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_CAMCORDER) {
return "AUDIO_VIDEO_CAMCORDER";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_CAR_AUDIO) {
return "AUDIO_VIDEO_CAR_AUDIO";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
return "AUDIO_VIDEO_HANDSFREE";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES) {
return "AUDIO_VIDEO_HEADPHONE";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_HIFI_AUDIO) {
return "AUDIO_VIDEO_HIFI_AUDIO";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_LOUDSPEAKER) {
return "AUDIO_VIDEO_LOUDSPEAKER";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_MICROPHONE) {
return "AUDIO_VIDEO_MICROPHONE";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_PORTABLE_AUDIO) {
return "AUDIO_VIDEO_PORTABLE";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_SET_TOP_BOX) {
return "AUDIO_VIDEO_SET_TOP_BOX";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_VCR) {
return "AUDIO_VIDEO_VCR";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_VIDEO_CAMERA) {
return "AUDIO_VIDEO_VIDEO_CAMERA";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_VIDEO_CONFERENCING) {
return "AUDIO_VIDEO_VIDEO_CONFERENCING";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER) {
return "AUDIO_VIDEO_DISPLAY_AND_LOUDSPEAKER";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_VIDEO_GAMING_TOY) {
return "AUDIO_VIDEO_GAMING_TOY";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_VIDEO_MONITOR) {
return "AUDIO_VIDEO_MONITOR";
} else if (devclass == BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET) {
return "AUDIO_VIDEO_WEARABLE_HEADSET";
} else if (devclass == BluetoothClass.Device.COMPUTER_HANDHELD_PC_PDA) {
return "COMPUTER_PDA";
} else if (devclass == BluetoothClass.Device.COMPUTER_LAPTOP) {
return "COMPUTER_LAPTOP";
} else if (devclass == BluetoothClass.Device.COMPUTER_SERVER) {
return "COMPUTER_SERVER";
} else if (devclass == BluetoothClass.Device.COMPUTER_PALM_SIZE_PC_PDA) {
return "COMPUTER_PALM_SIZE_PDA";
} else if (devclass == BluetoothClass.Device.COMPUTER_UNCATEGORIZED) {
return "COMPUTER_UNCATEGORIZED";
} else if (devclass == BluetoothClass.Device.HEALTH_BLOOD_PRESSURE) {
return "HEALTH_BLOOD_PRESSURE";
} else if (devclass == BluetoothClass.Device.HEALTH_DATA_DISPLAY) {
return "HEALTH_DATA_DISPLAY";
} else if (devclass == BluetoothClass.Device.HEALTH_GLUCOSE) {
return "HEALTH_GLUCOSE";
} else if (devclass == BluetoothClass.Device.HEALTH_PULSE_OXIMETER) {
return "HEALTH_PULSE_OXIMETER";
} else if (devclass == BluetoothClass.Device.HEALTH_THERMOMETER) {
return "HEALTH_THERMOMETER";
} else if (devclass == BluetoothClass.Device.HEALTH_PULSE_RATE) {
return "HEALTH_PULSE_RATE";
} else if (devclass == BluetoothClass.Device.HEALTH_UNCATEGORIZED) {
return "HEALTH_UNCATEGORIZED";
} else if (devclass == BluetoothClass.Device.HEALTH_WEIGHING) {
return "HEALTH_WEIGHING";
} else if (devclass == BluetoothClass.Device.PHONE_CELLULAR) {
return "PHONE_CELLULAR";
} else if (devclass == BluetoothClass.Device.PHONE_CORDLESS) {
return "PHONE_CORDLESS";
} else if (devclass == BluetoothClass.Device.PHONE_ISDN) {
return "PHONE_ISDN";
} else if (devclass == BluetoothClass.Device.PHONE_SMART) {
return "PHONE_SMART";
} else if (devclass == BluetoothClass.Device.PHONE_MODEM_OR_GATEWAY) {
return "PHONE_MODE_OR_GATEWAY";
} else if (devclass == BluetoothClass.Device.PHONE_UNCATEGORIZED) {
return "PHONE_UNCATEGORIZED";
} else if (devclass == BluetoothClass.Device.TOY_CONTROLLER) {
return "TOY_CONTROLLER";
} else if (devclass == BluetoothClass.Device.TOY_DOLL_ACTION_FIGURE) {
return "DOLL_ACTION_FIGURE";
} else if (devclass == BluetoothClass.Device.TOY_GAME) {
return "TOY_GAME";
} else if (devclass == BluetoothClass.Device.TOY_ROBOT) {
return "TOY_ROBOT";
} else if (devclass == BluetoothClass.Device.TOY_VEHICLE) {
return "TOY_VEHICLE";
} else if (devclass == BluetoothClass.Device.TOY_UNCATEGORIZED) {
return "TOY_UNCATEGORIZED";
} else if (devclass == BluetoothClass.Device.WEARABLE_GLASSES) {
return "WEARABLE_GLASSES";
} else if (devclass == BluetoothClass.Device.WEARABLE_HELMET) {
return "WEARABLE_HELMET";
} else if (devclass == BluetoothClass.Device.WEARABLE_JACKET) {
return "WEARABLE_JACKET";
} else if (devclass == BluetoothClass.Device.WEARABLE_PAGER) {
return "WEARABLE_PAGER";
} else if (devclass == BluetoothClass.Device.WEARABLE_WRIST_WATCH) {
return "WEARABLE_WRIST_WATCH";
} else if (devclass == BluetoothClass.Device.WEARABLE_UNCATEGORIZED) {
return "WEARABLE_UNCATEGORIZED";
} else if (devclass == BluetoothClass.Device.Major.UNCATEGORIZED) {
return "UNCATEGORIZED_" + devclass;
} else {
return "OTHER_" + devclass;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment