@Test public void onConnectionStateChangedConnectedUnbondedTest() throws Exception { when(device.getBondState()).thenReturn(BOND_NONE); BluetoothGattCallback callback = connectAndGetCallback(); callback.onConnectionStateChange(gatt, GATT_SUCCESS, BluetoothProfile.STATE_CONNECTED); verify(gatt).discoverServices(); }
public int getBondState() { return device.getBondState(); }
BluetoothPeripheral { public int getBondState() { return device.getBondState(); } }
BluetoothPeripheral { public int getBondState() { return device.getBondState(); } BluetoothPeripheral(@NotNull Context context, @NotNull BluetoothDevice device, @NotNull InternalCallback listener, BluetoothPeripheralCallback peripheralCallback, Handler callbackHandler); }
BluetoothPeripheral { public int getBondState() { return device.getBondState(); } BluetoothPeripheral(@NotNull Context context, @NotNull BluetoothDevice device, @NotNull InternalCallback listener, BluetoothPeripheralCallback peripheralCallback, Handler callbackHandler); boolean createBond(); boolean requestConnectionPriority(final int priority); void cancelConnection(); @NotNull String getAddress(); int getType(); String getName(); int getBondState(); @SuppressWarnings("WeakerAccess") @NotNull List<BluetoothGattService> getServices(); @Nullable BluetoothGattService getService(@NotNull UUID serviceUUID); @Nullable BluetoothGattCharacteristic getCharacteristic(@NotNull UUID serviceUUID, @NotNull UUID characteristicUUID); int getState(); int getCurrentMtu(); boolean isNotifying(@NotNull BluetoothGattCharacteristic characteristic); boolean readCharacteristic(@NotNull final BluetoothGattCharacteristic characteristic); boolean writeCharacteristic(@NotNull final BluetoothGattCharacteristic characteristic, @NotNull final byte[] value, final int writeType); boolean readDescriptor(@NotNull final BluetoothGattDescriptor descriptor); boolean writeDescriptor(@NotNull final BluetoothGattDescriptor descriptor, @NotNull final byte[] value); boolean setNotify(@NotNull final BluetoothGattCharacteristic characteristic, final boolean enable); boolean clearServicesCache(); boolean readRemoteRssi(); boolean requestMtu(final int mtu); }
BluetoothPeripheral { public int getBondState() { return device.getBondState(); } BluetoothPeripheral(@NotNull Context context, @NotNull BluetoothDevice device, @NotNull InternalCallback listener, BluetoothPeripheralCallback peripheralCallback, Handler callbackHandler); boolean createBond(); boolean requestConnectionPriority(final int priority); void cancelConnection(); @NotNull String getAddress(); int getType(); String getName(); int getBondState(); @SuppressWarnings("WeakerAccess") @NotNull List<BluetoothGattService> getServices(); @Nullable BluetoothGattService getService(@NotNull UUID serviceUUID); @Nullable BluetoothGattCharacteristic getCharacteristic(@NotNull UUID serviceUUID, @NotNull UUID characteristicUUID); int getState(); int getCurrentMtu(); boolean isNotifying(@NotNull BluetoothGattCharacteristic characteristic); boolean readCharacteristic(@NotNull final BluetoothGattCharacteristic characteristic); boolean writeCharacteristic(@NotNull final BluetoothGattCharacteristic characteristic, @NotNull final byte[] value, final int writeType); boolean readDescriptor(@NotNull final BluetoothGattDescriptor descriptor); boolean writeDescriptor(@NotNull final BluetoothGattDescriptor descriptor, @NotNull final byte[] value); boolean setNotify(@NotNull final BluetoothGattCharacteristic characteristic, final boolean enable); boolean clearServicesCache(); boolean readRemoteRssi(); boolean requestMtu(final int mtu); @SuppressWarnings("WeakerAccess")
    static final int GATT_SUCCESS; @SuppressWarnings("WeakerAccess")
    static final int GATT_CONN_L2C_FAILURE; @SuppressWarnings("WeakerAccess")
    static final int GATT_CONN_TIMEOUT; @SuppressWarnings("WeakerAccess")
    static final int GATT_READ_NOT_PERMITTED; @SuppressWarnings("WeakerAccess")
    static final int GATT_WRITE_NOT_PERMITTED; @SuppressWarnings("WeakerAccess")
    static final int GATT_INSUFFICIENT_AUTHENTICATION; @SuppressWarnings("WeakerAccess")
    static final int GATT_REQUEST_NOT_SUPPORTED; @SuppressWarnings("WeakerAccess")
    static final int GATT_INSUFFICIENT_ENCRYPTION; @SuppressWarnings("WeakerAccess")
    static final int GATT_CONN_TERMINATE_PEER_USER; @SuppressWarnings("WeakerAccess")
    static final int GATT_CONN_TERMINATE_LOCAL_HOST; @SuppressWarnings("WeakerAccess")
    static final int GATT_CONN_LMP_TIMEOUT; @SuppressWarnings("WeakerAccess")
    static final int BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE; @SuppressWarnings("WeakerAccess")
    static final int GATT_CONN_FAIL_ESTABLISH; @SuppressWarnings("WeakerAccess")
    static final int GATT_NO_RESOURCES; @SuppressWarnings("WeakerAccess")
    static final int GATT_INTERNAL_ERROR; @SuppressWarnings("WeakerAccess")
    static final int GATT_BUSY; @SuppressWarnings("WeakerAccess")
    static final int GATT_ERROR; @SuppressWarnings("WeakerAccess")
    static final int GATT_AUTH_FAIL; @SuppressWarnings("WeakerAccess")
    static final int GATT_CONN_CANCEL; @SuppressWarnings("WeakerAccess")
    static final int DEVICE_TYPE_UNKNOWN; @SuppressWarnings("WeakerAccess")
    static final int DEVICE_TYPE_CLASSIC; @SuppressWarnings("WeakerAccess")
    static final int DEVICE_TYPE_LE; @SuppressWarnings("WeakerAccess")
    static final int DEVICE_TYPE_DUAL; @SuppressWarnings("WeakerAccess")
    static final int BOND_NONE; @SuppressWarnings("WeakerAccess")
    static final int BOND_BONDING; @SuppressWarnings("WeakerAccess")
    static final int BOND_BONDED; @SuppressWarnings("WeakerAccess")
    static final int STATE_DISCONNECTED; @SuppressWarnings("WeakerAccess")
    static final int STATE_CONNECTING; @SuppressWarnings("WeakerAccess")
    static final int STATE_CONNECTED; @SuppressWarnings("WeakerAccess")
    static final int STATE_DISCONNECTING; }