boolean isCandidateDevice(BluetoothDevice device) { int deviceClass=device.getBluetoothClass().getDeviceClass(); return(((deviceClass & BluetoothClass.Device.Major.COMPUTER)== BluetoothClass.Device.Major.COMPUTER) || ((deviceClass & BluetoothClass.Device.Major.PHONE)== BluetoothClass.Device.Major.PHONE) || ((deviceClass & BluetoothClass.Device.Major.AUDIO_VIDEO)== BluetoothClass.Device.Major.AUDIO_VIDEO)); } }
public BluetoothClassAssert hasDeviceClass(int deviceClass) { isNotNull(); int actualClass = actual.getDeviceClass(); assertThat(actualClass) // .overridingErrorMessage("Expected device class <%s> but was <%s>.", deviceClassToString(deviceClass), deviceClassToString(actualClass)) // .isEqualTo(actualClass); return this; }
int deviceClass = bluetoothClass.getDeviceClass(); if (deviceClass == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE || deviceClass == BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET)
BluetoothClass bluetoothClass = bluetoothDevice.getBluetoothClass(); if(bluetoothClass.getDeviceClass() == BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES) { // allow user to select this device. I'm not sure exactly which type // headphones will be but this is a good guess. You can connect to // your Bluetooth headset to find out for sure. }
BluetoothClass cls = device.getBluetoothClass(); switch (cls.getMajorDeviceClass()) { case BluetoothClass.Device.Major.PERIPHERAL: switch (cls.getDeviceClass() & 0x05C0) { case 0x0540: // Keyboard - 1314 break; case 0x05C0: // Keyboard + mouse combo. break; case 0x0580: // Mouse - 1408 break; default: // Other. break; } }
/** * Gets the bluetooth device class name. * * @return the bluetooth device class name */ public String getBluetoothDeviceClassName() { return BluetoothClassResolver.resolveDeviceClass(mDevice.getBluetoothClass().getDeviceClass()); }
public BluetoothClassAssert hasDeviceClass(int deviceClass) { isNotNull(); int actualClass = actual.getDeviceClass(); assertThat(actualClass) // .overridingErrorMessage("Expected device class <%s> but was <%s>.", deviceClassToString(deviceClass), deviceClassToString(actualClass)) // .isEqualTo(actualClass); return this; }
/*package*/BluetoothDeviceInfo(final BluetoothDevice device) { name = device.getName(); address = device.getAddress(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { type = device.getType(); } else { type = 0; } final BluetoothClass clazz = device.getBluetoothClass(); deviceClass = clazz != null ? clazz.getDeviceClass() : 0; bondState = device.getBondState(); }
int deviceClass = bluetoothClass.getDeviceClass(); if (deviceClass == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE || deviceClass == BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET) {
int deviceClass = bluetoothClass.getDeviceClass(); if (deviceClass == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE || deviceClass == BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET) {
type = (isMiscOrUncategorized(device.getBluetoothClass().getDeviceClass())) ? device.getBluetoothClass().getMajorDeviceClass() : device.getBluetoothClass().getDeviceClass(); } else { type = btClass.getDeviceClass();
private void updateClass() { if (device.getBluetoothClass() == null) { return; } switch (device.getBluetoothClass().getDeviceClass()) { case BluetoothClass.Device.PHONE_CELLULAR: case BluetoothClass.Device.PHONE_SMART: case BluetoothClass.Device.PHONE_UNCATEGORIZED: setIcon(R.drawable.ic_bt_phone); break; case BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES: case BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET: case BluetoothClass.Device.AUDIO_VIDEO_LOUDSPEAKER: setIcon(R.drawable.ic_bt_headset); break; case BluetoothClass.Device.WEARABLE_WRIST_WATCH: setIcon(R.drawable.ic_bt_watch); break; case BluetoothClass.Device.WEARABLE_GLASSES: setIcon(R.drawable.ic_bt_glass); break; default: // fall out } notifyChanged(); }
int type = BluetoothClass.Device.Major.UNCATEGORIZED; if (bluetoothClass != null) { final int deviceClass = bluetoothClass.getDeviceClass(); type = (deviceClass == 0 || deviceClass == BluetoothClass.Device.Major.UNCATEGORIZED) ? bluetoothClass.getMajorDeviceClass() bluetoothClass == null ? null : bluetoothClass.getDeviceClass()); final SharedPreferences prefs = mainActivity.getSharedPreferences( ListFragment.SHARED_PREFS, 0 );