FileDocCategorySizeDatePackage
BluetoothUuidTest.javaAPI DocAndroid 5.1 API2550Thu Mar 12 22:22:12 GMT 2015android.bluetooth

BluetoothUuidTest

public class BluetoothUuidTest extends TestCase
Unit test cases for {@link BluetoothUuid}.

To run this test, use adb shell am instrument -e class 'android.bluetooth.BluetoothUuidTest' -w 'com.android.bluetooth.tests/android.bluetooth.BluetoothTestRunner'

Fields Summary
Constructors Summary
Methods Summary
public voidtestUuidParser()

        byte[] uuid16 = new byte[] {
                0x0B, 0x11 };
        assertEquals(ParcelUuid.fromString("0000110B-0000-1000-8000-00805F9B34FB"),
                BluetoothUuid.parseUuidFrom(uuid16));

        byte[] uuid32 = new byte[] {
                0x0B, 0x11, 0x33, (byte) 0xFE };
        assertEquals(ParcelUuid.fromString("FE33110B-0000-1000-8000-00805F9B34FB"),
                BluetoothUuid.parseUuidFrom(uuid32));

        byte[] uuid128 = new byte[] {
                0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, (byte) 0xFF };
        assertEquals(ParcelUuid.fromString("FF0F0E0D-0C0B-0A09-0807-0060504030201"),
                BluetoothUuid.parseUuidFrom(uuid128));
    
public voidtestUuidType()

        assertTrue(BluetoothUuid.is16BitUuid(
                ParcelUuid.fromString("0000110B-0000-1000-8000-00805F9B34FB")));
        assertFalse(BluetoothUuid.is32BitUuid(
                ParcelUuid.fromString("0000110B-0000-1000-8000-00805F9B34FB")));

        assertFalse(BluetoothUuid.is16BitUuid(
                ParcelUuid.fromString("FE33110B-0000-1000-8000-00805F9B34FB")));
        assertTrue(BluetoothUuid.is32BitUuid(
                ParcelUuid.fromString("FE33110B-0000-1000-8000-00805F9B34FB")));
        assertFalse(BluetoothUuid.is32BitUuid(
                ParcelUuid.fromString("FE33110B-1000-1000-8000-00805F9B34FB")));