Omnicon-GenericDDSEngine-Py 4.9.0.post5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- omnicon_genericddsengine_py-4.9.0.post5/LICENSE +1 -0
- omnicon_genericddsengine_py-4.9.0.post5/MANIFEST.in +3 -0
- omnicon_genericddsengine_py-4.9.0.post5/PKG-INFO +490 -0
- omnicon_genericddsengine_py-4.9.0.post5/README.md +467 -0
- omnicon_genericddsengine_py-4.9.0.post5/omnicon_genericddsengine_py/__init__.py +5 -0
- omnicon_genericddsengine_py-4.9.0.post5/omnicon_genericddsengine_py/_omnicon_genericddsengine_py.cpython-312-x86_64-linux-gnu.so +0 -0
- omnicon_genericddsengine_py-4.9.0.post5/omnicon_genericddsengine_py/libOmniCon-GenericDDSEngine.so +0 -0
- omnicon_genericddsengine_py-4.9.0.post5/omnicon_genericddsengine_py.egg-info/PKG-INFO +490 -0
- omnicon_genericddsengine_py-4.9.0.post5/omnicon_genericddsengine_py.egg-info/SOURCES.txt +11 -0
- omnicon_genericddsengine_py-4.9.0.post5/omnicon_genericddsengine_py.egg-info/dependency_links.txt +1 -0
- omnicon_genericddsengine_py-4.9.0.post5/omnicon_genericddsengine_py.egg-info/top_level.txt +1 -0
- omnicon_genericddsengine_py-4.9.0.post5/setup.cfg +4 -0
- omnicon_genericddsengine_py-4.9.0.post5/setup.py +134 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PROPRIETARY SOFTWARE AND LICENSE. Customer acknowledges, and agrees, that the Service uses proprietary software (hereinafter �Software�) owned by Omnicon Distributed Systems LTD (herinafter �Omnicon�), and the Customer is being ranted an individual, non- exclusive, non-transferable license to use the Software subject to the terms and conditions of this Agreement. The Customer acknowledges, and agrees, that the Customer, its employees and agents, are expressly prohibited, directly or indirectly, from attempting to discover the source code, underlying algorithms, or technology of the Software; rent, lease, sell, assign, or transfer rights to the Software; modify or make derivative works based on the Software; or use the Software in any service bureau or timeshare capacity. The Customer acknowledges, and agrees, that Omnicon is the exclusive owner throughout the world of the Software, including subparts, additions, extensions, versions, updates and copies, and all rights not expressly granted to the Customer are reserved by Omnicon. Omnicon also reserves the right to modify its software within its sole discretion at anytime.
|
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: omnicon_genericddsengine_py
|
|
3
|
+
Version: 4.9.0.post5
|
|
4
|
+
Summary: Omnicon Generic DDS Engine Python API
|
|
5
|
+
Home-page: https://www.OmniconSystems.com
|
|
6
|
+
Author: Omnicon Distributed Systems LTD
|
|
7
|
+
Author-email: Gal@OmniconSystems.com
|
|
8
|
+
Classifier: License :: Other/Proprietary License
|
|
9
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
+
Requires-Python: >3.9, <3.13
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: home-page
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-python
|
|
22
|
+
Dynamic: summary
|
|
23
|
+
|
|
24
|
+
# OmniCon GenericDDSEngine PythonAPI
|
|
25
|
+
|
|
26
|
+
## Introduction
|
|
27
|
+
OmniCon's Generic DDS Engine is a pluggable software library that provides simple, fully generic monitoring and message injection capabilities for Data Distribution Service (DDS).
|
|
28
|
+
|
|
29
|
+
### Motivation
|
|
30
|
+
This project encapsulates DDS-complex API and configuration. It provides a simple, user friendly API to easily incorporate DDS traffic to generic monitoring and visualization tools.
|
|
31
|
+
|
|
32
|
+
### Engine Capabilites
|
|
33
|
+
#### Engine's monitor inputs:
|
|
34
|
+
1. Active dynamic/static monitoring based on a generic DDS Participant.
|
|
35
|
+
2. Passive (non-intrusive) dynamic monitoring using network sniffing techniques.
|
|
36
|
+
3. Offline network recording dissection.
|
|
37
|
+
|
|
38
|
+
#### Engine's monitor outputs & plugins:
|
|
39
|
+
1. A generic C++, C# and Python APIs for receiving monitored messages in JSON and Map formats via push/poll methods.
|
|
40
|
+
2. Customized integration to operational monitoring tools (proprietary and open-source).
|
|
41
|
+
3. Textual reports generation.
|
|
42
|
+
4. Integration to databases (relational and non-relational).
|
|
43
|
+
|
|
44
|
+
#### Engine's message injection:
|
|
45
|
+
1. A C++, C# and Python APIs for injecting messages via JSON or Map formats.
|
|
46
|
+
2. Message injection based on a user-provided textual format (e.g. CSV).
|
|
47
|
+
|
|
48
|
+
#### DDS XML/IDL Type Files Introspection:
|
|
49
|
+
1. A simplified C++, C# and Python APIs for extracting detailed information on a selected DDS type's structure.
|
|
50
|
+
2. Documentation / ICD generator.
|
|
51
|
+
|
|
52
|
+
### DDS Overview
|
|
53
|
+
The OMG Data Distribution Service (DDS™) is a middleware protocol and API standard for data-centric connectivity from the Object Management Group® (OMG®). It integrates the components of a system together, providing low-latency data connectivity, extreme reliability, and a scalable architecture that business and mission-critical Internet of Things (IoT) applications need.
|
|
54
|
+
<br>For more information refer to https://www.dds-foundation.org/.
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
* pip install Omnicon-GenericDDSEngine-Py
|
|
58
|
+
* Requires: Visual Studio redistributable (https://aka.ms/vs/17/release/vc_redist.x64.exe)
|
|
59
|
+
* An Omnnicon license is required to utilize the API. Please Contact Info@OmniconSystems.com.
|
|
60
|
+
|
|
61
|
+
## Examples
|
|
62
|
+
For full API documentation and examples refer to https://www.OmniconSystems.com
|
|
63
|
+
|
|
64
|
+
### Active Dynamic Monitoring
|
|
65
|
+
Demonstrate how to dinamically monitor every topic in a desired DDS domain.
|
|
66
|
+
The same API applies for Passive monitoring.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
import omnicon_genericddsengine_py as omnicon
|
|
70
|
+
from time import sleep
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class ActiveDynamicMonitorExampleListener(omnicon.EngineListener):
|
|
74
|
+
def OnUserDataJson(self, sampleJson):
|
|
75
|
+
print("OnUserDataJson")
|
|
76
|
+
print(sampleJson)
|
|
77
|
+
|
|
78
|
+
def OnDiscoveryDataJson(self, sampleJson):
|
|
79
|
+
print("OnDiscoveryDataJson")
|
|
80
|
+
print(sampleJson)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class ActiveDynamicMonitorExample:
|
|
84
|
+
def __init__(self):
|
|
85
|
+
self.run()
|
|
86
|
+
|
|
87
|
+
@staticmethod
|
|
88
|
+
def run():
|
|
89
|
+
print("Active Dynamic Monitoring Example\n")
|
|
90
|
+
|
|
91
|
+
# Factory configuration (optional) (can also be performed via an XML configuration)
|
|
92
|
+
factory_configuration = omnicon.FactoryConfiguration()
|
|
93
|
+
factory_configuration.loggerConfiguration.verbosity = (
|
|
94
|
+
omnicon.LogSeverityLevel.warning
|
|
95
|
+
)
|
|
96
|
+
omnicon.GenericDDSEngine.SetFactoryConfiguration(factory_configuration)
|
|
97
|
+
|
|
98
|
+
# Engine configuration (can also be performed via API)
|
|
99
|
+
engine = omnicon.GenericDDSEngine()
|
|
100
|
+
engine_configuration = omnicon.EngineConfiguration()
|
|
101
|
+
engine_configuration.engineOperationMode = (
|
|
102
|
+
omnicon.EngineOperationMode.ACTIVE_DYNAMIC_MONITORING
|
|
103
|
+
)
|
|
104
|
+
engine_configuration.ddsConfigurationFilesPath.append(
|
|
105
|
+
"./EngineConfigurationExamples/ActiveDynamicMonitoring/Engine_Active_Mode_Participant_Definition.xml"
|
|
106
|
+
)
|
|
107
|
+
engine_configuration.enableJsonOutput = True
|
|
108
|
+
engine.Init(engine_configuration)
|
|
109
|
+
|
|
110
|
+
# Register to engine's callbacks/events
|
|
111
|
+
listener = ActiveDynamicMonitorExampleListener()
|
|
112
|
+
engine.BindListener(
|
|
113
|
+
listener, omnicon.ON_USER_DATA_JSON | omnicon.ON_DISCOVERY_DATA_JSON
|
|
114
|
+
)
|
|
115
|
+
engine.Run()
|
|
116
|
+
|
|
117
|
+
print("Running Example...")
|
|
118
|
+
input("Press Enter to Exit \n")
|
|
119
|
+
sleep(1)
|
|
120
|
+
engine.UnbindListener()
|
|
121
|
+
print("Shutting Down...")
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Required Standard DDS configuration files include a basic participant with the DDS types files and DDS domain. For example:
|
|
126
|
+
|
|
127
|
+
```xml
|
|
128
|
+
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
129
|
+
<types>
|
|
130
|
+
<enum name="ShapeFillKind">
|
|
131
|
+
<enumerator name="SOLID_FILL"/>
|
|
132
|
+
<enumerator name="TRANSPARENT_FILL"/>
|
|
133
|
+
<enumerator name="HORIZONTAL_HATCH_FILL"/>
|
|
134
|
+
<enumerator name="VERTICAL_HATCH_FILL"/>
|
|
135
|
+
</enum>
|
|
136
|
+
<struct name= "ShapeType">
|
|
137
|
+
<member name="color" stringMaxLength="128" type="string" key="true"/>
|
|
138
|
+
<member name="x" type="int32"/>
|
|
139
|
+
<member name="y" type="int32"/>
|
|
140
|
+
<member name="shapesize" type="int32"/>
|
|
141
|
+
</struct>
|
|
142
|
+
<struct name= "ShapeTypeExtended" baseType="ShapeType">
|
|
143
|
+
<member name="fillKind" type="nonBasic" nonBasicTypeName= "ShapeFillKind"/>
|
|
144
|
+
<member name="angle" type="float32"/>
|
|
145
|
+
</struct>
|
|
146
|
+
</types>
|
|
147
|
+
|
|
148
|
+
<domain_library name="Domain_Lib">
|
|
149
|
+
<domain name="Domain" domain_id="7"/>
|
|
150
|
+
</domain_library>
|
|
151
|
+
|
|
152
|
+
<domain_participant_library name="Participants_Lib">
|
|
153
|
+
<domain_participant name="OmniCon_Engine_Participant" domain_ref="Domain_Lib::Domain">
|
|
154
|
+
<subscriber name="Subscriber"/>
|
|
155
|
+
</domain_participant>
|
|
156
|
+
</domain_participant_library>
|
|
157
|
+
|
|
158
|
+
</dds>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Message Injection
|
|
162
|
+
Demonstrate how to generically inject every DDS Topic using dictionary/json format.
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
import omnicon_genericddsengine_py as omnicon
|
|
166
|
+
from time import sleep
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class MessageInjectionExample:
|
|
170
|
+
def __init__(self):
|
|
171
|
+
print(self.run())
|
|
172
|
+
|
|
173
|
+
@staticmethod
|
|
174
|
+
def run():
|
|
175
|
+
print("Message Injection Example")
|
|
176
|
+
|
|
177
|
+
engine = omnicon.GenericDDSEngine()
|
|
178
|
+
# Engine configuration (can also be performed via xml config file)
|
|
179
|
+
engine_configuration = omnicon.EngineConfiguration()
|
|
180
|
+
engine_configuration.engineOperationMode = omnicon.EngineOperationMode.MESSAGE_INJECTION
|
|
181
|
+
engine_configuration.ddsConfigurationFilesPath.append("./EngineConfigurationExamples/MessageInjection")
|
|
182
|
+
|
|
183
|
+
if not engine.Init(engine_configuration):
|
|
184
|
+
return False
|
|
185
|
+
if not engine.Run():
|
|
186
|
+
return False
|
|
187
|
+
|
|
188
|
+
# Prevent data races:
|
|
189
|
+
sleep(2)
|
|
190
|
+
print("List of available writers: ")
|
|
191
|
+
for writerInfo in engine.GetWritersInfo():
|
|
192
|
+
print(writerInfo.entityName, "to Topic", writerInfo.topicName)
|
|
193
|
+
print("")
|
|
194
|
+
|
|
195
|
+
# Primitive Topic message:
|
|
196
|
+
primitive_topic_input = {
|
|
197
|
+
"SampleData.myLongLong": "-1",
|
|
198
|
+
"SampleData.myUnsignedShort": "0",
|
|
199
|
+
"SampleData.myFloat": "-6789889.3392",
|
|
200
|
+
"SampleData.myDouble": "-6789898989.33999442",
|
|
201
|
+
"SampleData.myBoolean": "0", # can also use "False"
|
|
202
|
+
"SampleData.myChar": "",
|
|
203
|
+
"SampleData.myWchar": "0", # wchar is treated as number
|
|
204
|
+
"SampleData.myOctet": "0",
|
|
205
|
+
"SampleData.myShort": "-32768",
|
|
206
|
+
"SampleData.myLong": "-2147483648",
|
|
207
|
+
"SampleData.myUnsignedLong": "0"
|
|
208
|
+
}
|
|
209
|
+
print("Injecting Primitive Topic Message")
|
|
210
|
+
engine.InjectMessage("Publisher::PrimitiveTypeTopic_DW", primitive_topic_input)
|
|
211
|
+
|
|
212
|
+
# String Topic Message
|
|
213
|
+
string_topic_input = {
|
|
214
|
+
"SampleData.myBoundedString": "Hello",
|
|
215
|
+
"SampleData.myUnboundedString": "OmniCon",
|
|
216
|
+
"SampleData.myBoundedWString": "!"
|
|
217
|
+
}
|
|
218
|
+
print("Injecting String Topic Message")
|
|
219
|
+
engine.InjectMessage("Publisher::StringsTypeTopic_DW", string_topic_input)
|
|
220
|
+
|
|
221
|
+
# Enum Topic Message
|
|
222
|
+
enum_topic_input = {
|
|
223
|
+
"SampleData.mySimpleEnum": "2",
|
|
224
|
+
"SampleData.myDigitsEnum": "-1",
|
|
225
|
+
"SampleData.LetterPrimitiveEnum": "1"
|
|
226
|
+
}
|
|
227
|
+
print("Injecting Enum Topic Message")
|
|
228
|
+
engine.InjectMessage("Publisher::EnumTypeTopic_DW", enum_topic_input)
|
|
229
|
+
|
|
230
|
+
# PrimitiveNested Topic Message
|
|
231
|
+
primitive_nested_topic_input = {
|
|
232
|
+
"SampleData.myAliasLongType": "1",
|
|
233
|
+
"SampleData.myFirstType.myChar": "1",
|
|
234
|
+
"SampleData.myFirstType.myWchar": "1",
|
|
235
|
+
"SampleData.myFirstType.myOctet": "1",
|
|
236
|
+
|
|
237
|
+
"SampleData.PrimitiveSecondNested.myFloat": "2.5",
|
|
238
|
+
"SampleData.PrimitiveSecondNested.myNestedType.myChar": "z",
|
|
239
|
+
"SampleData.PrimitiveSecondNested.myDouble": "3.14159265359"
|
|
240
|
+
}
|
|
241
|
+
print("Injecting PrimitiveNested Topic Message")
|
|
242
|
+
engine.InjectMessage("Publisher::PrimitiveNestedTypeTopic_DW", primitive_nested_topic_input)
|
|
243
|
+
|
|
244
|
+
# Array Topic Message
|
|
245
|
+
array_type_topic_input = {
|
|
246
|
+
"SampleData.myKey": "1",
|
|
247
|
+
"SampleData.AliasCharArray[0]": "1",
|
|
248
|
+
"SampleData.PrimitiveOneDimensionalLiteralSizeArray.boolean_array[0]": "1",
|
|
249
|
+
"SampleData.PrimitiveOneDimensionalLiteralSizeArray.boolean_array[1]": "0",
|
|
250
|
+
"SampleData.PrimitiveOneDimensionalLiteralSizeArray.boolean_array[2]": "1",
|
|
251
|
+
"SampleData.PrimitiveOneDimensionalLiteralSizeArray.short_array[0]": "223",
|
|
252
|
+
}
|
|
253
|
+
print("Injecting ArrayTypeTopic Topic Message")
|
|
254
|
+
engine.InjectMessage("Publisher::ArrayTypeTopic_DW", array_type_topic_input)
|
|
255
|
+
|
|
256
|
+
# Sequence Topic Message
|
|
257
|
+
sequence_topic_message = {
|
|
258
|
+
"SampleData": {
|
|
259
|
+
"myKey": "0",
|
|
260
|
+
"myBooleanSeq": [
|
|
261
|
+
"TRUE"
|
|
262
|
+
],
|
|
263
|
+
"myAliasLongUSeq": [],
|
|
264
|
+
"myAliasSeqEnumMember": [
|
|
265
|
+
"(1) - GREEN",
|
|
266
|
+
"(2) - BLUE"
|
|
267
|
+
],
|
|
268
|
+
"myAliasSeqStringMember": [
|
|
269
|
+
"ABC"
|
|
270
|
+
],
|
|
271
|
+
"myPrimitiveSeq": [
|
|
272
|
+
{
|
|
273
|
+
"myChar": "\u0000",
|
|
274
|
+
"myWchar": "0",
|
|
275
|
+
"myOctet": "0",
|
|
276
|
+
"myShort": "2",
|
|
277
|
+
"myUnsignedShort": "0",
|
|
278
|
+
"myLong": "0",
|
|
279
|
+
"myUnsignedLong": "0",
|
|
280
|
+
"myLongLong": "0",
|
|
281
|
+
"myUnsignedLongLong": "0",
|
|
282
|
+
"myFloat": "0",
|
|
283
|
+
"myDouble": "0",
|
|
284
|
+
"myBoolean": "TRUE"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
print("Injecting SequenceTypeTopic Topic Message")
|
|
290
|
+
engine.InjectMessage("Publisher::SequenceTypeTopic_DW", sequence_topic_message)
|
|
291
|
+
|
|
292
|
+
# Union Topic Message
|
|
293
|
+
union_type_topic_input = {
|
|
294
|
+
"SampleData.myKey": "1",
|
|
295
|
+
"SampleData.mySimpleUnion.AliasLong_2_3": "111",
|
|
296
|
+
# "SampleData.PositionError.Error3DMember.sigmaXX": "23",
|
|
297
|
+
"SampleData.PositionError.Error2DMember.sigmaXX": "245"
|
|
298
|
+
}
|
|
299
|
+
print("Injecting UnionTypeTopic Topic Message")
|
|
300
|
+
engine.InjectMessage("Publisher::UnionTypeTopic_DW", union_type_topic_input)
|
|
301
|
+
|
|
302
|
+
input("Press Enter to Exit...")
|
|
303
|
+
return True
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Required Standard DDS configuration files include a basic participant with the DDS types files and DDS domain. For example:
|
|
308
|
+
|
|
309
|
+
```xml
|
|
310
|
+
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
311
|
+
<types>
|
|
312
|
+
<!--User Types-->
|
|
313
|
+
<include file="TypeFiles/ShapeType.xml" />
|
|
314
|
+
<include file="TypeFiles/myIncludedTypesTester.xml" />
|
|
315
|
+
<include file="TypeFiles/myGenericTypesTester.xml" />
|
|
316
|
+
</types>
|
|
317
|
+
|
|
318
|
+
<!-- Optional -->
|
|
319
|
+
<qos_library name="QOSLibrary">
|
|
320
|
+
<qos_profile name="DefaultProfile" is_default_participant_factory_profile="true" is_default_qos="true" >
|
|
321
|
+
<participant_qos/>
|
|
322
|
+
<datawriter_qos>
|
|
323
|
+
<property>
|
|
324
|
+
<value>
|
|
325
|
+
<!--Required for unbounded types support-->
|
|
326
|
+
<element>
|
|
327
|
+
<name>dds.data_writer.history.memory_manager.fast_pool.pool_buffer_max_size</name>
|
|
328
|
+
<value>4096</value>
|
|
329
|
+
</element>
|
|
330
|
+
</value>
|
|
331
|
+
</property>
|
|
332
|
+
</datawriter_qos>
|
|
333
|
+
<datareader_qos>
|
|
334
|
+
<property>
|
|
335
|
+
<value>
|
|
336
|
+
<!--Required for unbounded types support-->
|
|
337
|
+
<element>
|
|
338
|
+
<name>dds.data_reader.history.memory_manager.fast_pool.pool_buffer_max_size</name>
|
|
339
|
+
<value>4096</value>
|
|
340
|
+
</element>
|
|
341
|
+
</value>
|
|
342
|
+
</property>
|
|
343
|
+
</datareader_qos>
|
|
344
|
+
</qos_profile>
|
|
345
|
+
</qos_library>
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
<domain_library name="Domain_Lib">
|
|
350
|
+
<domain name="Domain" domain_id="7">
|
|
351
|
+
<!--Types Definition-->
|
|
352
|
+
<register_type name="ShapeType" type_ref="ShapeType" />
|
|
353
|
+
<register_type name="PrimitiveType" type_ref="PrimitiveType" />
|
|
354
|
+
<register_type name="MyNamespace::StringsType" type_ref="MyNamespace::StringsType" />
|
|
355
|
+
<register_type name="EnumType" type_ref="EnumType" />
|
|
356
|
+
<register_type name="PrimitiveNestedType" type_ref="PrimitiveNestedType" />
|
|
357
|
+
<register_type name="SequenceType" type_ref="SequenceType" />
|
|
358
|
+
<register_type name="UnionType" type_ref="UnionType" />
|
|
359
|
+
<register_type name="ArrayType" type_ref="ArrayType" />
|
|
360
|
+
|
|
361
|
+
<!--Topics Definition-->
|
|
362
|
+
<topic name="Square" register_type_ref="ShapeType"/>
|
|
363
|
+
<topic name="PrimitiveTypeTopic" register_type_ref="PrimitiveType" />
|
|
364
|
+
<topic name="StringsTypeTopic" register_type_ref="MyNamespace::StringsType" />
|
|
365
|
+
<topic name="EnumTypeTopic" register_type_ref="EnumType" />
|
|
366
|
+
<topic name="PrimitiveNestedTypeTopic" register_type_ref="PrimitiveNestedType" />
|
|
367
|
+
<topic name="SequenceTypeTopic" register_type_ref="SequenceType" />
|
|
368
|
+
<topic name="UnionTypeTopic" register_type_ref="UnionType" />
|
|
369
|
+
<topic name="ArrayTypeTopic" register_type_ref="ArrayType" />
|
|
370
|
+
|
|
371
|
+
</domain>
|
|
372
|
+
</domain_library>
|
|
373
|
+
<domain_participant_library name="Participants_Lib">
|
|
374
|
+
<domain_participant name="OmniCon_Engine_Participant" domain_ref="Domain_Lib::Domain">
|
|
375
|
+
<publisher name="Publisher">
|
|
376
|
+
<data_writer name="PrimitiveTypeTopic_DW" topic_ref="PrimitiveTypeTopic">
|
|
377
|
+
<datawriter_qos base_name="QOSLibrary::DefaultProfile"/>
|
|
378
|
+
</data_writer>
|
|
379
|
+
<data_writer name="StringsTypeTopic_DW" topic_ref="StringsTypeTopic">
|
|
380
|
+
<datawriter_qos base_name="QOSLibrary::DefaultProfile"/>
|
|
381
|
+
</data_writer>
|
|
382
|
+
<data_writer name="EnumTypeTopic_DW" topic_ref="EnumTypeTopic">
|
|
383
|
+
<datawriter_qos base_name="QOSLibrary::DefaultProfile"/>
|
|
384
|
+
</data_writer>
|
|
385
|
+
<data_writer name="PrimitiveNestedTypeTopic_DW" topic_ref="PrimitiveNestedTypeTopic">
|
|
386
|
+
<datawriter_qos base_name="QOSLibrary::DefaultProfile"/>
|
|
387
|
+
</data_writer>
|
|
388
|
+
<data_writer name="ArrayTypeTopic_DW" topic_ref="ArrayTypeTopic">
|
|
389
|
+
<datawriter_qos base_name="QOSLibrary::DefaultProfile"/>
|
|
390
|
+
</data_writer>
|
|
391
|
+
<data_writer name="SequenceTypeTopic_DW" topic_ref="SequenceTypeTopic">
|
|
392
|
+
<datawriter_qos base_name="QOSLibrary::DefaultProfile"/>
|
|
393
|
+
</data_writer>
|
|
394
|
+
<data_writer name="UnionTypeTopic_DW" topic_ref="UnionTypeTopic">
|
|
395
|
+
<datawriter_qos base_name="QOSLibrary::DefaultProfile"/>
|
|
396
|
+
</data_writer>
|
|
397
|
+
</publisher>
|
|
398
|
+
</domain_participant>
|
|
399
|
+
</domain_participant_library>
|
|
400
|
+
</dds>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Type Introspection Example
|
|
404
|
+
Demonstrate how to extract DDS type infromation for analysis purposes.
|
|
405
|
+
|
|
406
|
+
```python
|
|
407
|
+
import omnicon_genericddsengine_py as omnicon
|
|
408
|
+
|
|
409
|
+
class TypeIntrospectionExample:
|
|
410
|
+
def __init__(self):
|
|
411
|
+
print(self.run())
|
|
412
|
+
|
|
413
|
+
@staticmethod
|
|
414
|
+
def run():
|
|
415
|
+
print("Type Introspection Example")
|
|
416
|
+
factory_configuration = omnicon.FactoryConfiguration()
|
|
417
|
+
factory_configuration.loggerConfiguration.verbosity = omnicon.LogSeverityLevel.trace
|
|
418
|
+
omnicon.GenericDDSEngine.SetFactoryConfiguration(factory_configuration)
|
|
419
|
+
|
|
420
|
+
engine = omnicon.GenericDDSEngine()
|
|
421
|
+
# Engine configuration (can also be performed via xml config file)
|
|
422
|
+
engine_configuration = omnicon.EngineConfiguration()
|
|
423
|
+
engine_configuration.engineOperationMode = omnicon.EngineOperationMode.TYPE_INTROSPECTION
|
|
424
|
+
engine_configuration.ddsConfigurationFilesPath.append("./EngineConfigurationExamples/TypeIntrospection/TopicNamesToTypesDefMap.xml")
|
|
425
|
+
|
|
426
|
+
if not engine.Init(engine_configuration):
|
|
427
|
+
return False
|
|
428
|
+
if not engine.Run():
|
|
429
|
+
return False
|
|
430
|
+
|
|
431
|
+
DDSTopicToTypeXMLMapping = omnicon.GenericDDSEngine.GetTopicNameToTypeNameMap(
|
|
432
|
+
"./EngineConfigurationExamples/TypeIntrospection/TopicNamesToTypesDefMap.xml")
|
|
433
|
+
for topic, type in DDSTopicToTypeXMLMapping.items():
|
|
434
|
+
print(topic + " - " + type)
|
|
435
|
+
|
|
436
|
+
dds_type = engine.IntrospectType(type)
|
|
437
|
+
if dds_type is None:
|
|
438
|
+
print(type + " is None")
|
|
439
|
+
for element in dds_type.structure:
|
|
440
|
+
print(element.name)
|
|
441
|
+
|
|
442
|
+
if element.typeKindName == "STRUCTURE":
|
|
443
|
+
print("\tdataTypeName - " + (element).dataTypeName)
|
|
444
|
+
if element.typeKindName == "STRING":
|
|
445
|
+
print("\tlen - " + str((element).length))
|
|
446
|
+
if element.typeKindName == "ENUMERATION":
|
|
447
|
+
print("\tENUMERATION")
|
|
448
|
+
if element.typeKindName == "SEQUENCE":
|
|
449
|
+
print("\tlen - " + str((element).length))
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
Required Standard DDS configuration files include a basic DDS types/topic XML definition. For example:
|
|
453
|
+
```xml
|
|
454
|
+
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
455
|
+
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.1.0/rti_dds_profiles.xsd"
|
|
456
|
+
version="6.1.0">
|
|
457
|
+
<types>
|
|
458
|
+
<include file="TypeFiles//myIncludedTypesTester.xml"/>
|
|
459
|
+
<include file="TypeFiles//myGenericTypesTester.xml"/>
|
|
460
|
+
<include file="TypeFiles//ShapeType.xml"/>
|
|
461
|
+
</types>
|
|
462
|
+
|
|
463
|
+
<domain_library name="Domain_Lib">
|
|
464
|
+
<domain name="Domain">
|
|
465
|
+
<!--Types Definition-->
|
|
466
|
+
<register_type name="ShapeType" type_ref="ShapeTypeExtended" />
|
|
467
|
+
<register_type name="PrimitiveType" type_ref="PrimitiveType" />
|
|
468
|
+
<register_type name="MyNamespace::StringsType" type_ref="MyNamespace::StringsType" />
|
|
469
|
+
<register_type name="EnumType" type_ref="EnumType" />
|
|
470
|
+
<register_type name="PrimitiveNestedType" type_ref="PrimitiveNestedType" />
|
|
471
|
+
<register_type name="SequenceType" type_ref="SequenceType" />
|
|
472
|
+
<register_type name="UnionType" type_ref="UnionType" />
|
|
473
|
+
<register_type name="ArrayType" type_ref="ArrayType" />
|
|
474
|
+
|
|
475
|
+
<!--Topics Definition-->
|
|
476
|
+
<topic name="Square" register_type_ref="ShapeType"/>
|
|
477
|
+
<topic name="PrimitiveTypeTopic" register_type_ref="PrimitiveType" />
|
|
478
|
+
<topic name="StringsTypeTopic" register_type_ref="MyNamespace::StringsType" />
|
|
479
|
+
<topic name="EnumTypeTopic" register_type_ref="EnumType" />
|
|
480
|
+
<topic name="PrimitiveNestedTypeTopic" register_type_ref="PrimitiveNestedType" />
|
|
481
|
+
<topic name="SequenceTypeTopic" register_type_ref="SequenceType" />
|
|
482
|
+
<topic name="UnionTypeTopic" register_type_ref="UnionType" />
|
|
483
|
+
<topic name="ArrayTypeTopic" register_type_ref="ArrayType" />
|
|
484
|
+
</domain>
|
|
485
|
+
</domain_library>
|
|
486
|
+
|
|
487
|
+
</dds>
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
**OmniCon Distributed System LTD All Rights Reserved ©2019-2026**
|