FileDocCategorySizeDatePackage
BluetoothUtil.javaAPI DocAndroid 5.1 API9328Thu Mar 12 22:22:42 GMT 2015com.android.systemui.statusbar.policy

BluetoothUtil

public class BluetoothUtil extends Object

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.StringconnectionStateToString(int connectionState)

        if (connectionState == BluetoothAdapter.STATE_DISCONNECTED) return "STATE_DISCONNECTED";
        if (connectionState == BluetoothAdapter.STATE_CONNECTED) return "STATE_CONNECTED";
        if (connectionState == BluetoothAdapter.STATE_DISCONNECTING) return "STATE_DISCONNECTING";
        if (connectionState == BluetoothAdapter.STATE_CONNECTING) return "STATE_CONNECTING";
        return "ERROR";
    
public static java.lang.StringdeviceToString(android.bluetooth.BluetoothDevice device)

        return device == null ? null : (device.getAddress() + '[" + device.getAliasName() + ']");
    
public static com.android.systemui.statusbar.policy.BluetoothUtil$ProfilegetProfile(android.bluetooth.BluetoothProfile p)

        if (p instanceof BluetoothA2dp) return newProfile((BluetoothA2dp) p);
        if (p instanceof BluetoothHeadset) return newProfile((BluetoothHeadset) p);
        if (p instanceof BluetoothA2dpSink) return newProfile((BluetoothA2dpSink) p);
        if (p instanceof BluetoothHeadsetClient) return newProfile((BluetoothHeadsetClient) p);
        if (p instanceof BluetoothInputDevice) return newProfile((BluetoothInputDevice) p);
        if (p instanceof BluetoothMap) return newProfile((BluetoothMap) p);
        if (p instanceof BluetoothPan) return newProfile((BluetoothPan) p);
        return null;
    
private static com.android.systemui.statusbar.policy.BluetoothUtil$ProfilenewProfile(android.bluetooth.BluetoothHeadset headset)

        return new Profile() {
            @Override
            public boolean connect(BluetoothDevice device) {
                return headset.connect(device);
            }

            @Override
            public boolean disconnect(BluetoothDevice device) {
                return headset.disconnect(device);
            }
        };
    
private static com.android.systemui.statusbar.policy.BluetoothUtil$ProfilenewProfile(android.bluetooth.BluetoothA2dpSink sink)

        return new Profile() {
            @Override
            public boolean connect(BluetoothDevice device) {
                return sink.connect(device);
            }

            @Override
            public boolean disconnect(BluetoothDevice device) {
                return sink.disconnect(device);
            }
        };
    
private static com.android.systemui.statusbar.policy.BluetoothUtil$ProfilenewProfile(android.bluetooth.BluetoothHeadsetClient client)

        return new Profile() {
            @Override
            public boolean connect(BluetoothDevice device) {
                return client.connect(device);
            }

            @Override
            public boolean disconnect(BluetoothDevice device) {
                return client.disconnect(device);
            }
        };
    
private static com.android.systemui.statusbar.policy.BluetoothUtil$ProfilenewProfile(android.bluetooth.BluetoothInputDevice input)

        return new Profile() {
            @Override
            public boolean connect(BluetoothDevice device) {
                return input.connect(device);
            }

            @Override
            public boolean disconnect(BluetoothDevice device) {
                return input.disconnect(device);
            }
        };
    
private static com.android.systemui.statusbar.policy.BluetoothUtil$ProfilenewProfile(android.bluetooth.BluetoothMap map)

        return new Profile() {
            @Override
            public boolean connect(BluetoothDevice device) {
                return map.connect(device);
            }

            @Override
            public boolean disconnect(BluetoothDevice device) {
                return map.disconnect(device);
            }
        };
    
private static com.android.systemui.statusbar.policy.BluetoothUtil$ProfilenewProfile(android.bluetooth.BluetoothPan pan)

        return new Profile() {
            @Override
            public boolean connect(BluetoothDevice device) {
                return pan.connect(device);
            }

            @Override
            public boolean disconnect(BluetoothDevice device) {
                return pan.disconnect(device);
            }
        };
    
private static com.android.systemui.statusbar.policy.BluetoothUtil$ProfilenewProfile(android.bluetooth.BluetoothA2dp a2dp)

        return new Profile() {
            @Override
            public boolean connect(BluetoothDevice device) {
                return a2dp.connect(device);
            }

            @Override
            public boolean disconnect(BluetoothDevice device) {
                return a2dp.disconnect(device);
            }
        };
    
