8#include "dawn/common/thread.hxx"
9#include "dawn/porting/config.hxx"
10#include "dawn/proto/common.hxx"
11#include "dawn/proto/modbus/regs.hxx"
12#include <nxmodbus/nxmodbus.h>
31 PROTO_MODBUS_CFG_FIRST = 0,
35 PROTO_MODBUS_CFG_LAST = 31
42 , saddr(CONFIG_DAWN_PROTO_MODBUS_RTU_ADDR)
43 , parity(CONFIG_DAWN_PROTO_MODBUS_RTU_PARITY)
44 , baud(CONFIG_DAWN_PROTO_MODBUS_RTU_BAUD)
45 , path(CONFIG_DAWN_PROTO_MODBUS_RTU_PATH)
49 ~CProtoModbusRtu()
override;
51#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
52 const char *getClassNameStr()
const override
93 nxmb_handle_t mbhandle;
94 struct nxmb_callbacks_s callbacks;
100 int configureDesc(
const CDescObject &desc);
101 void allocObject(SProtoModbusIOBind *alloc);
103 int modbusInitialize();
107 return this->
getIO(
id);
CIOCommon * getIO(SObjectId::ObjectId id)
Get an I/O object by ID.
Descriptor wrapper for individual object configuration.
Base class for all protocol implementations.
@ PROTO_CLASS_MODBUS_RTU
Modbus RTU (serial implementation).
Modbus register management base class (shared RTU/TCP logic).
Modbus RTU (Remote Terminal Unit) protocol implementation.
int configure()
Configure object from descriptor data.
int init()
One-time initialize object after bindings are resolved.
int doStop()
Stop implementation hook.
int doStart()
Start implementation hook.
int deinit()
De-initialize object.
bool hasThread() const
Check if a background thread is active.
@ PROTO_MODBUS_CFG_IOBIND
I/O object binding (register map).
@ PROTO_MODBUS_CFG_PATH
Serial device path.
@ PROTO_MODBUS_CFG_BAUD
Serial baud rate.
Portable thread owner abstraction for Dawn components.
static ObjectCfgId objectCfg(uint8_t type, uint16_t cls, uint8_t dtype, bool rw, uint16_t size, uint8_t id)
Construct 32-bit ConfigID from component fields.
uint32_t ObjectCfgId
ConfigID type - single 32-bit value.
Out-of-tree user-extension hooks for Dawn.
@ OBJTYPE_PROTO
Protocol object type.
@ DTYPE_ANY
Wildcard data type (matches any actual type).
@ DTYPE_CHAR
Character/string type (null-terminated, 4-byte aligned).
@ DTYPE_UINT32
Unsigned 32-bit integer (0 to 4294967295).
uint32_t ObjectId
ObjectID type - single 32-bit value.
static ObjectId objectId(uint8_t type, uint16_t cls, uint8_t dtype, uint8_t flags, uint16_t priv)
Construct 32-bit ObjectID from component fields.