public interface DeviceReference extends Reference
getDevice(). Device references are created within the discovery process and returned by
the DefaultClient. All device references are registered in the DeviceServiceRegistry.
There should only be one reference to each device.
Receiving a device reference typically means the registration as device listener (DeviceListener) to the device, which informs about device changes by using callbacks. The
DefaultClient is such a device listener. Device listening can be added manually by addListener(DeviceListener) and can be removed by removeListener(DeviceListener).
| Modifier and Type | Field and Description |
|---|---|
static int |
STATE_BUILD_UP
STATE: Device is running is the latest known information about the referenced device, and
device (proxy/local) was created
|
static int |
STATE_RUNNING
STATE: Device is running is the latest known information about the referenced device
|
static int |
STATE_STOPPED
STATE: Device has stopped is the latest known information about the referenced device
|
static int |
STATE_UNKNOWN
STATE: Device reference created, but no information about device state
|
LOCATION_LOCAL, LOCATION_REMOTE, LOCATION_UNKNOWN| Modifier and Type | Method and Description |
|---|---|
void |
addListener(DeviceListener listener)
Register listener (callback) for device reference changes.
|
void |
fetchCompleteDiscoveryDataAsync()
Fetches all discovery data of device reference by sending a directed probe to the remote
device.
|
void |
fetchCompleteDiscoveryDataSync()
Fetches all discovery data of device reference by sending a directed probe to the remote
device.
|
Iterator |
getChildren(boolean doDiscovery)
Returns the embedded device references, if any exist.
|
Device |
getDevice()
Get device.
|
Iterator |
getDevicePortTypes(boolean doDiscovery)
Gets port types implemented by device.
|
QName[] |
getDevicePortTypesAsArray(boolean doDiscovery)
Gets port types implemented by device.
|
DiscoveryData |
getDiscoveryData() |
Iterator |
getDiscoveryXAddressInfos(boolean doDiscovery) |
EndpointReference |
getEndpointReference()
Gets endpoint reference of device.
|
long |
getMetadataVersion(boolean doDiscovery)
Returns the metadata version of the device.
|
XAddressInfo |
getPreferredDiscoveryXAddressInfo() |
XAddressInfo |
getPreferredXAddressInfo() |
Iterator |
getScopes(boolean doDiscovery)
Gets scopes the device resides in.
|
URI[] |
getScopesAsArray(boolean doDiscovery)
Gets scopes the device resides in.
|
SecurityKey |
getSecurityKey() |
int |
getState()
Gets state of device / device reference.
|
Iterator |
getTransportAndDiscoveryXAddressInfos(boolean doDiscovery) |
Iterator |
getXAddressInfos(boolean doDiscovery)
Get the transport addresses of the device.
|
boolean |
isAutoUpdateDevice() |
boolean |
isCompleteDiscovered()
Case remote: Did we receive the answer to a directed probe for the current version of the
device? Case local: Always true.
|
boolean |
isDeviceObjectExisting()
Case remote: Did a proxy device object exist for the current version of the remote device?
Case local: Always true. |
boolean |
isDiscovered()
Case remote: Did we receive a resolve message for the current version of the device.
|
void |
probeDeviceDirectly(ResponseCallback callback) |
Device |
rebuildDevice() |
void |
removeListener(DeviceListener listener)
Unregisters listener for this device reference.
|
void |
setAutoUpdateDevice(boolean autoUpdateDevice)
When set to
true, the device reference will attempt to rebuild the device proxy
automatically each time a a change in the device's metadata version is detected. |
void |
setSecurityKey(SecurityKey newKey) |
boolean |
supportsSecurity() |
getComManId, getLocation, getPreferredXAddressstatic final int STATE_UNKNOWN
static final int STATE_STOPPED
static final int STATE_RUNNING
static final int STATE_BUILD_UP
Device getDevice() throws CommunicationException
A Proxy to a remote device is built up by sending resolve and get messages.
CommunicationException - This exception is thrown, if the remote device doesn't answer to the messages, which tries to receive the
necessary data. The possible messages to be sent are resolve, and get messages. The timeout value can be
configured in the DispatchingProperties via the methods DispatchingProperties.setResponseWaitTime(int)
and DispatchingProperties.setResponseWaitTime(int).void fetchCompleteDiscoveryDataSync()
throws CommunicationException
CommunicationExceptionvoid fetchCompleteDiscoveryDataAsync()
throws CommunicationException
CommunicationExceptionEndpointReference getEndpointReference()
Iterator getDevicePortTypes(boolean doDiscovery) throws CommunicationException
doDiscovery - if true and no port types are known and device is remote located, a resolve message will be
sent to remote device to discover them.QName.CommunicationExceptionQName[] getDevicePortTypesAsArray(boolean doDiscovery) throws CommunicationException
doDiscovery - if true and no port types are known and device is remote located, a resolve message will be
sent to remote device to discover them.QName.CommunicationExceptionIterator getScopes(boolean doDiscovery) throws CommunicationException
doDiscovery - if true and no port types are known and device is remote located, a resolve message will be
sent to remote device to discover them.URI.CommunicationExceptionURI[] getScopesAsArray(boolean doDiscovery) throws CommunicationException
doDiscovery - if true and no port types are known and device is remote located, a resolve message will be
sent to remote device to discover them.URI.CommunicationExceptionlong getMetadataVersion(boolean doDiscovery)
throws CommunicationException
doDiscovery - if true and no port types are known and device is remote located, a resolve message will be
sent to remote device to discover them.CommunicationExceptionIterator getXAddressInfos(boolean doDiscovery) throws CommunicationException
doDiscovery - if true and no port types are known and device is remote located, a resolve message will be
sent to remote device to discover them.URI .CommunicationExceptionIterator getDiscoveryXAddressInfos(boolean doDiscovery) throws CommunicationException
CommunicationExceptionIterator getTransportAndDiscoveryXAddressInfos(boolean doDiscovery) throws CommunicationException
CommunicationExceptionvoid removeListener(DeviceListener listener)
listener - listener to remove.void addListener(DeviceListener listener)
listener - listener (callback) to register.boolean isDeviceObjectExisting()
true.true.boolean isCompleteDiscovered()
true.boolean isDiscovered()
true.int getState()
STATE_UNKNOWN, STATE_RUNNING, STATE_BUILD_UP and STATE_STOPPED.STATE_UNKNOWN,
STATE_RUNNING,
STATE_BUILD_UP,
STATE_STOPPEDboolean isAutoUpdateDevice()
void setAutoUpdateDevice(boolean autoUpdateDevice)
true, the device reference will attempt to rebuild the device proxy
automatically each time a a change in the device's metadata version is detected.autoUpdateDevice - XAddressInfo getPreferredXAddressInfo()
XAddressInfo getPreferredDiscoveryXAddressInfo()
DiscoveryData getDiscoveryData()
SecurityKey getSecurityKey()
void setSecurityKey(SecurityKey newKey)
Device rebuildDevice() throws CommunicationException
CommunicationExceptionIterator getChildren(boolean doDiscovery) throws CommunicationException
doDiscovery - should be true if additional network communication is acceptable. This method will block until the
information has been obtained.CommunicationException - Can only be thrown when doDiscovery is set to trueboolean supportsSecurity()
void probeDeviceDirectly(ResponseCallback callback)