com.yoctopuce.YoctoAPI
public class YModule extends YFunction
Modifier and Type | Class and Description |
---|---|
static interface |
YModule.LogCallback |
static interface |
YModule.TimedReportCallback
TimedReportCallback for Module
|
static interface |
YModule.UpdateCallback
Deprecated UpdateCallback for Module
|
Modifier and Type | Field and Description |
---|---|
protected int |
_beacon |
protected String |
_firmwareRelease |
protected YModule.LogCallback |
_logCallback |
protected int |
_luminosity |
protected int |
_persistentSettings |
protected int |
_productId |
protected String |
_productName |
protected int |
_productRelease |
protected int |
_rebootCountdown |
protected String |
_serialNumber |
protected long |
_upTime |
protected int |
_usbBandwidth |
protected int |
_usbCurrent |
protected YModule.UpdateCallback |
_valueCallbackModule |
static int |
BEACON_INVALID |
static int |
BEACON_OFF
invalid beacon value
|
static int |
BEACON_ON |
static String |
FIRMWARERELEASE_INVALID
invalid firmwareRelease value
|
static int |
LUMINOSITY_INVALID
invalid luminosity value
|
static int |
PERSISTENTSETTINGS_INVALID |
static int |
PERSISTENTSETTINGS_LOADED
invalid persistentSettings value
|
static int |
PERSISTENTSETTINGS_MODIFIED |
static int |
PERSISTENTSETTINGS_SAVED |
static int |
PRODUCTID_INVALID
invalid productId value
|
static String |
PRODUCTNAME_INVALID
invalid productName value
|
static int |
PRODUCTRELEASE_INVALID
invalid productRelease value
|
static int |
REBOOTCOUNTDOWN_INVALID
invalid rebootCountdown value
|
static String |
SERIALNUMBER_INVALID
invalid serialNumber value
|
static long |
UPTIME_INVALID
invalid upTime value
|
static int |
USBBANDWIDTH_DOUBLE |
static int |
USBBANDWIDTH_INVALID |
static int |
USBBANDWIDTH_SIMPLE
invalid usbBandwidth value
|
static int |
USBCURRENT_INVALID
invalid usbCurrent 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 |
YModule(String func) |
Modifier and Type | Method and Description |
---|---|
protected YDevice |
_getDev() |
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(org.json.JSONObject json_val) |
byte[] |
download(String pathname)
Downloads the specified built-in file and returns a binary buffer with its content.
|
static YModule |
FindModule(String func)
Allows you to find a module from its serial number or from its logical name.
|
static YModule |
FirstModule()
Starts the enumeration of modules currently accessible.
|
int |
functionCount() |
String |
functionId(int functionIndex) |
String |
functionName(int functionIndex) |
String |
functionValue(int functionIndex) |
int |
get_beacon()
Returns the state of the localization beacon.
|
String |
get_firmwareRelease()
Returns the version of the firmware embedded in the module.
|
byte[] |
get_icon2d()
Returns the icon of the module.
|
String |
get_lastLogs()
Returns a string with last logs of the module.
|
int |
get_luminosity()
Returns the luminosity of the module informative leds (from 0 to 100).
|
int |
get_persistentSettings()
Returns the current state of persistent module settings.
|
int |
get_productId()
Returns the USB device identifier of the module.
|
String |
get_productName()
Returns the commercial name of the module, as set by the factory.
|
int |
get_productRelease()
Returns the hardware release version of the module.
|
int |
get_rebootCountdown()
Returns the remaining number of seconds before the module restarts, or zero when no
reboot has been scheduled.
|
String |
get_serialNumber()
Returns the serial number of the module, as set by the factory.
|
long |
get_upTime()
Returns the number of milliseconds spent since the module was powered on.
|
int |
get_usbBandwidth()
Returns the number of USB interfaces used by the module.
|
int |
get_usbCurrent()
Returns the current consumed by the module on the USB bus, in milli-amps.
|
int |
getBeacon()
Returns the state of the localization beacon.
|
String |
getFirmwareRelease()
Returns the version of the firmware embedded in the module.
|
int |
getLuminosity()
Returns the luminosity of the module informative leds (from 0 to 100).
|
int |
getPersistentSettings()
Returns the current state of persistent module settings.
|
int |
getProductId()
Returns the USB device identifier of the module.
|
String |
getProductName()
Returns the commercial name of the module, as set by the factory.
|
int |
getProductRelease()
Returns the hardware release version of the module.
|
int |
getRebootCountdown()
Returns the remaining number of seconds before the module restarts, or zero when no
reboot has been scheduled.
|
String |
getSerialNumber()
Returns the serial number of the module, as set by the factory.
|
long |
getUpTime()
Returns the number of milliseconds spent since the module was powered on.
|
int |
getUsbBandwidth()
Returns the number of USB interfaces used by the module.
|
int |
getUsbCurrent()
Returns the current consumed by the module on the USB bus, in milli-amps.
|
YModule |
nextModule()
Continues the module enumeration started using yFirstModule().
|
int |
reboot(int secBeforeReboot)
Schedules a simple module reboot after the given number of seconds.
|
void |
registerLogCallback(YModule.LogCallback callback)
Registers a device log callback function.
|
int |
registerValueCallback(YModule.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
revertFromFlash()
Reloads the settings stored in the nonvolatile memory, as
when the module is powered on.
|
int |
saveToFlash()
Saves current settings in the nonvolatile memory of the module.
|
int |
set_beacon(int newval)
Turns on or off the module localization beacon.
|
int |
set_luminosity(int newval)
Changes the luminosity of the module informative leds.
|
int |
set_persistentSettings(int newval) |
int |
set_rebootCountdown(int newval) |
int |
setBeacon(int newval)
Turns on or off the module localization beacon.
|
int |
setLuminosity(int newval)
Changes the luminosity of the module informative leds.
|
int |
setPersistentSettings(int newval) |
int |
setRebootCountdown(int newval) |
int |
triggerFirmwareUpdate(int secBeforeReboot)
Schedules a module reboot into special firmware update mode.
|
_AddToCache, _devRequest, _download, _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 String PRODUCTNAME_INVALID
public static final String SERIALNUMBER_INVALID
public static final int PRODUCTID_INVALID
public static final int PRODUCTRELEASE_INVALID
public static final String FIRMWARERELEASE_INVALID
public static final int PERSISTENTSETTINGS_LOADED
public static final int PERSISTENTSETTINGS_SAVED
public static final int PERSISTENTSETTINGS_MODIFIED
public static final int PERSISTENTSETTINGS_INVALID
public static final int LUMINOSITY_INVALID
public static final int BEACON_OFF
public static final int BEACON_ON
public static final int BEACON_INVALID
public static final long UPTIME_INVALID
public static final int USBCURRENT_INVALID
public static final int REBOOTCOUNTDOWN_INVALID
public static final int USBBANDWIDTH_SIMPLE
public static final int USBBANDWIDTH_DOUBLE
public static final int USBBANDWIDTH_INVALID
protected String _productName
protected String _serialNumber
protected int _productId
protected int _productRelease
protected String _firmwareRelease
protected int _persistentSettings
protected int _luminosity
protected int _beacon
protected long _upTime
protected int _usbCurrent
protected int _rebootCountdown
protected int _usbBandwidth
protected YModule.UpdateCallback _valueCallbackModule
protected YModule.LogCallback _logCallback
protected YModule(String func)
func
- : functionidprotected YDevice _getDev() throws YAPI_Exception
YAPI_Exception
public int functionCount() throws YAPI_Exception
YAPI_Exception
public String functionId(int functionIndex) throws YAPI_Exception
YAPI_Exception
public String functionName(int functionIndex) throws YAPI_Exception
YAPI_Exception
public String functionValue(int functionIndex) throws YAPI_Exception
YAPI_Exception
public void registerLogCallback(YModule.LogCallback callback)
callback
- : the callback function to call, or a null pointer. The callback function should take two
arguments: the module object that emitted the log message, and the character string containing the log.protected void _parseAttr(org.json.JSONObject json_val) throws org.json.JSONException
_parseAttr
in class YFunction
org.json.JSONException
public String get_productName() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getProductName() throws YAPI_Exception
YAPI_Exception
- on errorpublic String get_serialNumber() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getSerialNumber() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_productId() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getProductId() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_productRelease() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getProductRelease() throws YAPI_Exception
YAPI_Exception
- on errorpublic String get_firmwareRelease() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getFirmwareRelease() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_persistentSettings() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getPersistentSettings() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_persistentSettings(int newval) throws YAPI_Exception
YAPI_Exception
public int setPersistentSettings(int newval) throws YAPI_Exception
YAPI_Exception
public int get_luminosity() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getLuminosity() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_luminosity(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the luminosity of the module informative ledsYAPI_Exception
- on errorpublic int setLuminosity(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the luminosity of the module informative ledsYAPI_Exception
- on errorpublic int get_beacon() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getBeacon() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_beacon(int newval) throws YAPI_Exception
newval
- : either YModule.BEACON_OFF or YModule.BEACON_ONYAPI_Exception
- on errorpublic int setBeacon(int newval) throws YAPI_Exception
newval
- : either Y_BEACON_OFF or Y_BEACON_ONYAPI_Exception
- on errorpublic long get_upTime() throws YAPI_Exception
YAPI_Exception
- on errorpublic long getUpTime() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_usbCurrent() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getUsbCurrent() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_rebootCountdown() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getRebootCountdown() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_rebootCountdown(int newval) throws YAPI_Exception
YAPI_Exception
public int setRebootCountdown(int newval) throws YAPI_Exception
YAPI_Exception
public int get_usbBandwidth() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getUsbBandwidth() throws YAPI_Exception
YAPI_Exception
- on errorpublic static YModule FindModule(String func)
func
- : a string containing either the serial number or
the logical name of the desired modulepublic int registerValueCallback(YModule.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 int saveToFlash() throws YAPI_Exception
YAPI_Exception
- on errorpublic int revertFromFlash() throws YAPI_Exception
YAPI_Exception
- on errorpublic int reboot(int secBeforeReboot) throws YAPI_Exception
secBeforeReboot
- : number of seconds before rebootingYAPI_Exception
- on errorpublic int triggerFirmwareUpdate(int secBeforeReboot) throws YAPI_Exception
secBeforeReboot
- : number of seconds before rebootingYAPI_Exception
- on errorpublic byte[] download(String pathname) throws YAPI_Exception
pathname
- : name of the new file to loadYAPI_Exception
- on errorpublic byte[] get_icon2d() throws YAPI_Exception
YAPI_Exception
public String get_lastLogs() throws YAPI_Exception
YAPI_Exception
public YModule nextModule()
public static YModule FirstModule()
Copyright © 2014. All rights reserved.