Package org.openmuc.jdlms
Class SerialConnectionBuilder
- java.lang.Object
-
- org.openmuc.jdlms.ConnectionBuilder<SerialConnectionBuilder>
-
- org.openmuc.jdlms.SerialConnectionBuilder
-
public class SerialConnectionBuilder extends ConnectionBuilder<SerialConnectionBuilder>
This connection Builder is used, to build an serial connection to a meter, optionally using the IEC 61056-21 protocol, or directly HDLC.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
SerialConnectionBuilder.HdlcSettingsImpl
-
Nested classes/interfaces inherited from class org.openmuc.jdlms.ConnectionBuilder
ConnectionBuilder.SettingsImpl
-
-
Constructor Summary
Constructors Constructor Description SerialConnectionBuilder(java.lang.String serialPortName)
Constructs a SerialConnectionBuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SessionLayer
buildSessionLayer(Settings settings)
protected Settings
buildSettings()
SerialConnectionBuilder
disableHandshake()
Disables a IEC 62056-21 mode E handshake with the meter.SerialConnectionBuilder
enableHandshake()
Enables a IEC 62056-21 mode E handshake with the meter.SerialConnectionBuilder
setBaudRate(int baudrate)
Sets the baudrate.SerialConnectionBuilder
setBaudRateChangeTime(long baudrateChangeTime)
Sets the baud rate change delay in ms in the handshake process.SerialConnectionBuilder
setIec21Address(java.lang.String iec21Address)
Specifies the optional field in the IEC 62056-21 request message.SerialConnectionBuilder
setSerialPortName(java.lang.String serialPortName)
Sets the serial port name.-
Methods inherited from class org.openmuc.jdlms.ConnectionBuilder
build, buildSnConnection, setAlwaysSendSecurityMechanismName, setChallengeLength, setClientId, setFrameCounter, setHdlcMaxInformationLength, setLnToSnMapping, setLogicalDeviceId, setPhysicalDeviceAddress, setRawMessageListener, setReferencingMethod, setResponseTimeout, setSecuritySuite, setSkipAARQEncryption, setSnClassInfo, setSystemTitle, setUserId
-
-
-
-
Method Detail
-
buildSettings
protected Settings buildSettings()
- Specified by:
buildSettings
in classConnectionBuilder<SerialConnectionBuilder>
-
buildSessionLayer
protected SessionLayer buildSessionLayer(Settings settings) throws java.io.IOException
- Specified by:
buildSessionLayer
in classConnectionBuilder<SerialConnectionBuilder>
- Throws:
java.io.IOException
-
setSerialPortName
public SerialConnectionBuilder setSerialPortName(java.lang.String serialPortName)
Sets the serial port name.- Parameters:
serialPortName
- the serial port name.- Returns:
- the
SerialConnectionBuilder
reference.
-
setIec21Address
public SerialConnectionBuilder setIec21Address(java.lang.String iec21Address)
Specifies the optional field in the IEC 62056-21 request message. The address consists of max 32 characters with values0-9
,A-Z
ora-z
. Leading zeros in the tariff device address are ignored (i.e.10203 == 010203 == 00000010203
)This method call enables the handshake.
- Parameters:
iec21Address
- the optional IEC 62056-21 address.- Returns:
- the
SerialConnectionBuilder
reference. - Throws:
java.lang.IllegalArgumentException
- if the specified address does not match the address character requirements or isnull
.
-
disableHandshake
public SerialConnectionBuilder disableHandshake()
Disables a IEC 62056-21 mode E handshake with the meter. Start directly with HDLC.- Returns:
- the
SerialConnectionBuilder
reference.
-
enableHandshake
public SerialConnectionBuilder enableHandshake()
Enables a IEC 62056-21 mode E handshake with the meter.- Returns:
- the
SerialConnectionBuilder
reference.
-
setBaudRate
public SerialConnectionBuilder setBaudRate(int baudrate)
Sets the baudrate. Default value is 9600.This method call disables the handshake.
NOTE: this option can't be used with
setBaudRateChangeTime(long)
orsetIec21Address(String)
.- Parameters:
baudrate
- a positive integer. E.g. 9600.- Returns:
- the
SerialConnectionBuilder
reference. - See Also:
disableHandshake()
-
setBaudRateChangeTime
public SerialConnectionBuilder setBaudRateChangeTime(long baudrateChangeTime)
Sets the baud rate change delay in ms in the handshake process. Default value is150
.This method call enables the handshake.
NOTE: this option can't be used with
setBaudRate(int)
.- Parameters:
baudrateChangeTime
- sets the baud rate change time in the IEC 62056-21 handshake sequence.- Returns:
- the
SerialConnectionBuilder
reference. - See Also:
enableHandshake()
-
-