Button: Add doPressButton() and doReleaseButton() to Button class
As every Button has a node-specific implementation part, this should be the minimal interface to the backend node emulator for pressing and releasing a button.
This commit is contained in:
parent
378ca2629d
commit
be88a4fc52
5 changed files with 42 additions and 8 deletions
|
@ -128,7 +128,8 @@ public class ContikiButton extends Button implements ContikiMoteInterface {
|
|||
});
|
||||
}
|
||||
|
||||
private void doReleaseButton() {
|
||||
@Override
|
||||
protected void doReleaseButton() {
|
||||
moteMem.setByteValueOf("simButtonIsDown", (byte) 0);
|
||||
|
||||
if (moteMem.getByteValueOf("simButtonIsActive") == 1) {
|
||||
|
@ -142,7 +143,8 @@ public class ContikiButton extends Button implements ContikiMoteInterface {
|
|||
}
|
||||
}
|
||||
|
||||
private void doPressButton() {
|
||||
@Override
|
||||
protected void doPressButton() {
|
||||
moteMem.setByteValueOf("simButtonIsDown", (byte) 1);
|
||||
|
||||
if (moteMem.getByteValueOf("simButtonIsActive") == 1) {
|
||||
|
|
|
@ -59,11 +59,21 @@ public abstract class Button extends MoteInterface {
|
|||
*/
|
||||
public abstract void releaseButton();
|
||||
|
||||
/**
|
||||
* Node-type dependent implementation of pressing a button.
|
||||
*/
|
||||
protected abstract void doPressButton();
|
||||
|
||||
/**
|
||||
* Presses button (if not already pressed).
|
||||
*/
|
||||
public abstract void pressButton();
|
||||
|
||||
/**
|
||||
* Node-type dependent implementation of releasing a button.
|
||||
*/
|
||||
protected abstract void doReleaseButton();
|
||||
|
||||
/**
|
||||
* @return True if button is pressed
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue