tuwien.auto.calimero.mgmt
Class RemotePropertyServiceAdapter

java.lang.Object
  extended by tuwien.auto.calimero.mgmt.RemotePropertyServiceAdapter
All Implemented Interfaces:
PropertyAdapter

public class RemotePropertyServiceAdapter
extends java.lang.Object
implements PropertyAdapter

Property adapter for remote property services.


Constructor Summary
RemotePropertyServiceAdapter(KNXNetworkLink link, IndividualAddress remote, PropertyAdapterListener l, boolean connOriented)
          Creates a new property adapter for remote property access.
RemotePropertyServiceAdapter(KNXNetworkLink link, IndividualAddress remote, PropertyAdapterListener l, byte[] authorizeKey)
          Creates a new property adapter for remote property access in connection-oriented mode with authorization.
 
Method Summary
 void close()
          Closes the adapter.
 byte[] getDescription(int objIndex, int pid, int propIndex)
          Reads the description of a property of an interface object.
 java.lang.String getName()
          Returns the name for identifying this adapter and its destination.
 byte[] getProperty(int objIndex, int pid, int start, int elements)
          Gets property value elements in an interface object property.
 boolean isOpen()
          Returns whether this adapter can be used for property access and is not closed.
 void setProperty(int objIndex, int pid, int start, int elements, byte[] data)
          Sets property value elements in an interface object property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotePropertyServiceAdapter

public RemotePropertyServiceAdapter(KNXNetworkLink link,
                                    IndividualAddress remote,
                                    PropertyAdapterListener l,
                                    boolean connOriented)
                             throws KNXLinkClosedException
Creates a new property adapter for remote property access.

Parameters:
link - KNX network link used for communication with the KNX network
remote - KNX individual address to access its interface objects
l - property adapter listener to get notified about adapter events, use null for no listener
connOriented - true to use connection oriented mode for access, false to use connectionless mode
Throws:
KNXLinkClosedException - if the network link is closed

RemotePropertyServiceAdapter

public RemotePropertyServiceAdapter(KNXNetworkLink link,
                                    IndividualAddress remote,
                                    PropertyAdapterListener l,
                                    byte[] authorizeKey)
                             throws KNXException
Creates a new property adapter for remote property access in connection-oriented mode with authorization.

Parameters:
link - KNX network link used for communication with the KNX network
remote - KNX individual address to access its interface objects
l - property adapter listener to get notified about adapter events, use null for no listener
authorizeKey - byte array with authorization key
Throws:
KNXLinkClosedException - if the network link is closed
KNXException - on failure during authorization
Method Detail

close

public void close()
Description copied from interface: PropertyAdapter
Closes the adapter.

Depending on the adapter, necessary steps to terminate a connection might be done and owned resources will be freed.
A closed adapter can't be used for property access anymore.
Currently, this method does not invoke PropertyAdapterListener.adapterClosed(tuwien.auto.calimero.CloseEvent).

Specified by:
close in interface PropertyAdapter

getDescription

public byte[] getDescription(int objIndex,
                             int pid,
                             int propIndex)
                      throws KNXException
Description copied from interface: PropertyAdapter
Reads the description of a property of an interface object.

The property description layout is according the application layer property description service.

Specified by:
getDescription in interface PropertyAdapter
Parameters:
objIndex - interface object index
pid - property identifier, specify 0 to use the property index
propIndex - property index, starts with index 0 for the first property
Returns:
byte array containing the property description, starting with the property object index
Throws:
KNXException - on error getting the property description

getName

public java.lang.String getName()
Returns the name for identifying this adapter and its destination.

The name for this adapter starts with "remote PS " + remote KNX individual address, allowing easier distinction of adapter types.

Specified by:
getName in interface PropertyAdapter
Returns:
adapter name as string

getProperty

public byte[] getProperty(int objIndex,
                          int pid,
                          int start,
                          int elements)
                   throws KNXException
Description copied from interface: PropertyAdapter
Gets property value elements in an interface object property.

Specified by:
getProperty in interface PropertyAdapter
Parameters:
objIndex - interface object index
pid - property identifier
start - start index in the property value to start reading from
elements - number of elements to get
Returns:
byte array containing the property value data
Throws:
KNXException - on error getting the interface object property

isOpen

public boolean isOpen()
Description copied from interface: PropertyAdapter
Returns whether this adapter can be used for property access and is not closed.

Specified by:
isOpen in interface PropertyAdapter
Returns:
true if adapter open, false if closed

setProperty

public void setProperty(int objIndex,
                        int pid,
                        int start,
                        int elements,
                        byte[] data)
                 throws KNXException
Description copied from interface: PropertyAdapter
Sets property value elements in an interface object property.

Specified by:
setProperty in interface PropertyAdapter
Parameters:
objIndex - interface object index
pid - property identifier
start - start index in the property value to start writing to
elements - number of elements to set
data - byte array containing the property value data
Throws:
KNXException - on error setting the interface object property