T
- the concrete connection builder.public abstract class ConnectionBuilder<T extends ConnectionBuilder<T>>
extends java.lang.Object
DlmsConnection
.TcpConnectionBuilder
,
SerialConnectionBuilder
Modifier and Type | Class and Description |
---|---|
protected class |
ConnectionBuilder.SettingsImpl
This Settings can be overridden by an implementing Settings.
|
Constructor and Description |
---|
ConnectionBuilder()
Create a new connection builder, with default settings.
|
Modifier and Type | Method and Description |
---|---|
abstract DlmsConnection |
build()
Builds a new DLMS/COSEM Connection, which is connected to the remote meter.
|
protected DlmsConnection |
buildConnection(Settings settings,
SessionLayer sessionLayer)
Builds a new DLMS/COSEM Connection.
|
T |
setChallengeLength(int challengeLength)
Change the used challenge length.
|
T |
setClientId(int clientId)
Set the client ID which should be used to connect to the server.
|
T |
setDeviceId(long deviceId)
Set the used device ID.
|
T |
setLogicalDeviceId(int logicalDeviceId)
Set the logical device ID of the logical device in the physical server.
|
T |
setManufactureId(java.lang.String manufactureId)
Sets the manufacturer ID.
|
T |
setPhysicalDeviceAddress(int physicalDeviceAddress)
Sets the physical device address.
|
T |
setReferencingMethod(ReferencingMethod referencingMethod)
Set the referencing method used to address COSEM objects in the remote meter.
|
T |
setResponseTimeout(int responseTimeout)
Sets the time in milliseconds the client waits for a response.
|
T |
setSecuritySuite(SecuritySuite securitySuite)
Set
SecuritySuite . |
T |
setSystemTitle(java.lang.String manufacturerId,
long deviceId)
Set the client's system title.
|
public ConnectionBuilder()
public T setReferencingMethod(ReferencingMethod referencingMethod)
The default referencing method is ReferencingMethod.LOGICAL
.
referencingMethod
- the referencing method.public T setSecuritySuite(SecuritySuite securitySuite)
SecuritySuite
.
Default authentication is NONE.
securitySuite
- authentication objectpublic T setClientId(int clientId)
Default client ID is 16 (Public Client).
clientId
- the client id.public T setLogicalDeviceId(int logicalDeviceId)
Default logical device ID is 1 (Management Logical Device).
logicalDeviceId
- the logical device ID.public T setChallengeLength(int challengeLength)
The length must be in the range [8, 64]
. Default is 64
.
challengeLength
- challenge lengthjava.lang.IllegalArgumentException
- if the integer is not in the range [8, 64]
.public T setDeviceId(long deviceId)
Not the be mistaken with the logical device ID.
deviceId
- the device IDpublic T setPhysicalDeviceAddress(int physicalDeviceAddress)
This is only relevant if a connection over HDLC is used. In this case the physical device address is by default 0.
physicalDeviceAddress
- the physical device address.public T setResponseTimeout(int responseTimeout)
responseTimeout
- time in milliseconds.public T setManufactureId(java.lang.String manufactureId)
manufactureId
- the manufacturer IDpublic T setSystemTitle(java.lang.String manufacturerId, long deviceId)
manufacturerId
- the manufacturer IDdeviceId
- the device IDprotected final DlmsConnection buildConnection(Settings settings, SessionLayer sessionLayer) throws java.io.IOException
This method is used if a custom session layer or transport layer is used.
settings
- the settings for the DLMS/COSEM connection.sessionLayer
- the session layer.DlmsConnection
with the given settings.java.io.IOException
- if an error occurs, while connecting to the meter.build()
public abstract DlmsConnection build() throws java.io.IOException
DlmsConnection
with the given settings.java.io.IOException
- if an error occurs, while connecting to the meter.