Android bluetooth事件:240404正在返回怪异的bluetooth deviceClass

Android bluetooth事件:240404正在返回怪异的bluetooth deviceClass,android,bluetooth,Android,Bluetooth,我正在使用广播接收器尝试查找蓝牙耳机何时连接/断开与android设备的连接 val filter = IntentFilter() filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED) filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED) filter.addAction(BluetoothDevice.ACTI

我正在使用广播接收器尝试查找蓝牙耳机何时连接/断开与android设备的连接

 val filter = IntentFilter()
        filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED)
        filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED)
        filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED)
我是这样处理这件事的:

   device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE)
   val major = device?.bluetoothClass?.majorDeviceClass;
   val bluetoothClass = device?.bluetoothClass ?: return
我得到的是

  • major
    1024
    (即
    BluetoothClass.Device.major.AUDIO\u VIDEO
    哪个是正确的)
  • bluetoothClass.deviceClass
    as
    240404
    but

我用错误的属性来比较它吗?

我太傻了,我在比较错误的东西。我要比较的是

我太傻了,我比较错了。我要比较的是