public class AddpClient extends Object
| Constructor and Description |
|---|
AddpClient() |
| Modifier and Type | Method and Description |
|---|---|
Map<String,AddpDevice> |
getDevices()
Gets the device list that was generated by a call to
searchForDevices() or
searchForDevicesAsync(DeviceFoundListener) |
static List<MagicCookie> |
getMagicCookieList()
Gets the
MagicCookies used when sending requests. |
int |
getWaitTimeInSeconds()
Gets the time to wait between discovery responses.
|
AddpDevice.AddpError |
rebootDevice(AddpDevice device,
String password)
Sends a reboot request to the device and waits for a response.
|
boolean |
searchForDevices()
Searches the network for Digi devices.
|
boolean |
searchForDevicesAsync(DeviceFoundListener listener)
Asynchronously searches for devices and fires off a
DeviceFoundListener.onFound(String, AddpDevice)
event for each device found. |
AddpDevice.AddpError |
setDHCP(AddpDevice device,
boolean toOn,
String password)
Sends a request to change the DHCP client settings on the device.
|
AddpDevice.AddpError |
setNetwork(AddpDevice device,
Inet4Address IP,
Inet4Address subnet,
Inet4Address gateway,
String password)
Sets the static network configuration on the device.
|
void |
setWaitTimeInSeconds(int seconds)
Sets the time to wait between discovery responses.
|
public int getWaitTimeInSeconds()
Gets the time to wait between discovery responses. Discovery will not complete until no new responses have been received for the specified interval. The default is 3 seconds.
setWaitTimeInSeconds(int)public void setWaitTimeInSeconds(int seconds)
Sets the time to wait between discovery responses. Discovery will not complete until no new responses have been received for the specified interval. The default is 3 seconds.
It is not advisable to change wait time while a discovery is in progress.
seconds - the timeout value.getWaitTimeInSeconds()public static List<MagicCookie> getMagicCookieList()
Gets the MagicCookies used when sending requests.
These cookies determine which devices will respond.
By default it is set to "DIGI", "DVKT", and "DGDP".
Note: changing this value will change the value for all instances of
AddpClient.
public boolean searchForDevices()
getDevices() to get the list
of found devices. This call blocks, use searchForDevicesAsync(DeviceFoundListener)
for a method that does not block.searchForDevicesAsync(DeviceFoundListener)public boolean searchForDevicesAsync(DeviceFoundListener listener)
Asynchronously searches for devices and fires off a
DeviceFoundListener.onFound(String, AddpDevice)
event for each device found. If a search is
already running, then it will wait for the previous search to complete
before starting a new one.
When the search is complete DeviceFoundListener.onSearchComplete()
is called.
listener - the callback to fire when a device is found. If null, then the
function returns false.searchForDevicespublic Map<String,AddpDevice> getDevices()
searchForDevices() or
searchForDevicesAsync(DeviceFoundListener)AddpDevice,
null if there was an error.public AddpDevice.AddpError rebootDevice(AddpDevice device, String password)
The device must be using a wired connection in order for this request to succeed.
device - the device to send the request to.password - the ADDP password for the device.public AddpDevice.AddpError setDHCP(AddpDevice device, boolean toOn, String password)
The device must be using a wired connection in order for this request to succeed.
device - the device to send the request to.toOn - if true, then DHCP will be enabled, if false then DHCP will be
disabled.password - the ADDP password for the device.public AddpDevice.AddpError setNetwork(AddpDevice device, Inet4Address IP, Inet4Address subnet, Inet4Address gateway, String password)
The device must be using a wired connection in order for this request to succeed.
device - the device to send the request to.IP - the IP address that the device should use.subnet - the subnet mask that the device should use.gateway - the gateway that the device should use.password - the ADDP password for the device.