com.yoctopuce.YoctoAPI
public class YNetwork extends YFunction
Modifier and Type | Class and Description |
---|---|
static interface |
YNetwork.TimedReportCallback
TimedReportCallback for Network
|
static interface |
YNetwork.UpdateCallback
Deprecated UpdateCallback for Network
|
Modifier and Type | Field and Description |
---|---|
protected String |
_adminPassword |
protected String |
_callbackCredentials |
protected int |
_callbackEncoding |
protected int |
_callbackMaxDelay |
protected int |
_callbackMethod |
protected int |
_callbackMinDelay |
protected String |
_callbackUrl |
protected int |
_discoverable |
protected String |
_ipAddress |
protected String |
_ipConfig |
protected String |
_macAddress |
protected int |
_poeCurrent |
protected String |
_primaryDNS |
protected int |
_readiness |
protected String |
_router |
protected String |
_secondaryDNS |
protected String |
_subnetMask |
protected String |
_userPassword |
protected YNetwork.UpdateCallback |
_valueCallbackNetwork |
protected int |
_wwwWatchdogDelay |
static String |
ADMINPASSWORD_INVALID
invalid adminPassword value
|
static String |
CALLBACKCREDENTIALS_INVALID
invalid callbackCredentials value
|
static int |
CALLBACKENCODING_CSV |
static int |
CALLBACKENCODING_FORM
invalid callbackEncoding value
|
static int |
CALLBACKENCODING_INVALID |
static int |
CALLBACKENCODING_JSON |
static int |
CALLBACKENCODING_JSON_ARRAY |
static int |
CALLBACKENCODING_YOCTO_API |
static int |
CALLBACKMAXDELAY_INVALID
invalid callbackMaxDelay value
|
static int |
CALLBACKMETHOD_GET |
static int |
CALLBACKMETHOD_INVALID |
static int |
CALLBACKMETHOD_POST
invalid callbackMethod value
|
static int |
CALLBACKMETHOD_PUT |
static int |
CALLBACKMINDELAY_INVALID
invalid callbackMinDelay value
|
static String |
CALLBACKURL_INVALID
invalid callbackUrl value
|
static int |
DISCOVERABLE_FALSE
invalid discoverable value
|
static int |
DISCOVERABLE_INVALID |
static int |
DISCOVERABLE_TRUE |
static String |
IPADDRESS_INVALID
invalid ipAddress value
|
static String |
IPCONFIG_INVALID
invalid ipConfig value
|
static String |
MACADDRESS_INVALID
invalid macAddress value
|
static int |
POECURRENT_INVALID
invalid poeCurrent value
|
static String |
PRIMARYDNS_INVALID
invalid primaryDNS value
|
static int |
READINESS_DOWN
invalid readiness value
|
static int |
READINESS_EXISTS |
static int |
READINESS_INVALID |
static int |
READINESS_LAN_OK |
static int |
READINESS_LINKED |
static int |
READINESS_WWW_OK |
static String |
ROUTER_INVALID
invalid router value
|
static String |
SECONDARYDNS_INVALID
invalid secondaryDNS value
|
static String |
SUBNETMASK_INVALID
invalid subnetMask value
|
static String |
USERPASSWORD_INVALID
invalid userPassword value
|
static int |
WWWWATCHDOGDELAY_INVALID
invalid wwwWatchdogDelay 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 |
YNetwork(String func) |
Modifier and Type | Method and Description |
---|---|
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(org.json.JSONObject json_val) |
int |
callbackLogin(String username,
String password)
Connects to the notification callback and saves the credentials required to
log into it.
|
static YNetwork |
FindNetwork(String func)
Retrieves a network interface for a given identifier.
|
static YNetwork |
FirstNetwork()
Starts the enumeration of network interfaces currently accessible.
|
String |
get_adminPassword()
Returns a hash string if a password has been set for user "admin",
or an empty string otherwise.
|
String |
get_callbackCredentials()
Returns a hashed version of the notification callback credentials if set,
or an empty string otherwise.
|
int |
get_callbackEncoding()
Returns the encoding standard to use for representing notification values.
|
int |
get_callbackMaxDelay()
Returns the maximum waiting time between two callback notifications, in seconds.
|
int |
get_callbackMethod()
Returns the HTTP method used to notify callbacks for significant state changes.
|
int |
get_callbackMinDelay()
Returns the minimum waiting time between two callback notifications, in seconds.
|
String |
get_callbackUrl()
Returns the callback URL to notify of significant state changes.
|
int |
get_discoverable()
Returns the activation state of the multicast announce protocols to allow easy
discovery of the module in the network neighborhood (uPnP/Bonjour protocol).
|
String |
get_ipAddress()
Returns the IP address currently in use by the device.
|
String |
get_ipConfig() |
String |
get_macAddress()
Returns the MAC address of the network interface.
|
int |
get_poeCurrent()
Returns the current consumed by the module from Power-over-Ethernet (PoE), in milli-amps.
|
String |
get_primaryDNS()
Returns the IP address of the primary name server to be used by the module.
|
int |
get_readiness()
Returns the current established working mode of the network interface.
|
String |
get_router()
Returns the IP address of the router on the device subnet (default gateway).
|
String |
get_secondaryDNS()
Returns the IP address of the secondary name server to be used by the module.
|
String |
get_subnetMask()
Returns the subnet mask currently used by the device.
|
String |
get_userPassword()
Returns a hash string if a password has been set for "user" user,
or an empty string otherwise.
|
int |
get_wwwWatchdogDelay()
Returns the allowed downtime of the WWW link (in seconds) before triggering an automated
reboot to try to recover Internet connectivity.
|
String |
getAdminPassword()
Returns a hash string if a password has been set for user "admin",
or an empty string otherwise.
|
String |
getCallbackCredentials()
Returns a hashed version of the notification callback credentials if set,
or an empty string otherwise.
|
int |
getCallbackEncoding()
Returns the encoding standard to use for representing notification values.
|
int |
getCallbackMaxDelay()
Returns the maximum waiting time between two callback notifications, in seconds.
|
int |
getCallbackMethod()
Returns the HTTP method used to notify callbacks for significant state changes.
|
int |
getCallbackMinDelay()
Returns the minimum waiting time between two callback notifications, in seconds.
|
String |
getCallbackUrl()
Returns the callback URL to notify of significant state changes.
|
int |
getDiscoverable()
Returns the activation state of the multicast announce protocols to allow easy
discovery of the module in the network neighborhood (uPnP/Bonjour protocol).
|
String |
getIpAddress()
Returns the IP address currently in use by the device.
|
String |
getIpConfig() |
String |
getMacAddress()
Returns the MAC address of the network interface.
|
int |
getPoeCurrent()
Returns the current consumed by the module from Power-over-Ethernet (PoE), in milli-amps.
|
String |
getPrimaryDNS()
Returns the IP address of the primary name server to be used by the module.
|
int |
getReadiness()
Returns the current established working mode of the network interface.
|
String |
getRouter()
Returns the IP address of the router on the device subnet (default gateway).
|
String |
getSecondaryDNS()
Returns the IP address of the secondary name server to be used by the module.
|
String |
getSubnetMask()
Returns the subnet mask currently used by the device.
|
String |
getUserPassword()
Returns a hash string if a password has been set for "user" user,
or an empty string otherwise.
|
int |
getWwwWatchdogDelay()
Returns the allowed downtime of the WWW link (in seconds) before triggering an automated
reboot to try to recover Internet connectivity.
|
YNetwork |
nextNetwork()
Continues the enumeration of network interfaces started using yFirstNetwork().
|
String |
ping(String host)
Pings str_host to test the network connectivity.
|
int |
registerValueCallback(YNetwork.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
set_adminPassword(String newval)
Changes the password for the "admin" user.
|
int |
set_callbackCredentials(String newval)
Changes the credentials required to connect to the callback address.
|
int |
set_callbackEncoding(int newval)
Changes the encoding standard to use for representing notification values.
|
int |
set_callbackMaxDelay(int newval)
Changes the maximum waiting time between two callback notifications, in seconds.
|
int |
set_callbackMethod(int newval)
Changes the HTTP method used to notify callbacks for significant state changes.
|
int |
set_callbackMinDelay(int newval)
Changes the minimum waiting time between two callback notifications, in seconds.
|
int |
set_callbackUrl(String newval)
Changes the callback URL to notify significant state changes.
|
int |
set_discoverable(int newval)
Changes the activation state of the multicast announce protocols to allow easy
discovery of the module in the network neighborhood (uPnP/Bonjour protocol).
|
int |
set_ipConfig(String newval) |
int |
set_primaryDNS(String newval)
Changes the IP address of the primary name server to be used by the module.
|
int |
set_secondaryDNS(String newval)
Changes the IP address of the secondary name server to be used by the module.
|
int |
set_userPassword(String newval)
Changes the password for the "user" user.
|
int |
set_wwwWatchdogDelay(int newval)
Changes the allowed downtime of the WWW link (in seconds) before triggering an automated
reboot to try to recover Internet connectivity.
|
int |
setAdminPassword(String newval)
Changes the password for the "admin" user.
|
int |
setCallbackCredentials(String newval)
Changes the credentials required to connect to the callback address.
|
int |
setCallbackEncoding(int newval)
Changes the encoding standard to use for representing notification values.
|
int |
setCallbackMaxDelay(int newval)
Changes the maximum waiting time between two callback notifications, in seconds.
|
int |
setCallbackMethod(int newval)
Changes the HTTP method used to notify callbacks for significant state changes.
|
int |
setCallbackMinDelay(int newval)
Changes the minimum waiting time between two callback notifications, in seconds.
|
int |
setCallbackUrl(String newval)
Changes the callback URL to notify significant state changes.
|
int |
setDiscoverable(int newval)
Changes the activation state of the multicast announce protocols to allow easy
discovery of the module in the network neighborhood (uPnP/Bonjour protocol).
|
int |
setIpConfig(String newval) |
int |
setPrimaryDNS(String newval)
Changes the IP address of the primary name server to be used by the module.
|
int |
setSecondaryDNS(String newval)
Changes the IP address of the secondary name server to be used by the module.
|
int |
setUserPassword(String newval)
Changes the password for the "user" user.
|
int |
setWwwWatchdogDelay(int newval)
Changes the allowed downtime of the WWW link (in seconds) before triggering an automated
reboot to try to recover Internet connectivity.
|
int |
useDHCP(String fallbackIpAddr,
int fallbackSubnetMaskLen,
String fallbackRouter)
Changes the configuration of the network interface to enable the use of an
IP address received from a DHCP server.
|
int |
useStaticIP(String ipAddress,
int subnetMaskLen,
String router)
Changes the configuration of the network interface to use a static IP address.
|
_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 int READINESS_DOWN
public static final int READINESS_EXISTS
public static final int READINESS_LINKED
public static final int READINESS_LAN_OK
public static final int READINESS_WWW_OK
public static final int READINESS_INVALID
public static final String MACADDRESS_INVALID
public static final String IPADDRESS_INVALID
public static final String SUBNETMASK_INVALID
public static final String ROUTER_INVALID
public static final String IPCONFIG_INVALID
public static final String PRIMARYDNS_INVALID
public static final String SECONDARYDNS_INVALID
public static final String USERPASSWORD_INVALID
public static final String ADMINPASSWORD_INVALID
public static final int DISCOVERABLE_FALSE
public static final int DISCOVERABLE_TRUE
public static final int DISCOVERABLE_INVALID
public static final int WWWWATCHDOGDELAY_INVALID
public static final String CALLBACKURL_INVALID
public static final int CALLBACKMETHOD_POST
public static final int CALLBACKMETHOD_GET
public static final int CALLBACKMETHOD_PUT
public static final int CALLBACKMETHOD_INVALID
public static final int CALLBACKENCODING_FORM
public static final int CALLBACKENCODING_JSON
public static final int CALLBACKENCODING_JSON_ARRAY
public static final int CALLBACKENCODING_CSV
public static final int CALLBACKENCODING_YOCTO_API
public static final int CALLBACKENCODING_INVALID
public static final String CALLBACKCREDENTIALS_INVALID
public static final int CALLBACKMINDELAY_INVALID
public static final int CALLBACKMAXDELAY_INVALID
public static final int POECURRENT_INVALID
protected int _readiness
protected String _macAddress
protected String _ipAddress
protected String _subnetMask
protected String _router
protected String _ipConfig
protected String _primaryDNS
protected String _secondaryDNS
protected String _userPassword
protected String _adminPassword
protected int _discoverable
protected int _wwwWatchdogDelay
protected String _callbackUrl
protected int _callbackMethod
protected int _callbackEncoding
protected String _callbackCredentials
protected int _callbackMinDelay
protected int _callbackMaxDelay
protected int _poeCurrent
protected YNetwork.UpdateCallback _valueCallbackNetwork
protected YNetwork(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_readiness() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getReadiness() throws YAPI_Exception
YAPI_Exception
- on errorpublic String get_macAddress() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getMacAddress() throws YAPI_Exception
YAPI_Exception
- on errorpublic String get_ipAddress() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getIpAddress() throws YAPI_Exception
YAPI_Exception
- on errorpublic String get_subnetMask() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getSubnetMask() throws YAPI_Exception
YAPI_Exception
- on errorpublic String get_router() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getRouter() throws YAPI_Exception
YAPI_Exception
- on errorpublic String get_ipConfig() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getIpConfig() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_ipConfig(String newval) throws YAPI_Exception
YAPI_Exception
public int setIpConfig(String newval) throws YAPI_Exception
YAPI_Exception
public String get_primaryDNS() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getPrimaryDNS() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_primaryDNS(String newval) throws YAPI_Exception
newval
- : a string corresponding to the IP address of the primary name server to be used by the moduleYAPI_Exception
- on errorpublic int setPrimaryDNS(String newval) throws YAPI_Exception
newval
- : a string corresponding to the IP address of the primary name server to be used by the moduleYAPI_Exception
- on errorpublic String get_secondaryDNS() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getSecondaryDNS() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_secondaryDNS(String newval) throws YAPI_Exception
newval
- : a string corresponding to the IP address of the secondary name server to be used by the moduleYAPI_Exception
- on errorpublic int setSecondaryDNS(String newval) throws YAPI_Exception
newval
- : a string corresponding to the IP address of the secondary name server to be used by the moduleYAPI_Exception
- on errorpublic String get_userPassword() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getUserPassword() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_userPassword(String newval) throws YAPI_Exception
newval
- : a string corresponding to the password for the "user" userYAPI_Exception
- on errorpublic int setUserPassword(String newval) throws YAPI_Exception
newval
- : a string corresponding to the password for the "user" userYAPI_Exception
- on errorpublic String get_adminPassword() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getAdminPassword() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_adminPassword(String newval) throws YAPI_Exception
newval
- : a string corresponding to the password for the "admin" userYAPI_Exception
- on errorpublic int setAdminPassword(String newval) throws YAPI_Exception
newval
- : a string corresponding to the password for the "admin" userYAPI_Exception
- on errorpublic int get_discoverable() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getDiscoverable() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_discoverable(int newval) throws YAPI_Exception
newval
- : either YNetwork.DISCOVERABLE_FALSE or YNetwork.DISCOVERABLE_TRUE, according to the
activation state of the multicast announce protocols to allow easy
discovery of the module in the network neighborhood (uPnP/Bonjour protocol)YAPI_Exception
- on errorpublic int setDiscoverable(int newval) throws YAPI_Exception
newval
- : either Y_DISCOVERABLE_FALSE or Y_DISCOVERABLE_TRUE, according to the activation
state of the multicast announce protocols to allow easy
discovery of the module in the network neighborhood (uPnP/Bonjour protocol)YAPI_Exception
- on errorpublic int get_wwwWatchdogDelay() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getWwwWatchdogDelay() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_wwwWatchdogDelay(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the allowed downtime of the WWW link (in seconds)
before triggering an automated
reboot to try to recover Internet connectivityYAPI_Exception
- on errorpublic int setWwwWatchdogDelay(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the allowed downtime of the WWW link (in seconds)
before triggering an automated
reboot to try to recover Internet connectivityYAPI_Exception
- on errorpublic String get_callbackUrl() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getCallbackUrl() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_callbackUrl(String newval) throws YAPI_Exception
newval
- : a string corresponding to the callback URL to notify significant state changesYAPI_Exception
- on errorpublic int setCallbackUrl(String newval) throws YAPI_Exception
newval
- : a string corresponding to the callback URL to notify significant state changesYAPI_Exception
- on errorpublic int get_callbackMethod() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getCallbackMethod() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_callbackMethod(int newval) throws YAPI_Exception
newval
- : a value among YNetwork.CALLBACKMETHOD_POST, YNetwork.CALLBACKMETHOD_GET and
YNetwork.CALLBACKMETHOD_PUT corresponding to the HTTP method used to notify callbacks for
significant state changesYAPI_Exception
- on errorpublic int setCallbackMethod(int newval) throws YAPI_Exception
newval
- : a value among Y_CALLBACKMETHOD_POST, Y_CALLBACKMETHOD_GET and Y_CALLBACKMETHOD_PUT
corresponding to the HTTP method used to notify callbacks for significant state changesYAPI_Exception
- on errorpublic int get_callbackEncoding() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getCallbackEncoding() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_callbackEncoding(int newval) throws YAPI_Exception
newval
- : a value among YNetwork.CALLBACKENCODING_FORM, YNetwork.CALLBACKENCODING_JSON,
YNetwork.CALLBACKENCODING_JSON_ARRAY, YNetwork.CALLBACKENCODING_CSV and
YNetwork.CALLBACKENCODING_YOCTO_API corresponding to the encoding standard to use for representing
notification valuesYAPI_Exception
- on errorpublic int setCallbackEncoding(int newval) throws YAPI_Exception
newval
- : a value among Y_CALLBACKENCODING_FORM, Y_CALLBACKENCODING_JSON,
Y_CALLBACKENCODING_JSON_ARRAY, Y_CALLBACKENCODING_CSV and Y_CALLBACKENCODING_YOCTO_API
corresponding to the encoding standard to use for representing notification valuesYAPI_Exception
- on errorpublic String get_callbackCredentials() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getCallbackCredentials() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_callbackCredentials(String newval) throws YAPI_Exception
newval
- : a string corresponding to the credentials required to connect to the callback addressYAPI_Exception
- on errorpublic int setCallbackCredentials(String newval) throws YAPI_Exception
newval
- : a string corresponding to the credentials required to connect to the callback addressYAPI_Exception
- on errorpublic int callbackLogin(String username, String password) throws YAPI_Exception
username
- : username required to log to the callbackpassword
- : password required to log to the callbackYAPI_Exception
- on errorpublic int get_callbackMinDelay() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getCallbackMinDelay() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_callbackMinDelay(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the minimum waiting time between two callback
notifications, in secondsYAPI_Exception
- on errorpublic int setCallbackMinDelay(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the minimum waiting time between two callback
notifications, in secondsYAPI_Exception
- on errorpublic int get_callbackMaxDelay() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getCallbackMaxDelay() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_callbackMaxDelay(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the maximum waiting time between two callback
notifications, in secondsYAPI_Exception
- on errorpublic int setCallbackMaxDelay(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the maximum waiting time between two callback
notifications, in secondsYAPI_Exception
- on errorpublic int get_poeCurrent() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getPoeCurrent() throws YAPI_Exception
YAPI_Exception
- on errorpublic static YNetwork FindNetwork(String func)
func
- : a string that uniquely characterizes the network interfacepublic int registerValueCallback(YNetwork.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 useDHCP(String fallbackIpAddr, int fallbackSubnetMaskLen, String fallbackRouter) throws YAPI_Exception
fallbackIpAddr
- : fallback IP address, to be used when no DHCP reply is receivedfallbackSubnetMaskLen
- : fallback subnet mask length when no DHCP reply is received, as an
integer (eg. 24 means 255.255.255.0)fallbackRouter
- : fallback router IP address, to be used when no DHCP reply is receivedYAPI_Exception
- on errorpublic int useStaticIP(String ipAddress, int subnetMaskLen, String router) throws YAPI_Exception
ipAddress
- : device IP addresssubnetMaskLen
- : subnet mask length, as an integer (eg. 24 means 255.255.255.0)router
- : router IP address (default gateway)YAPI_Exception
- on errorpublic String ping(String host) throws YAPI_Exception
host
- : the hostname or the IP address of the targetYAPI_Exception
public YNetwork nextNetwork()
public static YNetwork FirstNetwork()
Copyright © 2014. All rights reserved.