FileDocCategorySizeDatePackage
ScanSettingsTest.javaAPI DocAndroid 5.1 API2339Thu Mar 12 22:22:12 GMT 2015android.bluetooth.le

ScanSettingsTest

public class ScanSettingsTest extends TestCase
Test for Bluetooth LE {@link ScanSettings}.

Fields Summary
Constructors Summary
Methods Summary
public voidtestCallbackType()

        ScanSettings.Builder builder = new ScanSettings.Builder();
        builder.setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES);
        builder.setCallbackType(ScanSettings.CALLBACK_TYPE_FIRST_MATCH);
        builder.setCallbackType(ScanSettings.CALLBACK_TYPE_MATCH_LOST);
        builder.setCallbackType(
                ScanSettings.CALLBACK_TYPE_FIRST_MATCH | ScanSettings.CALLBACK_TYPE_MATCH_LOST);
        try {
            builder.setCallbackType(
                    ScanSettings.CALLBACK_TYPE_ALL_MATCHES | ScanSettings.CALLBACK_TYPE_MATCH_LOST);
            fail("should have thrown IllegalArgumentException!");
        } catch (IllegalArgumentException e) {
            // nothing to do
        }

        try {
            builder.setCallbackType(
                    ScanSettings.CALLBACK_TYPE_ALL_MATCHES |
                    ScanSettings.CALLBACK_TYPE_FIRST_MATCH);
            fail("should have thrown IllegalArgumentException!");
        } catch (IllegalArgumentException e) {
            // nothing to do
        }

        try {
            builder.setCallbackType(
                    ScanSettings.CALLBACK_TYPE_ALL_MATCHES |
                    ScanSettings.CALLBACK_TYPE_FIRST_MATCH |
                    ScanSettings.CALLBACK_TYPE_MATCH_LOST);
            fail("should have thrown IllegalArgumentException!");
        } catch (IllegalArgumentException e) {
            // nothing to do
        }