public class Automation
extends java.lang.Object
import static com.github.niqdev.openwebnet.OpenWebNet.defaultGateway;
// move shutter up
OpenWebNet
.newClient(defaultGateway("IP_ADDRESS"))
.send(Automation.requestMoveUp("WHERE"))
.map(Automation.handleResponse(() -> System.out.println("success"), () -> System.out.println("fail")))
.subscribe(System.out::println);
Modifier and Type | Class and Description |
---|---|
static class |
Automation.Type |
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
FORMAT_BUS |
protected static java.lang.String |
FORMAT_DIMENSION |
protected static java.lang.String |
FORMAT_PREFIX_DIMENSION |
protected static java.lang.String |
FORMAT_PREFIX_DIMENSION_WHO |
protected static java.lang.String |
FORMAT_PREFIX_REQUEST_WHO |
protected static java.lang.String |
FORMAT_PREFIX_RESPONSE |
protected static java.lang.String |
FORMAT_PREFIX_STATUS_WHO |
protected static java.lang.String |
FORMAT_REQUEST |
protected static java.lang.String |
FORMAT_STATUS |
static java.lang.String |
NO_BUS |
static java.lang.String |
WHERE_GENERAL_VALUE |
protected static java.lang.String |
WHERE_GROUP_PREFIX |
protected static int |
WHERE_MAX_VALUE |
protected static int |
WHERE_MIN_VALUE |
ACK, FRAME_END, FRAME_START, NACK
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
checkBus(java.lang.String bus) |
protected static int |
checkIsInteger(java.lang.String value) |
protected static void |
checkRange(java.lang.Integer from,
java.lang.Integer to,
java.lang.Integer value) |
protected static void |
checkRangeType(java.lang.String where,
Automation.Type type,
java.lang.String bus) |
java.lang.String |
getValue()
Raw message value.
|
static rx.functions.Func1<OpenSession,OpenSession> |
handleResponse(rx.functions.Action0 onSuccess,
rx.functions.Action0 onFail)
|
protected static rx.functions.Func1<OpenSession,OpenSession> |
handleResponse(rx.functions.Action0 onSuccess,
rx.functions.Action0 onFail,
int who) |
static rx.functions.Func1<OpenSession,OpenSession> |
handleStatus(rx.functions.Action0 stopAction,
rx.functions.Action0 upAction,
rx.functions.Action0 downAction)
Handle response from
requestStatus(String) . |
protected static boolean |
isInRange(java.lang.Integer from,
java.lang.Integer to,
java.lang.Integer value) |
protected static java.lang.Boolean |
isValidBus(java.lang.String bus) |
protected static void |
isValidPrefixType(OpenMessage request,
java.lang.String format,
int who) |
static boolean |
isValidRangeType(java.lang.String where,
Automation.Type type,
java.lang.String bus) |
static Automation |
requestMoveDown(java.lang.String where)
Deprecated.
|
static Automation |
requestMoveDown(java.lang.String where,
Automation.Type type,
java.lang.String bus)
OpenWebNet message request to send the DOWN automation command with value *2*2*WHERE##.
|
static Automation |
requestMoveUp(java.lang.String where)
Deprecated.
|
static Automation |
requestMoveUp(java.lang.String where,
Automation.Type type,
java.lang.String bus)
OpenWebNet message request to send the UP automation command with value *2*1*WHERE##.
|
static Automation |
requestStatus(java.lang.String where)
Deprecated.
|
static Automation |
requestStatus(java.lang.String where,
Automation.Type type,
java.lang.String bus)
OpenWebNet message request automation status with value *#2*WHERE##.
|
static Automation |
requestStop(java.lang.String where)
Deprecated.
|
static Automation |
requestStop(java.lang.String where,
Automation.Type type,
java.lang.String bus)
OpenWebNet message request to send the STOP automation command with value *2*0*WHERE##.
|
protected static final java.lang.String FORMAT_PREFIX_REQUEST_WHO
protected static final java.lang.String FORMAT_PREFIX_DIMENSION_WHO
protected static final java.lang.String FORMAT_PREFIX_STATUS_WHO
protected static final java.lang.String FORMAT_REQUEST
protected static final java.lang.String FORMAT_DIMENSION
protected static final java.lang.String FORMAT_STATUS
protected static final java.lang.String FORMAT_PREFIX_RESPONSE
protected static final java.lang.String FORMAT_PREFIX_DIMENSION
protected static final java.lang.String FORMAT_BUS
protected static final int WHERE_MIN_VALUE
protected static final int WHERE_MAX_VALUE
protected static final java.lang.String WHERE_GROUP_PREFIX
public static final java.lang.String WHERE_GENERAL_VALUE
public static final java.lang.String NO_BUS
public static Automation requestStop(java.lang.String where)
requestStop(String, Type, String)
where
- Value between 0 and 9999public static Automation requestStop(java.lang.String where, Automation.Type type, java.lang.String bus)
where
- Value between 0 and 9999type
- Type Automation.Type
bus
- Valuepublic static Automation requestMoveUp(java.lang.String where)
requestMoveUp(String, Type, String)
where
- Value between 0 and 9999public static Automation requestMoveUp(java.lang.String where, Automation.Type type, java.lang.String bus)
where
- Value between 0 and 9999type
- Type Automation.Type
bus
- Valuepublic static Automation requestMoveDown(java.lang.String where)
requestMoveDown(String, Type, String)
where
- Value between 0 and 9999public static Automation requestMoveDown(java.lang.String where, Automation.Type type, java.lang.String bus)
where
- Value between 0 and 9999type
- Type Automation.Type
bus
- Valuepublic static rx.functions.Func1<OpenSession,OpenSession> handleResponse(rx.functions.Action0 onSuccess, rx.functions.Action0 onFail)
onSuccess
- invoked if request has been successfully receivedonFail
- invoked otherwiseObservable<OpenSession>
public static Automation requestStatus(java.lang.String where)
requestStatus(String, Type, String)
where
- Value between 0 and 9999public static Automation requestStatus(java.lang.String where, Automation.Type type, java.lang.String bus)
where
- Value between 0 and 9999type
- Type Automation.Type
bus
- Valuepublic static rx.functions.Func1<OpenSession,OpenSession> handleStatus(rx.functions.Action0 stopAction, rx.functions.Action0 upAction, rx.functions.Action0 downAction)
requestStatus(String)
.stopAction
- invoked if automation is stoppedupAction
- invoked if automation is processing the UP commanddownAction
- invoked if automation is processing the DOWN commandObservable<OpenSession>
protected static void checkRangeType(java.lang.String where, Automation.Type type, java.lang.String bus)
public static boolean isValidRangeType(java.lang.String where, Automation.Type type, java.lang.String bus)
public java.lang.String getValue()
OpenMessage
getValue
in interface OpenMessage
protected static void checkRange(java.lang.Integer from, java.lang.Integer to, java.lang.Integer value)
protected static boolean isInRange(java.lang.Integer from, java.lang.Integer to, java.lang.Integer value)
protected static int checkIsInteger(java.lang.String value)
protected static void isValidPrefixType(OpenMessage request, java.lang.String format, int who)
protected static rx.functions.Func1<OpenSession,OpenSession> handleResponse(rx.functions.Action0 onSuccess, rx.functions.Action0 onFail, int who)
protected static java.lang.String checkBus(java.lang.String bus)
protected static java.lang.Boolean isValidBus(java.lang.String bus)