Dawn Framework 1.0
Universal data acquisition framework for embedded systems
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dawn::CProtoNxscopeUdp Class Reference

NXScope over UDP transport. More...

#include <udp.hxx>

Inheritance diagram for dawn::CProtoNxscopeUdp:
[legend]
Collaboration diagram for dawn::CProtoNxscopeUdp:
[legend]

Public Types

enum  { }
 
enum  { CMD_RESET = 0 , CMD_TRIGGER1 = 1 , CMD_TRIGGER2 = 2 , CMD_TRIGGER3 = 3 }
 Control command identifiers for control() More...
 
enum  
 Default descriptor validation failure codes. More...
 
enum  
 Common configuration IDs.
 
enum  EObjectState { STATE_STOPPED = 0 , STATE_RUNNING = 1 }
 Object operational state returned by getState() More...
 
enum  EProtoClass {
  PROTO_CLASS_ANY = 0 , PROTO_CLASS_NIMBLE_PRPH = 1 , PROTO_CLASS_NXSCOPE_DUMMY = 10 , PROTO_CLASS_DUMMY = 12 ,
  PROTO_CLASS_NXSCOPE_SERIAL = 11 , PROTO_CLASS_NXSCOPE_UDP = 13 , PROTO_CLASS_SHELL_STD = 15 , PROTO_CLASS_SHELL_SERIAL = 16 ,
  PROTO_CLASS_SERIAL = 17 , PROTO_CLASS_MODBUS_RTU = 18 , PROTO_CLASS_MODBUS_TCP = 19 , PROTO_CLASS_CAN = 20 ,
  PROTO_CLASS_UDP = 22 , PROTO_CLASS_IPC = 23 , PROTO_CLASS_USER_START = 510 , PROTO_CLASS_USER = 511 ,
  PROTO_CLASS_LAST
}
 Protocol object class types. More...
 

Public Member Functions

int configure ()
 Configure object from descriptor data.
 
int deinit ()
 De-initialize object.
 
int doStart ()
 Start implementation hook.
 
int doStop ()
 Stop implementation hook.
 
bool getCfgFlag () const
 Check if configuration flag is set.
 
uint16_t getCls () const
 Get object class field.
 
CDescObjectgetDesc ()
 Get descriptor object for this object.
 
uint8_t getDtype () const
 Get data type field.
 
size_t getDtypeSize () const
 Get size of this object's data type.
 
uint8_t getFlags () const
 Get type-specific flags field.
 
SObjectId::UObjectId getId () const
 Get object identifier as union structure.
 
SObjectId::ObjectId getIdV () const
 Get object identifier as raw 32-bit value.
 
CIOCommongetIO (SObjectId::ObjectId id)
 Get an I/O object by ID.
 
const std::map< SObjectId::ObjectId, CIOCommon * > & getIOMap () const
 Get the I/O map for this object.
 
int getObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
 Get object configuration item.
 
CObjectgetObject (SObjectId::ObjectId id)
 Get an object by ID.
 
uint16_t getPriv () const
 Get instance/private data field.
 
virtual EObjectState getState () const
 Get current operational state.
 
uint8_t getType () const
 Get object type field.
 
bool hasThread () const
 Check if a background thread is active.
 
int init ()
 One-time initialize object after bindings are resolved.
 
int setObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
 Set object configuration item.
 
void setObjectMapItem (SObjectId::ObjectId id, CObject *obj)
 Set an item in the object map.
 
int start ()
 Start object.
 
int stop ()
 Stop object.
 
virtual int trigger (uint8_t cmd)
 Execute a trigger command.
 

Static Public Member Functions

static int descValidDefault (const uint32_t *data, size_t len)
 Default descriptor validation method.
 
static int validateDesc (const uint32_t *desc, size_t len)
 Validate entire descriptor.
 

Protected Member Functions

virtual int onSetObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
 Pre-update hook for runtime configuration writes.
 

Protected Attributes

struct nxscope_intf_s nxsIntf
 NXScope interface structure (from logging library).
 

Detailed Description

NXScope over UDP transport.

Definition at line 15 of file udp.hxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
PROTO_NXSCOPE_UDP_CFG_IOBIND 

I/O bindings.

PROTO_NXSCOPE_UDP_CFG_IOBIND2 

I/O bindings with names.

PROTO_NXSCOPE_UDP_CFG_PORT 

UDP local port.

Definition at line 18 of file udp.hxx.

◆ anonymous enum

anonymous enum
inherited

Control command identifiers for control()

Enumerator
CMD_RESET 

Reset object internal state.

CMD_TRIGGER1 

Object-specific trigger slot 1.

CMD_TRIGGER2 

Object-specific trigger slot 2.

CMD_TRIGGER3 

Object-specific trigger slot 3.

Definition at line 40 of file object.hxx.

◆ anonymous enum

anonymous enum
inherited

Default descriptor validation failure codes.

Negative values identify which length check failed in descValidDefault().

Definition at line 314 of file object.hxx.

◆ EObjectState

Object operational state returned by getState()

Enumerator
STATE_STOPPED 

Object is stopped.

STATE_RUNNING 

Object is running.

Definition at line 32 of file object.hxx.

◆ EProtoClass

Protocol object class types.

Enumerator
PROTO_CLASS_ANY 

Wildcard/any protocol class (for validation/queries).

PROTO_CLASS_NIMBLE_PRPH 

BLE Peripheral using Apache NimBLE stack.

PROTO_CLASS_NXSCOPE_DUMMY 

NxScope real-time visualization (dummy interface).

PROTO_CLASS_DUMMY 

Dummy protocol (test/helper).

PROTO_CLASS_NXSCOPE_SERIAL 

NxScope real-time visualization (serial interface).

PROTO_CLASS_NXSCOPE_UDP 

NxScope real-time visualization (UDP interface).

PROTO_CLASS_SHELL_STD 

Interactive shell on stdin/stdout.

PROTO_CLASS_SHELL_SERIAL 

Interactive shell on serial port.

PROTO_CLASS_SERIAL 

Compact binary protocol over serial port.

PROTO_CLASS_MODBUS_RTU 

Modbus RTU (serial implementation).

PROTO_CLASS_MODBUS_TCP 

Modbus TCP (network implementation).

PROTO_CLASS_CAN 

CAN bus protocol.

PROTO_CLASS_UDP 

UDP-based protocol.

PROTO_CLASS_IPC 

FIFO-based local IPC protocol.

PROTO_CLASS_USER_START 

User-defined protocols start from here.

PROTO_CLASS_USER 

Placeholder for user protocol.

PROTO_CLASS_LAST 

Last protocol class (sentinel value).

Definition at line 27 of file common.hxx.

Member Function Documentation

◆ configure()

int CProtoNxscope::configure ( )
virtualinherited

Configure object from descriptor data.

Called during framework setup before dependency binding. Implementations should parse/validate descriptor configuration and store object settings, but avoid one-time allocations that depend on bound objects.

Returns
OK on success, negative error code on failure.

Reimplemented from dawn::CObject.

Definition at line 878 of file nxscope.cxx.

◆ deinit()

int CProtoNxscope::deinit ( )
virtualinherited

De-initialize object.

Clean up resources allocated during init().

Returns
OK on success, negative error code on failure.

Reimplemented from dawn::CObject.

Definition at line 897 of file nxscope.cxx.

◆ descValidDefault()

int CObject::descValidDefault ( const uint32_t *  data,
size_t  len 
)
staticinherited

Default descriptor validation method.

Provides basic validation that only checks if descriptor lengths are correct.

Parameters
dataDescriptor data pointer.
lenLength of descriptor data in 32-bit words.
Returns
OK on success, negative error code indicating validation stage.

Definition at line 42 of file object.cxx.

References dawn::SObjectCfg::UObjectCfgId::s, dawn::SObjectCfg::UObjectCfgId::size, and dawn::SObjectCfg::UObjectCfgId::v.

Here is the caller graph for this function:

◆ doStart()

int CProtoNxscope::doStart ( )
virtualinherited

Start implementation hook.

Override in derived classes instead of start().

Returns
OK on success, negative error code on failure.

Reimplemented from dawn::CObject.

Definition at line 910 of file nxscope.cxx.

References dawn::CObject::getIdV(), dawn::CIOCommon::isWrite(), dawn::CThreadedObject::setThreadFunc(), and dawn::CThreadedObject::threadStart().

Here is the call graph for this function:

◆ doStop()

int CProtoNxscope::doStop ( )
virtualinherited

Stop implementation hook.

Override in derived classes instead of stop().

Returns
OK on success, negative error code on failure.

Reimplemented from dawn::CObject.

Definition at line 970 of file nxscope.cxx.

References dawn::CThreadedObject::threadStop().

Here is the call graph for this function:

◆ getCfgFlag()

bool CObject::getCfgFlag ( ) const
inherited

Check if configuration flag is set.

Returns
True if this object has configuration data.

Definition at line 160 of file object.cxx.

References dawn::CDescObject::getSize().

Here is the call graph for this function:

◆ getCls()

uint16_t CObject::getCls ( ) const
inherited

Get object class field.

Returns
Object class identifier (0-511).

Definition at line 170 of file object.cxx.

References dawn::SObjectId::UObjectId::cls, and dawn::SObjectId::UObjectId::s.

Here is the caller graph for this function:

◆ getDesc()

CDescObject & CObject::getDesc ( )
inherited

Get descriptor object for this object.

Returns
Reference to associated CDescObject.

Definition at line 190 of file object.cxx.

◆ getDtype()

uint8_t CObject::getDtype ( ) const
inherited

Get data type field.

Returns
Data type (DTYPE_UINT32, DTYPE_FLOAT, etc.).

Definition at line 175 of file object.cxx.

References dawn::SObjectId::UObjectId::dtype, and dawn::SObjectId::UObjectId::s.

Here is the caller graph for this function:

◆ getDtypeSize()

size_t CObject::getDtypeSize ( ) const
inherited

Get size of this object's data type.

Returns
Size in bytes for the configured data type.

Definition at line 195 of file object.cxx.

References dawn::SObjectId::getDtypeSize_(), and dawn::CDescObject::getObjectDtype().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFlags()

uint8_t CObject::getFlags ( ) const
inherited

Get type-specific flags field.

Returns
Flags value (0-3).

Definition at line 180 of file object.cxx.

References dawn::SObjectId::UObjectId::flags, and dawn::SObjectId::UObjectId::s.

Here is the caller graph for this function:

◆ getId()

SObjectId::UObjectId CObject::getId ( ) const
inherited

Get object identifier as union structure.

Returns
Reference to UObjectId structure.

Definition at line 150 of file object.cxx.

◆ getIdV()

SObjectId::ObjectId CObject::getIdV ( ) const
inherited

Get object identifier as raw 32-bit value.

Returns
ObjectID as uint32_t.

Definition at line 155 of file object.cxx.

References dawn::SObjectId::UObjectId::v.

Here is the caller graph for this function:

◆ getIO()

CIOCommon * CBindableObject::getIO ( SObjectId::ObjectId  id)
inherited

Get an I/O object by ID.

Parameters
idObject ID to retrieve.
Returns
Pointer to the I/O object, or nullptr if not found.

Definition at line 41 of file bindable.cxx.

Here is the caller graph for this function:

◆ getIOMap()

const std::map< SObjectId::ObjectId, CIOCommon * > & CBindableObject::getIOMap ( ) const
inherited

Get the I/O map for this object.

Returns
Pointer to a map of object IDs to I/O objects.

Definition at line 18 of file bindable.cxx.

Here is the caller graph for this function:

◆ getObjConfig()

int CObject::getObjConfig ( SObjectCfg::ObjectCfgId  objcfg,
uint32_t *  data,
size_t  len 
)
inherited

Get object configuration item.

Retrieves configuration data for this object.

Parameters
objcfgConfiguration ID specifying which config item to retrieve.
dataPointer to buffer for configuration data.
lenLength of buffer in 32-bit words.
Returns
OK on success, negative error code on failure.

Definition at line 240 of file object.cxx.

References dawn::SObjectCfg::SObjectCfgItem::data, dawn::SObjectCfg::objectCfgGetSize(), and dawn::CDescObject::objectCfgItemId().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObject()

CObject * CBindableObject::getObject ( SObjectId::ObjectId  id)
inherited

Get an object by ID.

Parameters
idObject ID to retrieve.
Returns
Pointer to the object, or nullptr if not found.

Definition at line 52 of file bindable.cxx.

References dawn::CBindableObject::getIO(), dawn::SObjectId::objectIdGetType(), and dawn::SObjectId::OBJTYPE_IO.

Here is the call graph for this function:

◆ getPriv()

uint16_t CObject::getPriv ( ) const
inherited

Get instance/private data field.

Returns
Instance ID (0-16383).

Definition at line 185 of file object.cxx.

References dawn::SObjectId::UObjectId::priv, and dawn::SObjectId::UObjectId::s.

Here is the caller graph for this function:

◆ getState()

virtual EObjectState dawn::CObject::getState ( ) const
inlinevirtualinherited

Get current operational state.

Default returns STATE_RUNNING after successful start(), STATE_STOPPED otherwise. Objects with richer states (e.g. paused) should override.

Returns
Current EObjectState value.

Definition at line 183 of file object.hxx.

References dawn::CObject::STATE_RUNNING, and dawn::CObject::STATE_STOPPED.

◆ getType()

uint8_t CObject::getType ( ) const
inherited

Get object type field.

Returns
Object type (OBJTYPE_IO, OBJTYPE_PROTO, OBJTYPE_PROG).

Definition at line 165 of file object.cxx.

