Dawn Framework 1.0
Universal data acquisition framework for embedded systems
udp.hxx
1// dawn/include/dawn/proto/nxscope/udp.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include "dawn/porting/config.hxx"
9#include "dawn/proto/nxscope/nxscope.hxx"
10
11namespace dawn
12{
16{
17public:
18 enum
19 {
20 PROTO_NXSCOPE_UDP_CFG_FIRST = 0,
24 PROTO_NXSCOPE_UDP_CFG_LAST = 31
25 };
26
27 explicit CProtoNxscopeUdp(CDescObject &desc)
28 : CProtoNxscope(desc)
29 , port(CONFIG_DAWN_PROTO_NXSCOPE_UDP_PORT)
30 {
31 }
32
33 ~CProtoNxscopeUdp() override;
34
35#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
36 const char *getClassNameStr() const override
37 {
38 return "nxscope";
39 }
40#endif
41
42 int initPriv() override;
43 int deinitPriv() override;
44 int startPriv() override;
45 int stopPriv() override;
46
47 constexpr static SObjectId::ObjectId objectId(uint16_t id)
48 {
51 }
52
53 constexpr static SObjectCfg::ObjectCfgId cfgId(bool rw, uint8_t dtype, uint8_t size, uint8_t id)
54 {
57 }
58
59 constexpr static SObjectCfg::ObjectCfgId cfgIdIOBind(uint16_t size)
60 {
61 return CProtoNxscopeUdp::cfgId(false, SObjectId::DTYPE_ANY, size, PROTO_NXSCOPE_UDP_CFG_IOBIND);
62 }
63
64 constexpr static SObjectCfg::ObjectCfgId cfgIdIOBind2(uint16_t count)
65 {
66 return CProtoNxscopeUdp::cfgId(false,
68 (count * (sizeof(CProtoNxscope::SProtoNxscopeIOBind2) / 4)),
70 }
71
72 constexpr static SObjectCfg::ObjectCfgId cfgIdPort()
73 {
74 return CProtoNxscopeUdp::cfgId(false, SObjectId::DTYPE_UINT16, 1, PROTO_NXSCOPE_UDP_CFG_PORT);
75 }
76
77private:
78 uint16_t port;
79 struct nxscope_udp_cfg_s nxsUdpCfg;
80
81 int configureDesc(const CDescObject &desc);
82 int confgureNxscopePriv();
83};
84} // namespace dawn
Descriptor wrapper for individual object configuration.
@ PROTO_CLASS_NXSCOPE_UDP
NxScope real-time visualization (UDP interface).
Definition common.hxx:51
NXScope over UDP transport.
Definition udp.hxx:16
@ PROTO_NXSCOPE_UDP_CFG_IOBIND2
I/O bindings with names.
Definition udp.hxx:22
@ PROTO_NXSCOPE_UDP_CFG_PORT
UDP local port.
Definition udp.hxx:23
@ PROTO_NXSCOPE_UDP_CFG_IOBIND
I/O bindings.
Definition udp.hxx:21
Real-time data visualization protocol (base class).
Definition nxscope.hxx:37
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.
Definition objectcfg.hxx:60
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
@ OBJTYPE_PROTO
Protocol object type.
Definition objectid.hxx:193
@ DTYPE_ANY
Wildcard data type (matches any actual type).
Definition objectid.hxx:68
@ DTYPE_UINT16
Unsigned 16-bit integer (0 to 65535).
Definition objectid.hxx:88
uint32_t ObjectId
ObjectID type - single 32-bit value.
Definition objectid.hxx:44
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.
Definition objectid.hxx:290