com.yoctopuce.YoctoAPI
public class YDualPower extends YFunction
Modifier and Type | Class and Description |
---|---|
static interface |
YDualPower.TimedReportCallback
TimedReportCallback for DualPower
|
static interface |
YDualPower.UpdateCallback
Deprecated UpdateCallback for DualPower
|
Modifier and Type | Field and Description |
---|---|
protected int |
_extVoltage |
protected int |
_powerControl |
protected int |
_powerState |
protected YDualPower.UpdateCallback |
_valueCallbackDualPower |
static int |
EXTVOLTAGE_INVALID
invalid extVoltage value
|
static int |
POWERCONTROL_AUTO
invalid powerControl value
|
static int |
POWERCONTROL_FROM_EXT |
static int |
POWERCONTROL_FROM_USB |
static int |
POWERCONTROL_INVALID |
static int |
POWERCONTROL_OFF |
static int |
POWERSTATE_FROM_EXT |
static int |
POWERSTATE_FROM_USB |
static int |
POWERSTATE_INVALID |
static int |
POWERSTATE_OFF
invalid powerState value
|
_advertisedValue, _cacheExpiration, _className, _dataStreams, _func, _funId, _hwId, _lastErrorMsg, _lastErrorType, _logicalName, _serial, _userData, _valueCallbackFunction, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID
Modifier | Constructor and Description |
---|---|
protected |
YDualPower(String func) |
Modifier and Type | Method and Description |
---|---|
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(org.json.JSONObject json_val) |
static YDualPower |
FindDualPower(String func)
Retrieves a dual power control for a given identifier.
|
static YDualPower |
FirstDualPower()
Starts the enumeration of dual power controls currently accessible.
|
int |
get_extVoltage()
Returns the measured voltage on the external power source, in millivolts.
|
int |
get_powerControl()
Returns the selected power source for module functions that require lots of current.
|
int |
get_powerState()
Returns the current power source for module functions that require lots of current.
|
int |
getExtVoltage()
Returns the measured voltage on the external power source, in millivolts.
|
int |
getPowerControl()
Returns the selected power source for module functions that require lots of current.
|
int |
getPowerState()
Returns the current power source for module functions that require lots of current.
|
YDualPower |
nextDualPower()
Continues the enumeration of dual power controls started using yFirstDualPower().
|
int |
registerValueCallback(YDualPower.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
set_powerControl(int newval)
Changes the selected power source for module functions that require lots of current.
|
int |
setPowerControl(int newval)
Changes the selected power source for module functions that require lots of current.
|
_AddToCache, _devRequest, _download, _escapeAttr, _FindFromCache, _json_get_array, _json_get_key, _json_get_string, _parse, _parserHelper, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, describe, errMessage, errorMessage, errorType, errType, FindFunction, FirstFunction, 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, module, nextFunction, registerValueCallback, set_logicalName, set_userData, setLogicalName, setUserData, toString, userData
public static final int POWERSTATE_OFF
public static final int POWERSTATE_FROM_USB
public static final int POWERSTATE_FROM_EXT
public static final int POWERSTATE_INVALID
public static final int POWERCONTROL_AUTO
public static final int POWERCONTROL_FROM_USB
public static final int POWERCONTROL_FROM_EXT
public static final int POWERCONTROL_OFF
public static final int POWERCONTROL_INVALID
public static final int EXTVOLTAGE_INVALID
protected int _powerState
protected int _powerControl
protected int _extVoltage
protected YDualPower.UpdateCallback _valueCallbackDualPower
protected YDualPower(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_powerState() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getPowerState() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_powerControl() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getPowerControl() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_powerControl(int newval) throws YAPI_Exception
newval
- : a value among YDualPower.POWERCONTROL_AUTO, YDualPower.POWERCONTROL_FROM_USB,
YDualPower.POWERCONTROL_FROM_EXT and YDualPower.POWERCONTROL_OFF corresponding to the selected
power source for module functions that require lots of currentYAPI_Exception
- on errorpublic int setPowerControl(int newval) throws YAPI_Exception
newval
- : a value among Y_POWERCONTROL_AUTO, Y_POWERCONTROL_FROM_USB, Y_POWERCONTROL_FROM_EXT
and Y_POWERCONTROL_OFF corresponding to the selected power source for module functions that require
lots of currentYAPI_Exception
- on errorpublic int get_extVoltage() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getExtVoltage() throws YAPI_Exception
YAPI_Exception
- on errorpublic static YDualPower FindDualPower(String func)
func
- : a string that uniquely characterizes the power controlpublic int registerValueCallback(YDualPower.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 YDualPower nextDualPower()
public static YDualPower FirstDualPower()
Copyright © 2014. All rights reserved.