References dawn::SObjectId::UObjectId::s, and dawn::SObjectId::UObjectId::type.

◆ hasThread()

bool CProtoNxscope::hasThread ( ) const
virtualinherited

Check if a background thread is active.

Used by Dawn's main loop to detect when clean exit is possible. Objects without a background thread must return false. Independent of operational state tracked via getState().

Returns
True if a background thread is active, false otherwise.

Reimplemented from dawn::CObject.

Definition at line 991 of file nxscope.cxx.

◆ init()

int CProtoNxscope::init ( )
virtualinherited

One-time initialize object after bindings are resolved.

Called once during framework setup after dependency binding. Allocate lifetime resources here (buffers, register maps, etc.).

Returns
OK on success, negative error code on failure.

Reimplemented from dawn::CObject.

Definition at line 891 of file nxscope.cxx.

◆ onSetObjConfig()

virtual int dawn::CObject::onSetObjConfig ( SObjectCfg::ObjectCfgId  objcfg,
uint32_t *  data,
size_t  len 
)
inlineprotectedvirtualinherited

Pre-update hook for runtime configuration writes.

Called by setObjConfig() before descriptor-backed storage is updated. Derived classes may validate incoming data and prepare/apply runtime side effects. Returning a negative error rejects the update.

Parameters
objcfgConfiguration ID that will be updated.
dataPointer to new config words.
lenNumber of config words.
Returns
OK on success, or negative error code to reject update.

Reimplemented in dawn::CIOAdcStream, dawn::CIOAdcSync, and dawn::CIOPwm.

Definition at line 386 of file object.hxx.

Here is the caller graph for this function:

◆ setObjConfig()

int CObject::setObjConfig ( SObjectCfg::ObjectCfgId  objcfg,
uint32_t *  data,
size_t  len 
)
inherited

Set object configuration item.

Updates a configuration item for this object.

Parameters
objcfgConfiguration ID specifying which config item to update.
dataPointer to configuration data.
lenLength of configuration data in 32-bit words.
Returns
OK on success, negative error code on failure.

Definition at line 200 of file object.cxx.

References dawn::SObjectCfg::SObjectCfgItem::data, dawn::SObjectCfg::objectCfgGetRw(), dawn::SObjectCfg::objectCfgGetSize(), dawn::CDescObject::objectCfgItemId(), and dawn::CObject::onSetObjConfig().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setObjectMapItem()

void CBindableObject::setObjectMapItem ( SObjectId::ObjectId  id,
CObject obj 
)
inherited

Set an item in the object map.

Parameters
idObject ID to set.
objObject pointer to associate with the ID.

Definition at line 23 of file bindable.cxx.

References dawn::SObjectId::objectIdGetType(), and dawn::SObjectId::OBJTYPE_IO.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

int dawn::CObject::start ( )
inlineinherited

Start object.

Tracks operational state and calls doStart(). This phase may run many times during an object's lifetime and should not perform one-time allocation. Sets started on successful doStart() return.

Returns
OK on success, negative error code on failure.

Definition at line 116 of file object.hxx.

References dawn::CObject::doStart().

Here is the call graph for this function:

◆ stop()

int dawn::CObject::stop ( )
inlineinherited

Stop object.

Tracks operational state and calls doStop(). This phase may run many times during an object's lifetime and should not perform one-time deallocation. Always clears started regardless of doStop() return value.

Returns
OK on success, negative error code on failure.

Definition at line 145 of file object.hxx.

References dawn::CObject::doStop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trigger()

virtual int dawn::CObject::trigger ( uint8_t  cmd)
inlinevirtualinherited

Execute a trigger command.

Parameters
cmdCommand identifier (EObjectCmd value).
Returns
OK on success, -ENOTSUP if not supported.

Reimplemented in dawn::CIOAdcFetch, dawn::CIOAdcStream, dawn::CIOAdcSync, dawn::CIOEncoder, dawn::CIOEncoderIndex, dawn::CIOPwm, dawn::CProgBuffer, dawn::CProgCounter, dawn::CProgProcess, dawn::CProgSequencer, dawn::CProgThresholdBase, and dawn::CProgToggle.

Definition at line 195 of file object.hxx.

◆ validateDesc()

int CObject::validateDesc ( const uint32_t *  desc,
size_t  len 
)
staticinherited

Validate entire descriptor.

Validates a descriptor binary object-by-object using default checks.

Parameters
descDescriptor binary pointer.
lenDescriptor length in 32-bit words.
Returns
OK on success, negative error code indicating validation stage.

Definition at line 123 of file object.cxx.

References dawn::CObject::descValidDefault().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: