|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttuwien.auto.calimero.mgmt.ManagementClientImpl
public class ManagementClientImpl
Implementation of management client.
Uses TransportLayer
internally for communication.
All management service methods invoked after a detach of the network link are allowed
to throw KNXIllegalStateException
.
Constructor Summary | |
---|---|
ManagementClientImpl(KNXNetworkLink link)
Creates a new management client attached to the supplied KNX network link. |
Method Summary | |
---|---|
byte |
authorize(Destination dst,
byte[] key)
Authorizes at a communication partner using an authorization key to obtain a certain access level. |
Destination |
createDestination(IndividualAddress remote,
boolean connectionOriented)
Creates a new destination using the remote KNX address for management communication. |
Destination |
createDestination(IndividualAddress remote,
boolean connectionOriented,
boolean keepAlive,
boolean verifyMode)
Creates a new destination using the remote KNX address and connection settings for management communication. |
KNXNetworkLink |
detach()
Detaches the network link from this management client. |
Priority |
getPriority()
Returns the current used KNX message priority for KNX messages. |
int |
getResponseTimeout()
Returns the response timeout used when waiting for a KNX response message to arrive. |
boolean |
isOpen()
Returns whether a network link is attached to this management client. |
int |
readADC(Destination dst,
int channelNr,
int repeat)
Reads the value of the A/D converter of a communication partner. |
IndividualAddress[] |
readAddress(boolean oneAddressOnly)
Reads the individual address of a communication partner in the KNX network. |
IndividualAddress |
readAddress(byte[] serialNo)
Reads the individual address of a communication partner identified using an unique serial number in the KNX network. |
byte[] |
readDeviceDesc(Destination dst,
int descType)
Reads the device descriptor information of a communication partner its controller. |
java.util.List |
readDomainAddress(boolean oneDomainOnly)
Reads the domain address of a communication partner in the KNX network. |
java.util.List |
readDomainAddress(byte[] domain,
IndividualAddress start,
int range)
Reads the domain address of a communication partner identified using an address range. |
byte[] |
readMemory(Destination dst,
int startAddr,
int bytes)
Reads memory data from the address space of a communication partner its controller. |
byte[] |
readProperty(Destination dst,
int objIndex,
int propID,
int start,
int elements)
Reads the value of a property of an interface object of a communication partner. |
byte[] |
readPropertyDesc(Destination dst,
int objIndex,
int propID,
int propIndex)
Reads the description of a property of an interface object of a communication partner. |
void |
restart(Destination dst)
Initiates a reset of the controller of a communication partner. |
void |
setPriority(Priority p)
Sets the KNX message priority for KNX messages to send. |
void |
setResponseTimeout(int timeout)
Sets the response timeout to wait for a KNX response message to arrive to complete a message exchange. |
void |
writeAddress(byte[] serialNo,
IndividualAddress newAddress)
Modifies the individual address of a communication partner identified using an unique serial number in the KNX network. |
void |
writeAddress(IndividualAddress newAddress)
Modifies the individual address of a communication partner in the KNX network. |
void |
writeDomainAddress(byte[] domain)
Modifies the domain address of a communication partner in the KNX network. |
void |
writeKey(Destination dst,
int level,
byte[] key)
Modifies or deletes an authorization key associated to an access level of a communication partner. |
void |
writeMemory(Destination dst,
int startAddr,
byte[] data)
Writes memory data in the address space of a communication partner its controller. |
void |
writeProperty(Destination dst,
int objIndex,
int propID,
int start,
int elements,
byte[] data)
Modifies the value of a property of an interface object of a communication partner. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ManagementClientImpl(KNXNetworkLink link) throws KNXLinkClosedException
The log service used by this management client is named "MC " +
link.getName()
.
link
- network link used for communication with a KNX network
KNXLinkClosedException
- if the network link is closedMethod Detail |
---|
public byte authorize(Destination dst, byte[] key) throws KNXDisconnectException, KNXTimeoutException, KNXRemoteException, KNXLinkClosedException
ManagementClient
This service uses point-to-point connection-oriented communication mode.
The returned access level is between 0 (maximum access rights) and 3 (i.e. minimum
access rights) or 0 (maximum access rights) and 15 (minimum access rights).
If no authorization is done at all or the supplied key is not valid, the default
access level used is set to minimum. A set access level is valid until disconnected
from the partner or a new authorization request is done.
authorize
in interface ManagementClient
dst
- destination at which to authorizekey
- byte array containing authorization key
KNXDisconnectException
- on disconnect during authorize
KNXTimeoutException
- on a timeout during send
KNXInvalidResponseException
- if the received access level is out of the
allowed value range
KNXLinkClosedException
- if network link to KNX network is closed
KNXRemoteException
public Destination createDestination(IndividualAddress remote, boolean connectionOriented)
ManagementClient
A management client will use the transport layer for creating the destination.
createDestination
in interface ManagementClient
remote
- destination KNX individual addressconnectionOriented
- true
for connection oriented mode,
false
for connectionless mode
public Destination createDestination(IndividualAddress remote, boolean connectionOriented, boolean keepAlive, boolean verifyMode)
ManagementClient
A management client will use the transport layer for creating the destination.
createDestination
in interface ManagementClient
remote
- destination KNX individual addressconnectionOriented
- true
for connection oriented mode,
false
for connectionless modekeepAlive
- true
to prevent a timing out of the logical
connection in connection oriented mode, false
to use default
connection timeoutverifyMode
- true
to indicate the destination has verify mode
enabled, false
otherwise
public KNXNetworkLink detach()
ManagementClient
A detach will also detach an internally used transport layer with all its consequences. If no network link is attached, no action is performed.
Note that a detach does not trigger a close of the used network link.
detach
in interface ManagementClient
null
if already
detachedTransportLayer.detach()
public Priority getPriority()
ManagementClient
getPriority
in interface ManagementClient
public int getResponseTimeout()
ManagementClient
getResponseTimeout
in interface ManagementClient
public boolean isOpen()
ManagementClient
isOpen
in interface ManagementClient
true
if link attached, false
if detachedpublic int readADC(Destination dst, int channelNr, int repeat) throws KNXTimeoutException, KNXDisconnectException, KNXRemoteException, KNXLinkClosedException
ManagementClient
This service uses point-to-point connection-oriented communication mode.
readADC
in interface ManagementClient
dst
- destination to read fromchannelNr
- channel number of the A/D converterrepeat
- number of consecutive converter read operations
KNXTimeoutException
- on a timeout during send
KNXDisconnectException
- on disconnect during read
KNXRemoteException
- on remote converter read problem (e.g. overflow or wrong
channel)
KNXLinkClosedException
- if network link to KNX network is closedpublic IndividualAddress[] readAddress(boolean oneAddressOnly) throws KNXTimeoutException, KNXRemoteException, KNXLinkClosedException
ManagementClient
This service uses broadcast communication mode.
The communication partner is a device in programming mode. In situations necessary
to know whether more than one device is in programming mode,
oneAddressOnly
is set to false
and the device
addresses are listed in the returned address array. In this case, the whole
response timeout is waited for read responses. If oneAddressOnly
is
true
, the array size of returned addresses is 1, and the method
returns after receiving the first read response.
readAddress
in interface ManagementClient
oneAddressOnly
- true
if method should return after receiving
the first read response, false
to wait the whole response
timeout for read responses
KNXTimeoutException
- on a timeout during send or no address response was
received
KNXInvalidResponseException
- on invalid read response message
KNXLinkClosedException
- if network link to KNX network is closed
KNXRemoteException
public IndividualAddress readAddress(byte[] serialNo) throws KNXTimeoutException, KNXRemoteException, KNXLinkClosedException
ManagementClient
This service uses broadcast communication mode.
readAddress
in interface ManagementClient
serialNo
- byte array with serial number, serialNo.length
= 6
KNXTimeoutException
- on a timeout during send or no address response was
received
KNXInvalidResponseException
- on invalid read response message
KNXLinkClosedException
- if network link to KNX network is closed
KNXRemoteException
public byte[] readDeviceDesc(Destination dst, int descType) throws KNXInvalidResponseException, KNXDisconnectException, KNXTimeoutException, KNXLinkClosedException
ManagementClient
This service uses point-to-point connectionless or connection-oriented communication mode.
The returned descriptor information format for device descriptor type 0 is as
follows (MSB to LSB):
| mask type (8 bit) | firmware version (8 bit) |
with the mask type split up into
| Medium Type (4 bit) | Firmware Type (4 bit)|
and the firmware version split up into
| version (4 bit) | sub code (4 bit) |
The returned descriptor information format for device descriptor type 2 is as
follows (MSB to LSB):
| application manufacturer (16 bit) | device type (16 bit) |
version (8 bit) | misc. (2 bit) + LT base (6 bit) | CI 1 (16 bit) |
CI 2 (16 bit) | CI 3 (16 bit) | CI 4 (16 bit) |
with CI = channel info
readDeviceDesc
in interface ManagementClient
dst
- destination to read fromdescType
- device descriptor type, 0 for type 0 or 2 for type 2
KNXInvalidResponseException
- on invalid read response message
KNXDisconnectException
- on disconnect in connection oriented mode
KNXTimeoutException
- on a timeout during send
KNXLinkClosedException
- if network link to KNX network is closedpublic java.util.List readDomainAddress(boolean oneDomainOnly) throws KNXLinkClosedException, KNXInvalidResponseException, KNXTimeoutException
ManagementClient
This service uses system broadcast communication mode.
The communication partner is a device in programming mode. In situations necessary
to read domain addresses from more than one device in programming mode,
oneAddressOnly
is set to false
and all received
domain addresses are returned in the list. In this case, the whole response timeout
is waited for address responses. If oneAddressOnly
is
true
, the method returns after receiving the first read response,
and the list contains one domain address.
readDomainAddress
in interface ManagementClient
oneDomainOnly
- true
if method should return after receiving
the first read response, false
to wait the whole response
timeout for read responses
KNXLinkClosedException
- if network link to KNX network is closed
KNXInvalidResponseException
- on invalid read response message
KNXTimeoutException
- on a timeout during send or no address response was
receivedpublic java.util.List readDomainAddress(byte[] domain, IndividualAddress start, int range) throws KNXInvalidResponseException, KNXLinkClosedException, KNXTimeoutException
ManagementClient
This method is used to check existence of a device with the specified domain on a
powerline medium and paying attention to more installations.
This service uses system broadcast communication mode.
A note on answering behavior when the specified range
is < 255:
If an answering device 'A' receives a domain address response from another
answering device 'B', 'A' will terminate the transmission of its response.
readDomainAddress
in interface ManagementClient
domain
- byte array with domain address to check for,
domain.length
= 2 (powerline medium only)start
- start from this individual address, lower bound of checked
rangerange
- address range, specifies upper bound address (startAddress + range)
KNXInvalidResponseException
- on invalid response message
KNXLinkClosedException
- if network link to KNX network is closed
KNXTimeoutException
- on a timeout during send or no address response was
receivedpublic byte[] readMemory(Destination dst, int startAddr, int bytes) throws KNXTimeoutException, KNXDisconnectException, KNXRemoteException, KNXLinkClosedException
ManagementClient
This service uses point-to-point connection-oriented communication mode.
Note that a remote application layer shall ignore a memory read if the amount of
read memory does not fit into an APDU of maximum length.
readMemory
in interface ManagementClient
dst
- destination to read fromstartAddr
- 16 bit start address to read in memorybytes
- number of data bytes to read (with increasing addresses)
KNXTimeoutException
- on a timeout during send
KNXDisconnectException
- on disconnect during read
KNXRemoteException
- on problems of the partner reading (part of) the memory
(e.g. access to illegal or protected address space, invalid number of
bytes)
KNXLinkClosedException
- if network link to KNX network is closedpublic byte[] readProperty(Destination dst, int objIndex, int propID, int start, int elements) throws KNXTimeoutException, KNXRemoteException, KNXDisconnectException, KNXLinkClosedException
ManagementClient
This service uses point-to-point connectionless or connection-oriented
communication mode.
One value element in the returned data byte array consumes
(data.length / elements)
bytes.
The byte offset into the returned data to access a property value element with
index i
(zero based) is calculated the following way:
offset = (data.length / elements) * i
.
Note that interface objects with active access protection are only accessible over
connection oriented communication.
readProperty
in interface ManagementClient
dst
- destination to read fromobjIndex
- interface object indexpropID
- property identifierstart
- start index in the property value to start reading fromelements
- number of elements to read
KNXTimeoutException
- on a timeout during send
KNXRemoteException
- if tried to access a non existing property or forbidden
property access (not sufficient access rights)
KNXInvalidResponseException
- if received number of elements differ
KNXDisconnectException
- on disconnect in connection oriented mode
KNXLinkClosedException
- if network link to KNX network is closedpublic byte[] readPropertyDesc(Destination dst, int objIndex, int propID, int propIndex) throws KNXTimeoutException, KNXRemoteException, KNXDisconnectException, KNXLinkClosedException
ManagementClient
This service uses point-to-point connectionless or connection-oriented
communication mode.
The property of the object is addressed either with a the propID
or
with the propIndex
. The property index is only used if the property
identifier is 0, otherwise the index is ignored.
When using the property ID for access, the property index in the returned
description is either the correct property index of the addressed property or 0.
readPropertyDesc
in interface ManagementClient
dst
- destination to read fromobjIndex
- interface object indexpropID
- property identifier, specify 0 to use the property indexpropIndex
- property index, starts with index 0 for the first property
KNXTimeoutException
- on a timeout during send
KNXRemoteException
- if the response contains no description (e.g. if tried
to access a non existing property)
KNXDisconnectException
- on disconnect in connection oriented mode
KNXLinkClosedException
- if network link to KNX network is closedpublic void restart(Destination dst) throws KNXTimeoutException, KNXLinkClosedException
ManagementClient
This service uses point-to-point connectionless or connection-oriented
communication mode.
Invoking this method may result in a termination of the transport layer connection
(i.e. state transition into disconnected for the supplied destination).
restart
in interface ManagementClient
dst
- destination to reset
KNXTimeoutException
- on a timeout during send
KNXLinkClosedException
- if network link to KNX network is closedpublic void setPriority(Priority p)
ManagementClient
setPriority
in interface ManagementClient
p
- new priority to usepublic void setResponseTimeout(int timeout)
ManagementClient
setResponseTimeout
in interface ManagementClient
timeout
- time in secondspublic void writeAddress(byte[] serialNo, IndividualAddress newAddress) throws KNXTimeoutException, KNXLinkClosedException
ManagementClient
This service uses broadcast communication mode.
writeAddress
in interface ManagementClient
serialNo
- byte array with serial number, serialNo.length
= 6newAddress
- new address
KNXTimeoutException
- on a timeout during send
KNXLinkClosedException
- if network link to KNX network is closedpublic void writeAddress(IndividualAddress newAddress) throws KNXTimeoutException, KNXLinkClosedException
ManagementClient
This service uses broadcast communication mode.
The communication partner is a device in programming mode.
writeAddress
in interface ManagementClient
newAddress
- new address
KNXTimeoutException
- on a timeout during send
KNXLinkClosedException
- if network link to KNX network is closedpublic void writeDomainAddress(byte[] domain) throws KNXTimeoutException, KNXLinkClosedException
ManagementClient
This service uses system broadcast communication mode.
The communication partner is a device in programming mode.
writeDomainAddress
in interface ManagementClient
domain
- byte array with domain address, domain.length
= 2 (on
powerline medium) or domain.length
= 6 (on RF medium)
KNXTimeoutException
- on a timeout during send
KNXLinkClosedException
- if network link to KNX network is closedpublic void writeKey(Destination dst, int level, byte[] key) throws KNXTimeoutException, KNXDisconnectException, KNXRemoteException, KNXLinkClosedException
ManagementClient
This service uses point-to-point connection-oriented communication mode.
If the supplied key is 0xFFFFFFFF, the key for the given access level
is removed. The write request has to be done using equal or higher access rights
than the access rights of the level
which is to be modified (i.e.
current level <= level to change).
writeKey
in interface ManagementClient
dst
- destination to write tolevel
- access level to modifykey
- new key for the access level or 0xFFFFFFFF to remove key
KNXTimeoutException
- on a timeout during send
KNXDisconnectException
- on disconnect during write
KNXRemoteException
- if the current access level > necessary access level for
writing a key
KNXLinkClosedException
- if network link to KNX network is closedpublic void writeMemory(Destination dst, int startAddr, byte[] data) throws KNXDisconnectException, KNXTimeoutException, KNXRemoteException, KNXLinkClosedException
ManagementClient
This service uses point-to-point connection-oriented communication mode.
If verify mode is enabled for the destination, this method will wait for a memory
write response and do an explicit read back of the written memory.
Note that a remote application layer shall ignore a memory write if the amount of
memory does not fit into an APDU of maximum length the remote layer can handle.
writeMemory
in interface ManagementClient
dst
- destination to write tostartAddr
- 16 bit start address to write in memorydata
- byte array containing the memory data to write
KNXDisconnectException
- on disconnect during read
KNXTimeoutException
- on a timeout during send
KNXRemoteException
- in verify mode on problems of the partner writing the
memory data (e.g. access to illegal or protected address space, invalid
number of bytes) or erroneous memory data was written
KNXInvalidResponseException
- in verify mode if the size of memory read back
differs from the written size of memory
KNXLinkClosedException
- if network link to KNX network is closedpublic void writeProperty(Destination dst, int objIndex, int propID, int start, int elements, byte[] data) throws KNXTimeoutException, KNXRemoteException, KNXDisconnectException, KNXLinkClosedException
ManagementClient
This service uses point-to-point connectionless or connection-oriented
communication mode.
The value of the written property is explicitly read back after writing.
Note that interface objects with active access protection are only accessible over
connection oriented communication.
writeProperty
in interface ManagementClient
dst
- destination to write toobjIndex
- interface object indexpropID
- property identifierstart
- start index in the property value to start writing toelements
- number of elements to writedata
- byte array containing property value data to write
KNXTimeoutException
- on a timeout during send
KNXRemoteException
- if tried to access a non existing property or forbidden
property access (not sufficient access rights) or erroneous property data
was written
KNXInvalidResponseException
- if received number of elements differ or the
data length read back differs from the written data length
KNXDisconnectException
- on disconnect in connection oriented mode
KNXLinkClosedException
- if network link to KNX network is closed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |