-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
150 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 35 additions & 22 deletions
57
...ller-client/src/main/java/one/microproject/rpi/powercontroller/PowerControllerClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,58 @@ | ||
package one.microproject.rpi.powercontroller; | ||
|
||
import one.microproject.rpi.powercontroller.dto.JobId; | ||
import one.microproject.rpi.powercontroller.dto.JobInfo; | ||
import one.microproject.rpi.powercontroller.dto.Measurements; | ||
import one.microproject.rpi.powercontroller.dto.SystemInfo; | ||
import one.microproject.rpi.powercontroller.dto.SystemState; | ||
import one.microproject.rpi.powercontroller.dto.TaskFilter; | ||
import one.microproject.rpi.powercontroller.dto.TaskId; | ||
import one.microproject.rpi.powercontroller.dto.TaskInfo; | ||
|
||
import java.util.Collection; | ||
import java.util.Optional; | ||
|
||
public interface PowerControllerClient { | ||
|
||
SystemInfo getSystemInfo(); | ||
|
||
SystemState getSystemState(); | ||
|
||
Measurements getMeasurements(); | ||
|
||
Collection<JobInfo> getSystemJobs(); | ||
|
||
JobId killAllJobId(); | ||
|
||
Collection<TaskInfo> getAllTasks(); | ||
|
||
Collection<TaskInfo> getTasks(TaskFilter filter); | ||
public interface PowerControllerClient extends PowerControllerReadClient { | ||
|
||
/** | ||
* Set OUTPUT port state (ON=true | OFF=false) | ||
* @param port output port index. | ||
* @param state required output port state. | ||
* @return resulting output port state. | ||
*/ | ||
boolean setPortState(Integer port, Boolean state); | ||
|
||
/** | ||
* Submit task for execution. | ||
* @param id {@link JobId} unique ID of jop to be submitted as new task. | ||
* @return unique {@link TaskId} of submitted task. | ||
*/ | ||
Optional<TaskId> submitTask(JobId id); | ||
|
||
/** | ||
* Cancel running task. | ||
* @param id unique {@link TaskId}. | ||
* @return True if the task has been cancelled, false otherwise. | ||
*/ | ||
boolean cancelTask(TaskId id); | ||
|
||
/** | ||
* Cancel all running task. | ||
* @return True if action succeeded, False otherwise. | ||
*/ | ||
boolean cancelAllTasks(); | ||
|
||
/** | ||
* Blocking wait for the starting task. | ||
* @param id unique {@link TaskId}. | ||
* @return True if action succeeded, False otherwise. | ||
*/ | ||
boolean waitForTaskStarted(TaskId id); | ||
|
||
/** | ||
* Blocking wait for the task termination. | ||
* @param id unique {@link TaskId}. | ||
* @return True if action succeeded, False otherwise. | ||
*/ | ||
boolean waitForTaskTermination(TaskId id); | ||
|
||
/** | ||
* Clean task queue, remove all tasks in terminal state. | ||
* @return True if action succeeded, False otherwise. | ||
*/ | ||
boolean cleanTaskQueue(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...-client/src/main/java/one/microproject/rpi/powercontroller/PowerControllerReadClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package one.microproject.rpi.powercontroller; | ||
|
||
import one.microproject.rpi.powercontroller.dto.JobId; | ||
import one.microproject.rpi.powercontroller.dto.JobInfo; | ||
import one.microproject.rpi.powercontroller.dto.Measurements; | ||
import one.microproject.rpi.powercontroller.dto.SystemInfo; | ||
import one.microproject.rpi.powercontroller.dto.SystemState; | ||
import one.microproject.rpi.powercontroller.dto.TaskFilter; | ||
import one.microproject.rpi.powercontroller.dto.TaskInfo; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* Read data from RPi Power Controller. | ||
* https://github.com/jveverka/rpi-projects/tree/master/rpi-powercontroller | ||
*/ | ||
public interface PowerControllerReadClient { | ||
|
||
/** | ||
* Get {@link SystemInfo} for this RPi Power Controller. | ||
* @return {@link SystemInfo} | ||
*/ | ||
SystemInfo getSystemInfo(); | ||
|
||
/** | ||
* Get {@link SystemState} for this RPi Power Controller. | ||
* @return {@link SystemState} | ||
*/ | ||
SystemState getSystemState(); | ||
|
||
/** | ||
* Get sensor(s) {@link Measurements} for this RPi Power Controller. | ||
* @return {@link Measurements} | ||
*/ | ||
Measurements getMeasurements(); | ||
|
||
/** | ||
* Get {@link JobInfo} for available pre-configured Jobs for this RPi Power Controller. | ||
* @return Collection of {@link JobInfo}. | ||
*/ | ||
Collection<JobInfo> getSystemJobs(); | ||
|
||
/** | ||
* Get {@link JobId} of 'kill all' job for this RPi Power Controller. | ||
* @return {@link JobId} | ||
*/ | ||
JobId getKillAllJobId(); | ||
|
||
/** | ||
* Get task queue (waiting, in-progress, finished) tasks. | ||
* @return Collection of {@link TaskInfo} | ||
*/ | ||
Collection<TaskInfo> getAllTasks(); | ||
|
||
/** | ||
* Get filtered task queue (waiting, in-progress, finished) tasks. | ||
* @param filter {@link TaskFilter} task filter criteria. | ||
* @return Collection of {@link TaskInfo} | ||
*/ | ||
Collection<TaskInfo> getTasks(TaskFilter filter); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.