Package org.apache.plc4x.java.api
Interface PlcDriver
-
public interface PlcDriver
General interface defining the minimal methods required for adding a new type of driver to the PLC4J system.
Note that each driver has to add a service file called org.apache.plc4x.java.spi.PlcDriver to src/main/resources/META-INF which contains the fully qualified classname in order to get loaded by the PlcDriverManager instances.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default PlcDiscoveryRequest.Builder
discoveryRequestBuilder()
PlcConnection
getConnection(String url)
Connects to a PLC using the given plc connection string.PlcConnection
getConnection(String url, PlcAuthentication authentication)
Connects to a PLC using the given plc connection string using given authentication credentials.default PlcDriverMetadata
getMetadata()
String
getProtocolCode()
String
getProtocolName()
default PlcTag
prepareTag(String tagAddress)
-
-
-
Method Detail
-
getProtocolCode
String getProtocolCode()
- Returns:
- code of the implemented protocol. This is usually a lot shorter than the String returned by @see#getProtocolName().
-
getProtocolName
String getProtocolName()
- Returns:
- name of the implemented protocol.
-
getMetadata
default PlcDriverMetadata getMetadata()
- Returns:
- Provides driver metadata.
-
getConnection
PlcConnection getConnection(String url) throws PlcConnectionException
Connects to a PLC using the given plc connection string.- Parameters:
url
- plc connection string.- Returns:
- PlcConnection object.
- Throws:
PlcConnectionException
- an exception if the connection attempt failed.
-
getConnection
PlcConnection getConnection(String url, PlcAuthentication authentication) throws PlcConnectionException
Connects to a PLC using the given plc connection string using given authentication credentials.- Parameters:
url
- plc connection string.authentication
- authentication credentials.- Returns:
- PlcConnection object.
- Throws:
PlcConnectionException
- an exception if the connection attempt failed.
-
discoveryRequestBuilder
default PlcDiscoveryRequest.Builder discoveryRequestBuilder()
- Returns:
- discovery request builder.
- Throws:
PlcUnsupportedOperationException
- if the connection does not support subscription
-
-