### Example connection string Source: https://plc4x.apache.org/plc4x/latest/users/protocols/simulated.html An example connection string using the device name 'foobar'. ```text simulated:foobar ``` -------------------------------- ### Install dotnet SDK via Homebrew Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/macos.html Installs the .NET SDK for macOS using Homebrew. Alternatively, Microsoft provides an installer from their website. ```bash brew install --cask dotnet-sdk8 ``` -------------------------------- ### Start Zookeeper Source: https://plc4x.apache.org/plc4x/latest/users/integrations/apache-kafka.html Command to start Zookeeper, a prerequisite for Kafka. Run from the Kafka installation directory. ```bash bin/zookeeper-server-start.sh config/zookeeper.properties ``` -------------------------------- ### Install Git via Homebrew Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/macos.html Installs Git using Homebrew. Use this if the 'git --version' check indicates Git is not installed. ```bash brew install git ``` -------------------------------- ### Install Git on apt-based systems Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Use this command to install Git on Debian/Ubuntu-based systems. ```bash sudo apt install git ``` -------------------------------- ### Install .NET SDK on Ubuntu Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html These commands set up the Microsoft package repository and install the .NET SDK 8.0 on Ubuntu. ```bash sudo mkdir -p /etc/apt/keyrings wget https://packages.microsoft.com/keys/microsoft.asc -O /etc/apt/keyrings/microsoft.asc echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/microsoft.asc] https://packages.microsoft.com/ubuntu/24.04/prod noble main" | sudo tee /etc/apt/sources.list.d/microsoft-dotnet.list sudo apt update sudo apt install dotnet-sdk-8.0 ``` -------------------------------- ### Install Java on apt-based systems Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Use this command to install OpenJDK 21 on Debian/Ubuntu-based systems. ```bash sudo apt install openjdk-21-jdk ``` -------------------------------- ### Java example using PlcConnectionCache for polling Source: https://plc4x.apache.org/plc4x/latest/users/tools/connection-cache.html Shows a main method that creates a PlcConnectionCache via its builder, then loops 10000 times to get a connection lease, read a boolean tag, and handle exceptions. The connection is returned to the cache when close() is called. Includes a 100ms sleep between iterations. ```java public static void main(String[] args) throws Exception { PlcConnectionCache connectionCache = PlcConnectionCache.getBuilder() .withConnectionFactory(PlcDriverManager.getDefault().getConnectionFactory()) .build(); for (int i = 0; i < 10000; i++) { try(PlcConnection connection = connectionCache.getConnection("s7://192.168.1.192")) { if (connection.isConnected()){ PlcReadRequest.Builder builder = connection.readRequestBuilder(); builder.addTagAddress("PollingValue", "%DB1:4.0:BOOL"); PlcReadRequest readRequest = builder.build(); PlcReadResponse syncResponse = readRequest.execute().get(2000, TimeUnit.MILLISECONDS); printResponse(syncResponse); } else { logger.info("PLC is not connected, let's try again to connect"); connection.connect(); } } catch (PlcConnectionException e){ logger.error("Connection exception in trying to connect", e); } catch (CancellationException e){ logger.error("Polling Thread canceled", e); } catch (IllegalStateException e){ logger.error("Connection was in an unexpected state", e); } catch (ExecutionException e){ logger.error("Interrupted Exception fired", e); } catch (TimeoutException e) { logger.error("Timeout exception fired", e); } TimeUnit.MILLISECONDS.sleep(100); } System.exit(0); } ``` -------------------------------- ### Install gcc on apt-based systems Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Use this command to install gcc on Debian/Ubuntu-based systems. ```bash sudo apt install gcc ``` -------------------------------- ### Grant Java raw network capabilities (example path) Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Example of the setcap command with a real Java path on Ubuntu 22.04. ```bash sudo setcap cap_net_raw,cap_net_admin=eip /usr/lib/jvm/java-21-openjdk-arm64/bin/java ``` -------------------------------- ### AB-ETH Connection String Example Source: https://plc4x.apache.org/plc4x/latest/users/protocols/ab-eth.html Example connection string using the default tcp transport and port. ```text ab-eth://192.168.24.40 ``` -------------------------------- ### Install OpenJDK via Homebrew Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/macos.html Installs OpenJDK using Homebrew. This is the recommended way to install Java on macOS. ```bash brew install openjdk ``` -------------------------------- ### Example go.mod file after initialization Source: https://plc4x.apache.org/plc4x/latest/users/getting-started/plc4go.html Shows the expected content of the go.mod file created by the previous command. ```go module main go 1.16 ``` -------------------------------- ### Run the PLC4X-IoTDB Java example with command-line arguments Source: https://plc4x.apache.org/plc4x/latest/users/integrations/apache-iotdb.html Command to run the example JAR, specifying the connection string, field address, polling interval, IoTDB connection details, storage group, device, data type, and JDBC usage flag. The example collects random integer data from a simulated PLC every second and writes it to IoTDB at 127.0.0.1:6667. ```bash java -jar …​.. --connection-string simulated://127.0.0.1 --field-address RANDOM/foo:Integer --polling-interval 1000 --iotdb-address 127.0.0.1:6667 --iotdb-user-name root --iotdb-user-password root --iotdb-sg mi --iotdb-device d1 --iotdb-datatype INT32 --use-jdbc false ``` -------------------------------- ### Install required packages for site generation Source: https://plc4x.apache.org/plc4x/latest/developers/infrastructure/vm.html Install python-seqdiag and python-nwdiag to build charts and graphics as part of the site generation. ```bash sudo apt-get install python-seqdiag sudo apt-get install python-nwdiag ``` -------------------------------- ### Install Homebrew Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/macos.html Installs Homebrew, the package manager used to install most libraries on macOS. Run this command in the terminal. ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -------------------------------- ### Start PLC4X server with explicit credentials and custom TLS keystore Source: https://plc4x.apache.org/plc4x/latest/users/tools/plc4x-server.html Use this command to start the PLC4X server with a specific port, username, password, and a custom TLS keystore. The keystore must be a PKCS12 (or JKS) file containing the server's private key and certificate. ```bash java \ -Dplc4x.server.port=59837 \ -Dplc4x.server.username=operator \ -Dplc4x.server.password='s3cr3t!' \ -Dplc4x.server.keystore=/etc/plc4x/server.p12 \ -Dplc4x.server.keystore-password='keystorepass' \ -jar target/plc4j-plc4x-server-.jar ``` -------------------------------- ### Install Git on yum-based systems Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Use this command to install Git on Red Hat/CentOS-based systems. ```bash sudo yum install git ``` -------------------------------- ### Start Kafka Broker Source: https://plc4x.apache.org/plc4x/latest/users/integrations/apache-kafka.html Command to start the Kafka broker server. Run after Zookeeper is running. ```bash bin/kafka-server-start.sh config/server.properties ``` -------------------------------- ### Install PLC4Py from GitHub with pip install Source: https://plc4x.apache.org/plc4x/latest/users/getting-started/plc4py.html Run this command from the plc4py directory to install PLC4Py into your global Python repository. This is required because PLC4Py is not yet published to PyPI. ```bash pip install . ``` -------------------------------- ### EtherNet/IP connection string example Source: https://plc4x.apache.org/plc4x/latest/users/protocols/eip.html Example connection string using the default port 44818, which is omitted. ```text eip://192.168.24.32 ``` -------------------------------- ### Example OPC UA server configuration file (config.yml) Source: https://plc4x.apache.org/plc4x/latest/users/tools/opcua-server.html Example configuration file showing root settings, device definitions, and tag mappings. The version must match the expected version, and the dir points to the security directory. The disableInsecureEndpoint setting disables the insecure endpoint. ```yaml --- version: "0.8" dir: {path-to-security-dir} name: "Plc4xOPCUAServer" disableInsecureEndpoint: true devices: - name: "ModbusDevice" connectionString: "modbus-tcp://127.0.0.1:502" tags: - alias: "TemporaryBOOLARRAY" address: "000001:BOOL[10]" - alias: "TemporaryWORD2" address: "400002:WORD" - alias: "TemporaryUINT3" address: "400003:UINT" - alias: "TemporaryINT4" address: "400004:INT" - alias: "TemporaryDINT5" address: "400005:DINT[4]" - alias: "TemporaryREAL6" address: "400006:REAL" - alias: "TemporaryREAL7" address: "400007:REAL" - alias: "TemporaryREAL8" address: "400008:REAL" - name: "SimulationDevice" connectionString: "simulated://127.0.0.1" tags: - alias: "Temporary" address: "RANDOM/Temporary:Integer" tcpPort: 12687 httpPort: 8445 ``` -------------------------------- ### OPC UA Connection String Example Source: https://plc4x.apache.org/plc4x/latest/users/protocols/opcua.html An example connection string using TCP transport, discovery enabled, and username/password authentication. ```text opcua:tcp://127.0.0.1:12686?discovery=true&username=admin&password=password ``` -------------------------------- ### Run PLC4X Browser in demo mode Source: https://plc4x.apache.org/plc4x/latest/users/tools/plc4x-browser.html Starts the browser against simulated devices so it can be tried without hardware. Run from the plc4go directory. ```bash cd plc4go go run ./tools/plc4xbrowser --demo ``` -------------------------------- ### Example Logix Connection String Source: https://plc4x.apache.org/plc4x/latest/users/protocols/logix.html An example connection string using the Logix driver with a specific IP, port, and communication path option. ```text logix:tcp://127.0.0.1:44818?communication-path=[1,1] ``` -------------------------------- ### Start Kafka Console Consumer Source: https://plc4x.apache.org/plc4x/latest/users/integrations/apache-kafka.html Starts a console consumer that reads messages from the 'test' topic from the beginning. ```bash bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning ``` -------------------------------- ### Example TLS Connection String Source: https://plc4x.apache.org/plc4x/latest/users/protocols/plc4x.html Example connection string using TLS (default) with the remote-connection-string set to 's7' and tls.verify=false. ```text plc4x:tls://host:59837?remote-connection-string=s7&username=op&password=hunter2&tls.verify=false ``` -------------------------------- ### Check dotnet version Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/windows.html Run this command to check if dotnet is installed. Usually already installed on Windows. ```bash dotnet --version ``` -------------------------------- ### Initialize Go module with go mod init main Source: https://plc4x.apache.org/plc4x/latest/users/getting-started/plc4go.html Creates a go.mod file, similar to Maven's pom.xml. Run in a new directory after installing Go. ```bash go mod init main ``` -------------------------------- ### Install pyenv via Homebrew Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/macos.html Installs pyenv, a Python version manager, using Homebrew. This is the first step to install Python for PLC4Py. ```bash brew install pyenv ``` -------------------------------- ### Example UMAS connection string Source: https://plc4x.apache.org/plc4x/latest/users/protocols/umas.html An example connection string using TCP transport to 127.0.0.1 on port 502. ```text umas:tcp://127.0.0.1:502 ``` -------------------------------- ### Install python3 on apt-based systems Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Use this command to install Python 3 on Debian/Ubuntu-based systems. ```bash sudo apt install python3 ``` -------------------------------- ### Install libpcap on apt-based systems Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Use this command to install libpcap development files on Debian/Ubuntu-based systems. ```bash sudo apt install libpcap-dev ``` -------------------------------- ### Run PCAP Analyzer UI with demo capture Source: https://plc4x.apache.org/plc4x/latest/users/tools/pcap-analyzer.html Starts the interactive terminal interface with a demo capture. Requires cgo and libpcap; building with CGO_ENABLED=0 fails. ```bash cd plc4go go run ./tools/plc4xpcapanalyzer ui --demo ``` -------------------------------- ### Example connection strings for Generic CAN Source: https://plc4x.apache.org/plc4x/latest/users/protocols/genericcan.html Concrete examples of connection strings for the socketcan and virtualcan transports, using 'can0' and 'test' as the interface and bus name respectively. ```none genericcan:can-socketcan://can0 genericcan:can-virtualcan://test ``` -------------------------------- ### Install Git via Chocolatey Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/windows.html Use this command to install Git if the version check fails. ```bash choco install git ``` -------------------------------- ### Check Git version Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/windows.html Run this command to check if Git is installed. If it returns a successful output, Git is installed; otherwise, install it via Chocolatey. ```bash git --version ``` -------------------------------- ### COTP connection examples Source: https://plc4x.apache.org/plc4x/latest/users/transports/cotp.html Example connection strings for S7 and COTP with TPDU size configuration. The first uses the default port, the second specifies port 102 and a TPDU size of 1024. ```none s7://10.0.0.1 s7:cotp://10.0.0.1:102?cotp.tpdu-size=1024 ``` -------------------------------- ### Run the PLC4X server Source: https://plc4x.apache.org/plc4x/latest/users/tools/plc4x-server.html Starts the server. The listen port may be given as the first argument, or via the plc4x.server.port system property / PLC4X_SERVER_PORT environment variable. If omitted it defaults to 59837. ```bash java -jar target/plc4j-plc4x-server-.jar [port] ``` -------------------------------- ### Example Plaintext TCP Connection String Source: https://plc4x.apache.org/plc4x/latest/users/protocols/plc4x.html Example connection string using plaintext TCP (no transport specified, defaults to tls? Actually the example uses plc4x:// which defaults to tls, but the text says plaintext TCP. The example shows a URL-encoded remote-connection-string. ```text plc4x://host?remote-connection-string=s7%3A%2F%2Foperator%3Ahunter2%40plc%3A102 ``` -------------------------------- ### Start Kafka Connect Source Worker (Standalone) Source: https://plc4x.apache.org/plc4x/latest/users/integrations/apache-kafka.html Starts a standalone Kafka Connect worker with the PLC4X source connector configuration. Ideal for testing. The command uses the provided properties files. ```bash bin/connect-standalone.sh config/connect-standalone.properties config/plc4x-source.properties ``` -------------------------------- ### PCAP Replay connection string example Source: https://plc4x.apache.org/plc4x/latest/users/transports/pcap-replay.html Example connection string for the PCAP Replay transport. The address segment is not interpreted; the capture is named by the `pcap-replay.pcap-file` parameter. The example sets the file path and speed factor. ```none profinet:pcap-replay://?pcap-replay.pcap-file=/tmp/line-3.pcapng&pcap-replay.speed-factor=1.0 ``` -------------------------------- ### Run the OPC UA server with interactive mode Source: https://plc4x.apache.org/plc4x/latest/users/tools/opcua-server.html Starts the server with the -i switch, prompting for usernames and passwords. For normal operation, omit -i. ```bash java -jar plc4x-opcua-server-1.0.0-uber-jar.jar -c {path-to-config-file} -i ``` -------------------------------- ### Install gcc on yum-based systems Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Use this command to install gcc on Red Hat/CentOS-based systems. ```bash sudo yum install gcc ``` -------------------------------- ### SocketCAN connection string examples Source: https://plc4x.apache.org/plc4x/latest/users/transports/socketcan.html Example connection strings for SocketCAN, using the interface name in the address segment and an optional read-timeout parameter. ```none canopen:can-socketcan://can0 canopen:can-socketcan://vcan0?can-socketcan.read-timeout-ms=500 ``` -------------------------------- ### Raw Socket connection string example Source: https://plc4x.apache.org/plc4x/latest/users/transports/raw-socket.html Example connection string for the raw-socket transport. The address segment is not interpreted; all configuration is passed via query parameters. Requires raw-socket.remote-address and raw-socket.protocol-id. ```none profinet://?raw-socket.interface-name=en0&raw-socket.remote-address=00:0e:cf:12:34:56&raw-socket.protocol-id=34962 ``` -------------------------------- ### C-Bus connection string example Source: https://plc4x.apache.org/plc4x/latest/users/protocols/c-bus.html Example connection string connecting to a PCI at IP 192.168.42.11 on the default port 10001. ```text c-bus:tcp://192.168.42.11 ``` -------------------------------- ### Install MinGW via Chocolatey Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/windows.html Use this command from an Administrative console to install MinGW if gcc is not found. ```bash choco install mingw ``` -------------------------------- ### Install python3-venv on apt-based systems Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Use this command to install the Python venv package on Debian/Ubuntu-based systems. ```bash sudo apt install python3-venv ``` -------------------------------- ### BACnet/IP connection string example Source: https://plc4x.apache.org/plc4x/latest/users/protocols/bacnet.html Example connection string using the udp transport with a specific IP address and port. ```text bacnet-ip:udp://192.168.178.101:47808 ``` -------------------------------- ### Start PLC4X server in plaintext mode (trusted network / local testing only) Source: https://plc4x.apache.org/plc4x/latest/users/tools/plc4x-server.html Use this command to start the PLC4X server with plaintext mode enabled, which disables TLS. This is intended for trusted networks or local testing only. ```bash java -Dplc4x.server.plaintext=true \ -Dplc4x.server.username=operator \ -Dplc4x.server.password='s3cr3t!' \ -jar target/plc4j-plc4x-server-.jar ``` -------------------------------- ### SLMP Example Connection String Source: https://plc4x.apache.org/plc4x/latest/users/protocols/slmp.html An example connection string using TCP transport to connect to a PLC at IP 192.168.0.10 on port 5007. ```text slmp:tcp://192.168.0.10:5007 ``` -------------------------------- ### Example connection strings for Virtual CAN Source: https://plc4x.apache.org/plc4x/latest/users/transports/can-virtualcan.html Example connection strings using the Virtual CAN transport. Both ends must use the same bus name to communicate. ```none canopen:can-virtualcan://test-bus genericcan:can-virtualcan://test-bus ``` -------------------------------- ### Install libpcap on yum-based systems Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Use this command to install libpcap development files on Red Hat/CentOS-based systems. ```bash sudo yum install libpcap-devel ``` -------------------------------- ### Add PLC4Go dependency with go get Source: https://plc4x.apache.org/plc4x/latest/users/getting-started/plc4go.html Downloads the latest PLC4Go module. All supported drivers are included in this bundle. ```bash go get github.com/apache/plc4x/plc4go ``` -------------------------------- ### GUID address examples Source: https://plc4x.apache.org/plc4x/latest/users/protocols/opcua.html Examples of OPC UA addresses using GUID identifiers. The first address omits the optional data type and attribute ID, the second adds a data type, and the third adds both an explicit attribute ID and data type. ```text ns=2;g=09087e75-8e5e-499b-954f-f2a8624db28a ns=2;g=09087e75-8e5e-499b-954f-f2a8624db28a;REAL ns=2;g=09087e75-8e5e-499b-954f-f2a8624db28a;a=Value;REAL ``` -------------------------------- ### Start Kafka Connect Source Worker (Distributed Mode) Source: https://plc4x.apache.org/plc4x/latest/users/integrations/apache-kafka.html Starts a distributed Kafka Connect worker using the provided configuration file. This is ideal for production. ```bash bin /connect-distributed.sh config/connect-distributed.properties ``` -------------------------------- ### Build the PLC4X website with Maven Source: https://plc4x.apache.org/plc4x/latest/developers/building.html Run this command in the PLC4X repository root to generate the website. This is a quick-start version; see the full website documentation for details. ```bash mvn site ``` -------------------------------- ### Get default PlcDriverManager Source: https://plc4x.apache.org/plc4x/latest/users/driver-metadata.html Obtains the default PlcDriverManager instance using the static getDefault() method. This is the starting point for discovering drivers and their configuration metadata. ```java import org.apache.plc4x.java.api.PlcDriverManager; PlcDriverManager driverManager = PlcDriverManager.getDefault(); ``` -------------------------------- ### Serial connection string examples Source: https://plc4x.apache.org/plc4x/latest/users/tools/plc4x-browser.html Shows connection strings for serial protocols where the port is named in the path instead of a host. ```text modbus-rtu:///dev/ttyUSB0 firmata:///dev/ttyACM0 ``` -------------------------------- ### Force update of all tags with updateAllTheTags() Source: https://plc4x.apache.org/plc4x/latest/users/tools/opm.html Define a method that does not start with 'get' or 'is' to force the OPM system to update all properties in the current entity when called. Respects the cache time, so only outdated values are refreshed. ```java public void updateAllTheTags() { // Dummy ... } ``` -------------------------------- ### Start Kafka Connect Sink Worker (Standalone) Source: https://plc4x.apache.org/plc4x/latest/users/integrations/apache-kafka.html Command to start a standalone Kafka Connect worker with the sink connector properties. Ideal for testing. ```bash bin/connect-standalone.sh config/connect-standalone.properties config/plc4x-sink.properties ``` -------------------------------- ### Minimal PLC4Py asynchronous read example Source: https://plc4x.apache.org/plc4x/latest/users/getting-started/plc4py.html Connects to a Modbus PLC using a connection string, builds a read request for a tag named 'Random Tag' with address '4x00001[10]', executes it asynchronously, and prints the response code. Requires the plc4py package installed and an accessible PLC at the given address. ```python import asyncio from plc4py.PlcDriverManager import PlcDriverManager connection_string = "modbus://127.0.0.1:5020" driver_manager = PlcDriverManager() async def communicate_with_plc(): """ Asynchronously communicates with a PLC using a PlcDriverManager. This function establishes a connection to the PLC defined by the connection_string. It builds a read request for a specific item ("Random Tag" in this case) using the connection's read request builder. The request is then executed asynchronously, and the response code is printed. """ print(f"Connecting to plc: {connection_string}") async with driver_manager.connection(connection_string) as connection: print(f"Connected to {connection_string}") with connection.read_request_builder() as builder: print(f"Building read request") builder.add_item("Random Tag", "4x00001[10]") request = builder.build() print(f"Request built") print(f"Executing request") response = await connection.execute(request) print(f"Request executed") print(f"Response code: {response.response_code}") asyncio.run(communicate_with_plc()) ``` -------------------------------- ### Build the server with Maven Source: https://plc4x.apache.org/plc4x/latest/users/tools/plc4x-server.html Run from the module directory to produce a runnable fat-jar at target/plc4j-plc4x-server-.jar. ```bash mvn package ``` -------------------------------- ### Check python3 version Source: https://plc4x.apache.org/plc4x/latest/developers/preparing/linux.html Run this command to verify Python 3 is installed. A version of 3.7 or higher is sufficient. ```bash python3 --version ``` -------------------------------- ### Event subscription address example Source: https://plc4x.apache.org/plc4x/latest/users/protocols/opcua.html Example of an OPC UA address for event subscription. The attribute ID is required for event subscriptions, and tag config is appended after a pipe as a comma-separated key=value list naming the event fields to request. The values are placeholders and are ignored, but they must be non-empty and alphanumeric, and a ;{Data Type} segment must precede the pipe, otherwise the config is silently dropped. ```text ns=0;i=2253;a=EventNotifier;BOOL|EventId=x,EventType=x,Severity=x,Time=x,Message=x ``` -------------------------------- ### S7 Connection String Example Source: https://plc4x.apache.org/plc4x/latest/users/protocols/s7.html Example connection string for a Siemens S7-400 PLC at IP 10.10.1.33 with rack 0, slot 3, and controller type S7_400. ```text s7://10.10.1.33?cotp.remote-rack=0&cotp.remote-slot=3&controller-type=S7_400 ``` -------------------------------- ### TLS-PSK connection URL example Source: https://plc4x.apache.org/plc4x/latest/users/transports/tls-psk.html Example connection URL for a Modbus TCP device using TLS-PSK with identity 'line-3' and a hex-encoded key. ```none modbus-tcp:tls-psk://192.168.1.100:802?tls-psk.psk-identity=line-3&tls-psk.psk-key=00112233445566778899aabbccddeeff ``` -------------------------------- ### Build and start an Event-Pump TagBatch in Java Source: https://plc4x.apache.org/plc4x/latest/users/tools/event-pump.html Creates a TagBatch with a connection factory, OPC UA connection string, two tag addresses, a TimerTrigger firing every 5 seconds, and a listener that prints values. The batch is added to an EventPump and started. EventPump implements AutoCloseable, so closing it stops all batches. ```java PlcConnectionFactory connectionFactory = PlcDriverManager.getDefault().getConnectionFactory(); TagBatch batch = TagBatch.builder() .withBatchId("boiler") .withConnectionFactory(connectionFactory) .withConnectionString("opcua:tcp://192.168.1.1:4840?request-timeout-ms=10000") .addTagAddress("temperature", "ns=2;i=1001") .addTagAddress("pressure", "ns=2;i=1002") .withTrigger(new TimerTrigger(5, TimeUnit.SECONDS)) .withListener((b, response) -> { System.out.println("Temperature: " + response.getInt("temperature")); System.out.println("Pressure: " + response.getInt("pressure")); }) .build(); EventPump pump = new EventPump(); pump.addBatch(batch); pump.startAll(); // ... later pump.close(); ``` -------------------------------- ### Connection String Source: https://plc4x.apache.org/plc4x/latest/users/protocols/ads.html The ADS connection string format and an example with required options. ```APIDOC ## Connection String ### Format `ads:tcp://{ip-address}[:{port}]?{options}` ### Description The ADS connection string uses the `tcp` transport. The port defaults to the ADS TCP port and normally does not need to be given. Required options are `target-ams-net-id`, `target-ams-port`, `source-ams-net-id`, and `source-ams-port`. ### Example `ads:tcp://192.168.23.20:48898?target-ams-port=851&source-ams-port=65534&source-ams-net-id=192.168.23.220.1.1&target-ams-net-id=192.168.23.20.1.1` ### Parameters #### Query Parameters - **target-ams-net-id** (string) - Required - The AMS Net ID of the target device. - **target-ams-port** (integer) - Required - The AMS port of the target device. - **source-ams-net-id** (string) - Required - The AMS Net ID of the source device. - **source-ams-port** (integer) - Required - The AMS port of the source device. ``` -------------------------------- ### List options and required options from OptionMetadata Source: https://plc4x.apache.org/plc4x/latest/users/driver-metadata.html Shows how to get the list of all options and the convenience filter for required options from an OptionMetadata instance. ```java import org.apache.plc4x.java.api.metadata.Option; List