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 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,
                                    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.
      • prepareTag

        default PlcTag prepareTag​(String tagAddress)