Java SDK

Blocking gRPC Java client.

Dependencies

dependencies {
    implementation 'io.grpc:grpc-netty-shaded:1.82.0'
    implementation 'io.grpc:grpc-protobuf:1.82.0'
    implementation 'com.google.protobuf:protobuf-java:4.35.1'
    implementation 'com.google.protobuf:protobuf-java-util:4.35.1'
}

Quickstart

import com.tijet.grpc.TinCore;

try (TinCore client = new TinCore()) {
    client.connect(null);  // default UDS
    client.setParameter("print_speed", "100");
    String speed = client.getParameter("print_speed");
    System.out.println("print_speed = " + speed);
    byte[] data = { 0x1B, 0x40 };
    String checksum = client.setPrintData(data, 0, false);
    System.out.println("SHA-256: " + checksum);
}

Exception Hierarchy

$$TiJetError (RuntimeException, int code) ├── InvalidArgumentError ├── NotConnectedError ├── TimeoutError ├── ServerError └── InternalError$$

Note: For the complete Java API reference including event callbacks and build instructions, see the Chinese documentation.