Files
pnoker dc2164f46e fix(driver): repair boot, scheduling and registration regressions
a live-stack sweep of all 36 drivers surfaced five sdk-level defects
that left reads dead or the whole fleet unbootable:

- drop the empty spring.main stub in the shared driver profile; the
  boot 4.1 binder rejects null-valued keys and every driver died at
  startup with a bind exception
- rename the schedule enable flag to enable to match what every driver
  application.yml actually spells; with the old enabled key the read
  and custom quartz jobs were silently never scheduled
- treat proto3 zero-versions as unset when reconciling registration
  so a driver restart re-registers instead of failing the optimistic
  lock with 'driver version conflict'
- ignore the driver's own registration event that can be consumed
  before applymetadata finishes instead of logging an error
- initialize jdbc/serial connection maps eagerly: the registration
  event handler invalidates pools and nped on a lazy-null map
- ble: exclude the guava 18 pin dragged in by bluetooth-manager
- kafka: use the starter (boot 4 split autoconfigurations out of the
  bare jar) and read the compose-provided bootstrap variable
- lwm2m: pin californium to the 3.x api leshan m14 needs and
  configure an explicit coap endpoint
- mqtt: replace the orphaned spring-integration gateway with a paho
  publisher so the send path exists again
- boot sweep result: 36/36 drivers start, 0 errors
2026-09-18 09:48:19 +08:00
..

DC3 Driver Serial

Overview

dc3-driver-serial is the generic serial port driver of the IoT DC3 platform. It communicates with RS232/RS485/RS422 devices over a serial port using the jSerialComm library, caching one serial connection per device. For each point it sends a configured HEX command, reads back the raw response, and parses it according to frame header/footer, checksum, data offset/length, data format (HEX/ASCII/BINARY/FLOAT), and byte order. Write commands send a HEX command template with the ${value} placeholder substituted.

Module Information

  • Group ID: io.github.pnoker
  • Artifact ID: dc3-driver-serial
  • Driver Name: Serial Port Driver

Driver Attributes (Device-level)

Attribute Code Type Default Description
Serial Port port STRING /dev/ttyUSB0 Serial port device path
Baud Rate baudRate INT 9600 Baud rate (1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200)
Data Bits dataBits INT 8 Data bits (5, 6, 7, 8)
Stop Bits stopBits INT 1 Stop bits (1, 2)
Parity parity INT 0 Parity (0=None, 1=Odd, 2=Even)
Timeout timeout INT 1000 Read timeout in milliseconds

Point Attributes

Attribute Code Type Default Description
Send Command sendCommand STRING HEX command to send (e.g. 01 03 00 00 00 0A C5 CD)
Receive Length receiveLength INT 0 Expected response length in bytes (0=auto detect)
Frame Header frameHeader STRING Frame header in HEX (e.g. 01 03)
Frame Footer frameFooter STRING Frame footer in HEX (e.g. 0D 0A)
Data Offset dataOffset INT 0 Data region offset from frame start
Data Length dataLength INT 0 Data region length in bytes (0=until frame footer)
Checksum Type checksumType STRING NONE Checksum type: NONE, CRC16, XOR
Data Format dataFormat STRING HEX Data format: HEX, ASCII, BINARY, FLOAT
Byte Order byteOrder STRING BIG Byte order: BIG, LITTLE

Command Attributes (write)

Attribute Code Type Default Description
Send Command sendCommand STRING ${value} HEX command template with ${value} placeholder
Byte Order byteOrder STRING BIG Byte order for encoding value: BIG, LITTLE

The module application.yml is authoritative for attribute codes, types, default values, scheduling, health, and local buffering. Keep this README aligned when those user-facing settings change.

Prerequisites

A serial device connected to a serial port reachable from the host running the driver (e.g. /dev/ttyUSB0). The port path and line parameters (baud rate, data/stop bits, parity, timeout) are supplied through the driver attributes above.

Running Locally

1. Start Infrastructure and Center Services

make up-db
make up-dev GROUP=core

2. Build and Run

mvn -s .mvn/settings.xml -pl dc3-driver/dc3-driver-serial -am package
java -jar dc3-driver/dc3-driver-serial/target/dc3-driver-serial.jar

Testing

Run the module tests from the repository root:

mvn -s .mvn/settings.xml -pl dc3-driver/dc3-driver-serial -am test
  • dc3-common-driver — Driver SDK for registration, scheduling, and RabbitMQ integration