
com.xtremelabs.robolectric.shadows.ShadowBluetoothAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robolectric Show documentation
Show all versions of robolectric Show documentation
An alternative Android testing framework.
package com.xtremelabs.robolectric.shadows;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import com.xtremelabs.robolectric.Robolectric;
import com.xtremelabs.robolectric.internal.Implementation;
import com.xtremelabs.robolectric.internal.Implements;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import static com.xtremelabs.robolectric.Robolectric.shadowOf;
@SuppressWarnings({"UnusedDeclaration"})
@Implements(BluetoothAdapter.class)
public class ShadowBluetoothAdapter {
private Set bondedDevices = new HashSet();
private boolean isDiscovering;
@Implementation
public static BluetoothAdapter getDefaultAdapter() {
return shadowOf(Robolectric.application).getBluetoothAdapter();
}
@Implementation
public Set getBondedDevices() {
return Collections.unmodifiableSet(bondedDevices);
}
public void setBondedDevices(Set bluetoothDevices) {
bondedDevices = bluetoothDevices;
}
@Implementation
public boolean startDiscovery() {
isDiscovering = true;
return true;
}
@Implementation
public boolean cancelDiscovery() {
isDiscovering = false;
return true;
}
@Implementation
public boolean isDiscovering() {
return isDiscovering;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy