public class YRelay extends YFunction
Modifier and Type | Class and Description |
---|---|
static interface |
YRelay.TimedReportCallback
TimedReportCallback for Relay
|
static interface |
YRelay.UpdateCallback
Deprecated UpdateCallback for Relay
|
static class |
YRelay.YDelayedPulse |
Modifier and Type | Field and Description |
---|---|
protected long |
_countdown |
protected YRelay.YDelayedPulse |
_delayedPulseTimer |
protected long |
_maxTimeOnStateA |
protected long |
_maxTimeOnStateB |
protected int |
_output |
protected long |
_pulseTimer |
protected int |
_state |
protected int |
_stateAtPowerOn |
protected YRelay.UpdateCallback |
_valueCallbackRelay |
static long |
COUNTDOWN_INVALID
invalid countdown value
|
static YRelay.YDelayedPulse |
DELAYEDPULSETIMER_INVALID |
static long |
MAXTIMEONSTATEA_INVALID
invalid maxTimeOnStateA value
|
static long |
MAXTIMEONSTATEB_INVALID
invalid maxTimeOnStateB value
|
static int |
OUTPUT_INVALID |
static int |
OUTPUT_OFF
invalid output value
|
static int |
OUTPUT_ON |
static long |
PULSETIMER_INVALID
invalid pulseTimer value
|
static int |
STATE_A
invalid state value
|
static int |
STATE_B |
static int |
STATE_INVALID |
static int |
STATEATPOWERON_A |
static int |
STATEATPOWERON_B |
static int |
STATEATPOWERON_INVALID |
static int |
STATEATPOWERON_UNCHANGED
invalid stateAtPowerOn value
|
_advertisedValue, _cacheExpiration, _className, _dataStreams, _func, _funId, _hwId, _lastErrorMsg, _lastErrorType, _logicalName, _serial, _userData, _valueCallbackFunction, _yapi, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID
Modifier | Constructor and Description |
---|---|
protected |
YRelay(String func) |
protected |
YRelay(YAPIContext ctx,
String func) |
Modifier and Type | Method and Description |
---|---|
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(org.json.JSONObject json_val) |
int |
delayedPulse(int ms_delay,
int ms_duration)
Schedules a pulse.
|
static YRelay |
FindRelay(String func)
Retrieves a relay for a given identifier.
|
static YRelay |
FindRelayInContext(YAPIContext yctx,
String func)
Retrieves a relay for a given identifier in a YAPI context.
|
static YRelay |
FirstRelay()
Starts the enumeration of relays currently accessible.
|
static YRelay |
FirstRelayInContext(YAPIContext yctx)
Starts the enumeration of relays currently accessible.
|
long |
get_countdown()
Returns the number of milliseconds remaining before a pulse (delayedPulse() call)
When there is no scheduled pulse, returns zero.
|
YRelay.YDelayedPulse |
get_delayedPulseTimer() |
long |
get_maxTimeOnStateA()
Retourne the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state A before automatically
switching back in to B state.
|
long |
get_maxTimeOnStateB()
Retourne the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state B before automatically
switching back in to A state.
|
int |
get_output()
Returns the output state of the relays, when used as a simple switch (single throw).
|
long |
get_pulseTimer()
Returns the number of milliseconds remaining before the relays is returned to idle position
(state A), during a measured pulse generation.
|
int |
get_state()
Returns the state of the relays (A for the idle position, B for the active position).
|
int |
get_stateAtPowerOn()
Returns the state of the relays at device startup (A for the idle position, B for the active
position, UNCHANGED for no change).
|
long |
getCountdown()
Returns the number of milliseconds remaining before a pulse (delayedPulse() call)
When there is no scheduled pulse, returns zero.
|
YRelay.YDelayedPulse |
getDelayedPulseTimer() |
long |
getMaxTimeOnStateA()
Retourne the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state A before automatically
switching back in to B state.
|
long |
getMaxTimeOnStateB()
Retourne the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state B before automatically
switching back in to A state.
|
int |
getOutput()
Returns the output state of the relays, when used as a simple switch (single throw).
|
long |
getPulseTimer()
Returns the number of milliseconds remaining before the relays is returned to idle position
(state A), during a measured pulse generation.
|
int |
getState()
Returns the state of the relays (A for the idle position, B for the active position).
|
int |
getStateAtPowerOn()
Returns the state of the relays at device startup (A for the idle position, B for the active
position, UNCHANGED for no change).
|
YRelay |
nextRelay()
Continues the enumeration of relays started using yFirstRelay().
|
int |
pulse(int ms_duration)
Sets the relay to output B (active) for a specified duration, then brings it
automatically back to output A (idle state).
|
int |
registerValueCallback(YRelay.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
set_delayedPulseTimer(YRelay.YDelayedPulse newval) |
int |
set_maxTimeOnStateA(long newval)
Sets the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state A before automatically
switching back in to B state.
|
int |
set_maxTimeOnStateB(long newval)
Sets the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state B before automatically
switching back in to A state.
|
int |
set_output(int newval)
Changes the output state of the relays, when used as a simple switch (single throw).
|
int |
set_pulseTimer(long newval) |
int |
set_state(int newval)
Changes the state of the relays (A for the idle position, B for the active position).
|
int |
set_stateAtPowerOn(int newval)
Preset the state of the relays at device startup (A for the idle position,
B for the active position, UNCHANGED for no modification).
|
int |
setDelayedPulseTimer(YRelay.YDelayedPulse newval) |
int |
setMaxTimeOnStateA(long newval)
Sets the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state A before automatically
switching back in to B state.
|
int |
setMaxTimeOnStateB(long newval)
Sets the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state B before automatically
switching back in to A state.
|
int |
setOutput(int newval)
Changes the output state of the relays, when used as a simple switch (single throw).
|
int |
setPulseTimer(long newval) |
int |
setState(int newval)
Changes the state of the relays (A for the idle position, B for the active position).
|
int |
setStateAtPowerOn(int newval)
Preset the state of the relays at device startup (A for the idle position,
B for the active position, UNCHANGED for no modification).
|
_AddToCache, _clearDataStreamCache, _devRequest, _download, _escapeAttr, _FindFromCache, _FindFromCacheInContext, _get_json_path_struct, _get_json_path, _json_get_array, _json_get_key, _json_get_string, _parse, _parserHelper, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, clearCache, describe, errMessage, errorMessage, errorType, errType, FindFunction, FindFunctionInContext, FirstFunction, FirstFunctionInContext, functionDescriptor, get_advertisedValue, get_errorMessage, get_errorType, get_friendlyName, get_functionDescriptor, get_functionId, get_hardwareId, get_logicalName, get_module, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, load, loadAttribute, module, muteValueCallbacks, nextFunction, registerValueCallback, set_advertisedValue, set_logicalName, set_userData, setAdvertisedValue, setLogicalName, setUserData, toString, unmuteValueCallbacks, userData
public static final int STATE_A
public static final int STATE_B
public static final int STATE_INVALID
public static final int STATEATPOWERON_UNCHANGED
public static final int STATEATPOWERON_A
public static final int STATEATPOWERON_B
public static final int STATEATPOWERON_INVALID
public static final long MAXTIMEONSTATEA_INVALID
public static final long MAXTIMEONSTATEB_INVALID
public static final int OUTPUT_OFF
public static final int OUTPUT_ON
public static final int OUTPUT_INVALID
public static final long PULSETIMER_INVALID
public static final long COUNTDOWN_INVALID
public static final YRelay.YDelayedPulse DELAYEDPULSETIMER_INVALID
protected int _state
protected int _stateAtPowerOn
protected long _maxTimeOnStateA
protected long _maxTimeOnStateB
protected int _output
protected long _pulseTimer
protected YRelay.YDelayedPulse _delayedPulseTimer
protected long _countdown
protected YRelay.UpdateCallback _valueCallbackRelay
protected YRelay(YAPIContext ctx, String func)
func
- : functionidprotected YRelay(String func)
func
- : functionidprotected void _parseAttr(org.json.JSONObject json_val) throws org.json.JSONException
_parseAttr
in class YFunction
org.json.JSONException
public int get_state() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getState() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_state(int newval) throws YAPI_Exception
newval
- : either YRelay.STATE_A or YRelay.STATE_B, according to the state of the relays (A
for the idle position, B for the active position)YAPI_Exception
- on errorpublic int setState(int newval) throws YAPI_Exception
newval
- : either Y_STATE_A or Y_STATE_B, according to the state of the relays (A for the idle
position, B for the active position)YAPI_Exception
- on errorpublic int get_stateAtPowerOn() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getStateAtPowerOn() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_stateAtPowerOn(int newval) throws YAPI_Exception
newval
- : a value among YRelay.STATEATPOWERON_UNCHANGED, YRelay.STATEATPOWERON_A and
YRelay.STATEATPOWERON_BYAPI_Exception
- on errorpublic int setStateAtPowerOn(int newval) throws YAPI_Exception
newval
- : a value among Y_STATEATPOWERON_UNCHANGED, Y_STATEATPOWERON_A and Y_STATEATPOWERON_BYAPI_Exception
- on errorpublic long get_maxTimeOnStateA() throws YAPI_Exception
YAPI_Exception
- on errorpublic long getMaxTimeOnStateA() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_maxTimeOnStateA(long newval) throws YAPI_Exception
newval
- : an integerYAPI_Exception
- on errorpublic int setMaxTimeOnStateA(long newval) throws YAPI_Exception
newval
- : an integerYAPI_Exception
- on errorpublic long get_maxTimeOnStateB() throws YAPI_Exception
YAPI_Exception
- on errorpublic long getMaxTimeOnStateB() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_maxTimeOnStateB(long newval) throws YAPI_Exception
newval
- : an integerYAPI_Exception
- on errorpublic int setMaxTimeOnStateB(long newval) throws YAPI_Exception
newval
- : an integerYAPI_Exception
- on errorpublic int get_output() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getOutput() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_output(int newval) throws YAPI_Exception
newval
- : either YRelay.OUTPUT_OFF or YRelay.OUTPUT_ON, according to the output state of the
relays, when used as a simple switch (single throw)YAPI_Exception
- on errorpublic int setOutput(int newval) throws YAPI_Exception
newval
- : either Y_OUTPUT_OFF or Y_OUTPUT_ON, according to the output state of the relays,
when used as a simple switch (single throw)YAPI_Exception
- on errorpublic long get_pulseTimer() throws YAPI_Exception
YAPI_Exception
- on errorpublic long getPulseTimer() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_pulseTimer(long newval) throws YAPI_Exception
YAPI_Exception
public int setPulseTimer(long newval) throws YAPI_Exception
YAPI_Exception
public int pulse(int ms_duration) throws YAPI_Exception
ms_duration
- : pulse duration, in millisecondesYAPI_Exception
- on errorpublic YRelay.YDelayedPulse get_delayedPulseTimer() throws YAPI_Exception
YAPI_Exception
- on errorpublic YRelay.YDelayedPulse getDelayedPulseTimer() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_delayedPulseTimer(YRelay.YDelayedPulse newval) throws YAPI_Exception
YAPI_Exception
public int setDelayedPulseTimer(YRelay.YDelayedPulse newval) throws YAPI_Exception
YAPI_Exception
public int delayedPulse(int ms_delay, int ms_duration) throws YAPI_Exception
ms_delay
- : waiting time before the pulse, in millisecondesms_duration
- : pulse duration, in millisecondesYAPI_Exception
- on errorpublic long get_countdown() throws YAPI_Exception
YAPI_Exception
- on errorpublic long getCountdown() throws YAPI_Exception
YAPI_Exception
- on errorpublic static YRelay FindRelay(String func)
func
- : a string that uniquely characterizes the relaypublic static YRelay FindRelayInContext(YAPIContext yctx, String func)
yctx
- : a YAPI contextfunc
- : a string that uniquely characterizes the relaypublic int registerValueCallback(YRelay.UpdateCallback callback)
callback
- : the callback function to call, or a null pointer. The callback function should take two
arguments: the function object of which the value has changed, and the character string describing
the new advertised value.public int _invokeValueCallback(String value)
_invokeValueCallback
in class YFunction
public YRelay nextRelay()
public static YRelay FirstRelay()
public static YRelay FirstRelayInContext(YAPIContext yctx)
yctx
- : a YAPI context.Copyright © 2017. All rights reserved.