Dawn Framework 1.0
Universal data acquisition framework for embedded systems
factory.cxx
1// dawn/src/proto/factory.cxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#include "dawn/proto/factory.hxx"
7
8#ifdef CONFIG_DAWN_PROTO_DUMMY
9# include "dawn/proto/dummy.hxx"
10#endif
11
12#ifdef CONFIG_DAWN_PROTO_NXSCOPE_DUMMY
13# include "dawn/proto/nxscope/dummy.hxx"
14#endif
15#ifdef CONFIG_DAWN_PROTO_NXSCOPE_SERIAL
16# include "dawn/proto/nxscope/serial.hxx"
17#endif
18#ifdef CONFIG_DAWN_PROTO_NXSCOPE_UDP
19# include "dawn/proto/nxscope/udp.hxx"
20#endif
21#ifdef CONFIG_DAWN_PROTO_SHELL_PRETTY
22# include "dawn/proto/shell/pretty.hxx"
23#endif
24#ifdef CONFIG_DAWN_PROTO_SERIAL
25# include "dawn/proto/serial/simple.hxx"
26#endif
27#ifdef CONFIG_DAWN_PROTO_UDP
28# include "dawn/proto/udp/simple.hxx"
29#endif
30#ifdef CONFIG_DAWN_PROTO_IPC
31# include "dawn/proto/ipc/simple.hxx"
32#endif
33#ifdef CONFIG_DAWN_PROTO_NIMBLE_PERIPHERAL
34# include "dawn/proto/nimble/prph.hxx"
35#endif
36#ifdef CONFIG_DAWN_PROTO_CAN
37# include "dawn/proto/can/can.hxx"
38#endif
39#ifdef CONFIG_DAWN_PROTO_MODBUS_RTU
40# include "dawn/proto/modbus/rtu.hxx"
41#endif
42#ifdef CONFIG_DAWN_PROTO_MODBUS_TCP
43# include "dawn/proto/modbus/tcp.hxx"
44#endif
45#ifdef CONFIG_DAWN_PROTO_WAKAAMA
46# include "dawn/proto/wakaama/wakaama.hxx"
47#endif
48
49using namespace dawn;
50
52{
53 DEBUGASSERT(desc.getObjectType() == SObjectId::OBJTYPE_PROTO);
54
55 switch (desc.getObjectCls())
56 {
57#ifdef CONFIG_DAWN_PROTO_DUMMY
59 return new CProtoDummy(desc);
60#endif
61
62#ifdef CONFIG_DAWN_PROTO_NXSCOPE_DUMMY
64 return new CProtoNxscopeDummy(desc);
65#endif
66
67#ifdef CONFIG_DAWN_PROTO_NXSCOPE_SERIAL
69 return new CProtoNxscopeSerial(desc);
70#endif
71
72#ifdef CONFIG_DAWN_PROTO_NXSCOPE_UDP
74 return new CProtoNxscopeUdp(desc);
75#endif
76
77#ifdef CONFIG_DAWN_PROTO_SHELL_PRETTY
79 return new CProtoShellPretty(desc);
80#endif
81
82#ifdef CONFIG_DAWN_PROTO_SERIAL
84 return new CProtoSerial(desc);
85#endif
86
87#ifdef CONFIG_DAWN_PROTO_UDP
89 return new CProtoUdp(desc);
90#endif
91
92#ifdef CONFIG_DAWN_PROTO_IPC
94 return new CProtoIpc(desc);
95#endif
96
97#ifdef CONFIG_DAWN_PROTO_NIMBLE_PERIPHERAL
99 return new CProtoNimblePrph(desc);
100#endif
101
102#ifdef CONFIG_DAWN_PROTO_CAN
104 return new CProtoCan(desc);
105#endif
106
107#ifdef CONFIG_DAWN_PROTO_MODBUS_RTU
109 return new CProtoModbusRtu(desc);
110#endif
111
112#ifdef CONFIG_DAWN_PROTO_MODBUS_TCP
114 return new CProtoModbusTcp(desc);
115#endif
116
117#ifdef CONFIG_DAWN_PROTO_WAKAAMA
119 return new CProtoWakaama(desc);
120#endif
121
122 default:
123 {
124 DAWNERR("Unknown PROTO class %d\n", desc.getObjectCls());
125 return nullptr;
126 }
127 }
128}
Descriptor wrapper for individual object configuration.
uint8_t getObjectType() const
Get object type field.
uint16_t getObjectCls() const
Get object class field.
CAN bus protocol for industrial automation.
Definition can.hxx:36
Base class for all protocol implementations.
Definition common.hxx:23
@ PROTO_CLASS_NXSCOPE_UDP
NxScope real-time visualization (UDP interface).
Definition common.hxx:51
@ PROTO_CLASS_MODBUS_TCP
Modbus TCP (network implementation).
Definition common.hxx:71
@ PROTO_CLASS_MODBUS_RTU
Modbus RTU (serial implementation).
Definition common.hxx:67
@ PROTO_CLASS_WAKAAMA
LwM2M protocol using Eclipse Wakaama.
Definition common.hxx:87
@ PROTO_CLASS_NXSCOPE_SERIAL
NxScope real-time visualization (serial interface).
Definition common.hxx:47
@ PROTO_CLASS_DUMMY
Dummy protocol (test/helper).
Definition common.hxx:43
@ PROTO_CLASS_UDP
UDP-based protocol.
Definition common.hxx:79
@ PROTO_CLASS_SERIAL
Compact binary protocol over serial port.
Definition common.hxx:63
@ PROTO_CLASS_NIMBLE_PRPH
BLE Peripheral using Apache NimBLE stack.
Definition common.hxx:35
@ PROTO_CLASS_IPC
FIFO-based local IPC protocol.
Definition common.hxx:83
@ PROTO_CLASS_NXSCOPE_DUMMY
NxScope real-time visualization (dummy interface).
Definition common.hxx:39
@ PROTO_CLASS_SHELL_STD
Interactive shell on stdin/stdout.
Definition common.hxx:55
@ PROTO_CLASS_CAN
CAN bus protocol.
Definition common.hxx:75
Dummy Protocol for tests and binding placeholders.
Definition dummy.hxx:21
CProtoCommon * create(CDescObject &desc)
Create a protocol object from descriptor.
Definition factory.cxx:51
Simple FIFO-based IPC transport for local Dawn communication.
Definition simple.hxx:30
Modbus RTU (Remote Terminal Unit) protocol implementation.
Definition rtu.hxx:27
Modbus TCP protocol implementation.
Definition tcp.hxx:27
BLE Peripheral (Slave) Protocol Implementation using NimBLE.
Definition prph.hxx:27
NXScope no-op/dummy transport implementation.
Definition dummy.hxx:20
NXScope over serial port transport.
Definition serial.hxx:21
NXScope over UDP transport.
Definition udp.hxx:16
Simple binary serial protocol for device communication.
Definition simple.hxx:28
Interactive Command-Line Shell Interface.
Definition pretty.hxx:33
Simple binary UDP protocol for device communication.
Definition simple.hxx:30
Wakaama LwM2M client protocol implementation.
Definition wakaama.hxx:52
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
@ OBJTYPE_PROTO
Protocol object type.
Definition objectid.hxx:193