LLRP protocol and networking implementation for Java.
LLRP4J implements encoders and decoders for the binary and (proprietary) XML serializations of the Low Level Reader Protocol (LLRP).
LLRP4J consists of the following modules:
llrp4j-core: Encoders and decoders for the binary and XML serializations.
llrp4j-generator: Java source code generator for annotated POJOs based on XML definition files.
llrp4j-llrp-module: The LLRP module that provides Java classes for messages and parameters as defined by the LLRP 1.1 standard.
llrp4j-impinj-module: A placeholder for a custom Impinj module whose definition (impinjdef.xml) must be directly obtained from Impinj due to licensing restrictions.
llrp4j-net: LLRP client and server implementations using Java NIO.
final LlrpContext ctx = LlrpContext.create(new LlrpModule());
LlrpEndpoint endpoint = new LlrpEndpoint() {
@Override
public void messageReceived(LlrpMessage message) {
StringWriter writer = new StringWriter();
try {
XMLStreamWriter xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer);
ctx.createXmlEncoder(true).encodeMessage(message, xmlWriter);
String xml = writer.toString();
System.out.println("RECEIVED:\n" + xml);
} catch (Exception e) {
// handle exception
}
}
@Override
public void errorOccured(String message, Throwable cause) {
}
};
LlrpServer server = LlrpServer.create(ctx, "127.0.0.1").endpoint(endpoint);
LlrpClient client = LlrpClient.create(ctx, "127.0.0.1").endpoint(endpoint);
client.transact(new SET_READER_CONFIG().resetToFactoryDefault(true));
client.close();
server.close();
LLRP4J can be build with Maven. You can simply use mvn -P generator package
to compile and package all modules or mvn -P generator install
to install them within your local Maven repository.
A popular implementation of LLRP in Java is the LLRP Toolkit (LTK) for Java. Its development has been stalled since 2012 and hence we decided to create a new LLRP library for Java with the following benefits:
Pluggable serializers: LLRP4J does not generate the serialization logic into the message and parameter classes but uses annotations to declare the respective LLRP data types and encoding rules. This enables serializers to leverage runtime reflection for encoding or decoding message and parameter objects.
Dynamic modules: LLRP4J can be extended with modules at runtime to add custom messages or parameters. LTK for Java had to know custom messages or parameters at the generation time of the Java source code for messages and parameters.
Minimal runtime dependencies: LLRP4J has no additional runtime dependencies other than SLF4J.
Better code generator: LLRP4J uses JCodeModel for source code generation that is simpler and better extendable in comparison to the template based approach of LTK for Java.
The networking module is based on the Rox Java NIO Tutorial and the bit buffer implementation is a fork of https://github.com/magik6k/BitBuffer.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。