add option to force enable or disable bluetooth adapter

This commit is contained in:
MajorCrazed
2017-10-29 23:30:47 +01:00
parent e6b1597fa7
commit cefe2b09e0
5 changed files with 56 additions and 15 deletions

View File

@@ -0,0 +1,20 @@
package org.briarproject.bramble.api.plugin.event;
import org.briarproject.bramble.api.event.Event;
/**
* to force enable and disable bluetooth
* force enable means that the bluetooth adapter stay enabled until a force DisableBluetoothEvent is called
* force disable stop the bluetooth adapter only when we turned it on
*/
abstract class BluetoothEvent extends Event {
private boolean force;
BluetoothEvent(boolean force){
this.force = force;
}
public boolean isForced(){
return force;
}
}

View File

@@ -11,5 +11,12 @@ import javax.annotation.concurrent.Immutable;
*/
@Immutable
@NotNullByDefault
public class DisableBluetoothEvent extends Event {
public class DisableBluetoothEvent extends BluetoothEvent {
public DisableBluetoothEvent(){
super(false);
}
public DisableBluetoothEvent(boolean force) {
super(force);
}
}

View File

@@ -10,5 +10,12 @@ import javax.annotation.concurrent.Immutable;
*/
@Immutable
@NotNullByDefault
public class EnableBluetoothEvent extends Event {
public class EnableBluetoothEvent extends BluetoothEvent {
public EnableBluetoothEvent(){
super(false);
}
public EnableBluetoothEvent(boolean force){
super(force);
}
}