public static java.lang.StringprofileStateToString(int state)

        if (state == BluetoothProfile.STATE_CONNECTED) return "STATE_CONNECTED";
        if (state == BluetoothProfile.STATE_CONNECTING) return "STATE_CONNECTING";
        if (state == BluetoothProfile.STATE_DISCONNECTED) return "STATE_DISCONNECTED";
        if (state == BluetoothProfile.STATE_DISCONNECTING) return "STATE_DISCONNECTING";
        return "STATE_UNKNOWN";
    
public static java.lang.StringprofileToString(int profile)

        if (profile == BluetoothProfile.HEADSET) return "HEADSET";
        if (profile == BluetoothProfile.A2DP) return "A2DP";
        if (profile == BluetoothProfile.AVRCP_CONTROLLER) return "AVRCP_CONTROLLER";
        if (profile == BluetoothProfile.PAN) return "PAN";
        if (profile == BluetoothProfile.INPUT_DEVICE) return "INPUT_DEVICE";
        if (profile == BluetoothProfile.MAP) return "MAP";
        return "UNKNOWN(" + profile + ")";
    
public static intuuidToProfile(android.os.ParcelUuid uuid)

        if (BluetoothUuid.AudioSink.equals(uuid)) return BluetoothProfile.A2DP;
        if (BluetoothUuid.AdvAudioDist.equals(uuid)) return BluetoothProfile.A2DP;

        if (BluetoothUuid.HSP.equals(uuid)) return BluetoothProfile.HEADSET;
        if (BluetoothUuid.Handsfree.equals(uuid)) return BluetoothProfile.HEADSET;

        if (BluetoothUuid.MAP.equals(uuid)) return BluetoothProfile.MAP;
        if (BluetoothUuid.MNS.equals(uuid)) return BluetoothProfile.MAP;
        if (BluetoothUuid.MAS.equals(uuid)) return BluetoothProfile.MAP;

        if (BluetoothUuid.AvrcpController.equals(uuid)) return BluetoothProfile.AVRCP_CONTROLLER;

        if (BluetoothUuid.Hid.equals(uuid)) return BluetoothProfile.INPUT_DEVICE;
        if (BluetoothUuid.Hogp.equals(uuid)) return BluetoothProfile.INPUT_DEVICE;

        if (BluetoothUuid.NAP.equals(uuid)) return BluetoothProfile.PAN;

        return 0;
    
public static java.lang.StringuuidToString(android.os.ParcelUuid uuid)

        if (BluetoothUuid.AudioSink.equals(uuid)) return "AudioSink";
        if (BluetoothUuid.AudioSource.equals(uuid)) return "AudioSource";
        if (BluetoothUuid.AdvAudioDist.equals(uuid)) return "AdvAudioDist";
        if (BluetoothUuid.HSP.equals(uuid)) return "HSP";
        if (BluetoothUuid.HSP_AG.equals(uuid)) return "HSP_AG";
        if (BluetoothUuid.Handsfree.equals(uuid)) return "Handsfree";
        if (BluetoothUuid.Handsfree_AG.equals(uuid)) return "Handsfree_AG";
        if (BluetoothUuid.AvrcpController.equals(uuid)) return "AvrcpController";
        if (BluetoothUuid.AvrcpTarget.equals(uuid)) return "AvrcpTarget";
        if (BluetoothUuid.ObexObjectPush.equals(uuid)) return "ObexObjectPush";
        if (BluetoothUuid.Hid.equals(uuid)) return "Hid";
        if (BluetoothUuid.Hogp.equals(uuid)) return "Hogp";
        if (BluetoothUuid.PANU.equals(uuid)) return "PANU";
        if (BluetoothUuid.NAP.equals(uuid)) return "NAP";
        if (BluetoothUuid.BNEP.equals(uuid)) return "BNEP";
        if (BluetoothUuid.PBAP_PSE.equals(uuid)) return "PBAP_PSE";
        if (BluetoothUuid.MAP.equals(uuid)) return "MAP";
        if (BluetoothUuid.MNS.equals(uuid)) return "MNS";
        if (BluetoothUuid.MAS.equals(uuid)) return "MAS";
        return uuid != null ? uuid.toString() : null;
    
public static java.lang.StringuuidsToString(android.bluetooth.BluetoothDevice device)

        if (device == null) return null;
        final ParcelUuid[] ids = device.getUuids();
        if (ids == null) return null;
        final String[] tokens = new String[ids.length];
        for (int i = 0; i < tokens.length; i++) {
            tokens[i] = uuidToString(ids[i]);
        }
        return TextUtils.join(",", tokens);