如何使用标准UUID格式

时间:2015-09-18 09:43:22

标签: android bluetooth uuid android-bluetooth

为什么我在logcat输出中收到如下所示的UUID格式?在阅读了UUID之后,我预计格式如下

de305d54-75b4-431b-adb2-eb6b9e546014

我编写的用于获取UUID的代码是:

case BluetoothDevice.ACTION_UUID:
        Log.w(TAG, SubTag.msg("BluetoothDevice.ACTION_UUID"));

        Parcelable[] extraUUID = intent.getParcelableArrayExtra(BluetoothDevice.EXTRA_UUID);

        if (extraUUID.length > 0) {
            Log.i(getClass().getSimpleName(), SubTag.msg("onReceive", "extraUUID: "+extraUUID.toString()));
        }

        break;

logcat的

09-18 11:35:51.622: W/BT_Receiver(8608): >>[BluetoothDevice.ACTION_UUID()]<<
09-18 11:35:51.622: I/BT_Receiver(8608): [onReceive()]-> extraUUID: [Landroid.os.Parcelable;@2e610c87
09-18 11:35:54.472: W/BT_Receiver(8608): >>[BluetoothDevice.ACTION_UUID()]<<
09-18 11:35:54.482: I/BT_Receiver(8608): [onReceive()]-> extraUUID: [Landroid.os.Parcelable;@36a16fdd
09-18 11:35:54.862: W/BT_Receiver(8608): >>[BluetoothDevice.ACTION_UUID()]<<
09-18 11:35:54.862: I/BT_Receiver(8608): [onReceive()]-> extraUUID: [Landroid.os.Parcelable;@34378b20

1 个答案:

答案 0 :(得分:1)

Landroid.os.Parcelable;@2e610c87

Parcelable[].toString()的表示。您可能希望循环数组并在索引处调用toString()到元素。 E.g。

for (Parcelable p : extraUUID) {
     Log.i(getClass().getSimpleName(), SubTag.msg("onReceive", "extraUUID: "+p.toString()))
}