com.digitalpetri.enip:enip-codec

Asynchronous, non-blocking, EtherNet/IP client implementation for Java

License

License

GroupId

GroupId

com.digitalpetri.enip
ArtifactId

ArtifactId

enip-codec
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

Asynchronous, non-blocking, EtherNet/IP client implementation for Java

Download enip-codec

How to add to project

<!-- https://jarcasting.com/artifacts/com.digitalpetri.enip/enip-codec/ -->
<dependency>
    <groupId>com.digitalpetri.enip</groupId>
    <artifactId>enip-codec</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.digitalpetri.enip/enip-codec/
implementation 'com.digitalpetri.enip:enip-codec:1.1.2'
// https://jarcasting.com/artifacts/com.digitalpetri.enip/enip-codec/
implementation ("com.digitalpetri.enip:enip-codec:1.1.2")
'com.digitalpetri.enip:enip-codec:jar:1.1.2'
<dependency org="com.digitalpetri.enip" name="enip-codec" rev="1.1.2">
  <artifact name="enip-codec" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.digitalpetri.enip', module='enip-codec', version='1.1.2')
)
libraryDependencies += "com.digitalpetri.enip" % "enip-codec" % "1.1.2"
[com.digitalpetri.enip/enip-codec "1.1.2"]

Dependencies

compile (3)

Group / Artifact Type Version
io.netty : netty-codec jar 4.0.36.Final
org.slf4j : slf4j-api jar 1.7.7
com.google.code.findbugs : jsr305 jar 3.0.0

test (1)

Group / Artifact Type Version
org.testng : testng jar 6.8.8

Project Modules

There are no modules declared in this project.

EtherNet/IP Client

Build status Maven Central

Asynchronous, non-blocking, EtherNet/IP client implementation for Java

Maven

EtherNet/IP Client

<dependency>
    <groupId>com.digitalpetri.enip</groupId>
    <artifactId>enip-client</artifactId>
    <version>1.3.4</version>
</dependency>

CIP Client

<dependency>
    <groupId>com.digitalpetri.enip</groupId>
    <artifactId>cip-client</artifactId>
    <version>1.3.4</version>
</dependency>

Quick Start

EtherNet/IP Example

EtherNetIpClientConfig config = EtherNetIpClientConfig.builder("10.20.4.57")
        .setSerialNumber(0x00)
        .setVendorId(0x00)
        .setTimeout(Duration.ofSeconds(2))
        .build();

EtherNetIpClient client = new EtherNetIpClient(config);

client.connect().get();

client.listIdentity().whenComplete((li, ex) -> {
    if (li != null) {
        li.getIdentity().ifPresent(id -> {
            System.out.println("productName=" + id.getProductName());
            System.out.println("revisionMajor=" + id.getRevisionMajor());
            System.out.println("revisionMinor=" + id.getRevisionMinor());
        });
    } else {
        ex.printStackTrace();
    }
});

client.disconnect().get();

// Call this before application / JVM shutdown
EtherNetIpShared.releaseSharedResources();

CIP Service Example

EtherNetIpClientConfig config = EtherNetIpClientConfig.builder("10.20.4.57")
        .setSerialNumber(0x00)
        .setVendorId(0x00)
        .setTimeout(Duration.ofSeconds(2))
        .build();

// backplane, slot 0
PaddedEPath connectionPath = new PaddedEPath(
        new PortSegment(1, new byte[]{(byte) 0}));

CipClient client = new CipClient(config, connectionPath);

client.connect().get();

GetAttributeListService service = new GetAttributeListService(
        new PaddedEPath(new ClassId(0x01), new InstanceId(0x01)),
        new int[]{4},
        new int[]{2}
);

client.invokeUnconnected(service).whenComplete((as, ex) -> {
    if (as != null) {
        try {
            ByteBuf data = as[0].getData();
            int major = data.readUnsignedByte();
            int minor = data.readUnsignedByte();

            System.out.println(String.format("firmware v%s.%s", major, minor));
        } catch (Throwable t) {
            t.printStackTrace();
        } finally {
            Arrays.stream(as).forEach(a -> ReferenceCountUtil.release(a.getData()));
        }
    } else {
        ex.printStackTrace();
    }
});

client.disconnect().get();

// Call this before application / JVM shutdown
EtherNetIpShared.releaseSharedResources();

Logix Example

See the logix-services README!

License

Apache License, Version 2.0

com.digitalpetri.enip

digitalpetri

Versions

Version
1.1.2
1.1.1
1.1.0
1.0.3
1.0.2
1.0.1