Skip to content

Commit 20e5b28

Browse files
Merge branch 'master' into develop
2 parents c6ae22e + 09493a6 commit 20e5b28

36 files changed

+2090
-336
lines changed

examples/connext_dds/custom_transport/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Example Code: Creating a Custom Transport
22

3+
**IMPORTANT:** This documentation is out of date, and details may be missing.
4+
If you are interested in developing a custom transport plugin for RTI Connext,
5+
please contact your local RTI representative or email [email protected].
6+
37
## Concept
48

59
RTI Connext DDS interacts with the underlying network/communications transport
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Example Code: WaitSet with Status Condition
2+
3+
If you haven't used the RTI Connext Python API before, first check the
4+
[Getting Started Guide](https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds_professional/getting_started_guide/index.html).
5+
6+
## Running the Example
7+
8+
In two separate command prompt windows for the publisher and subscriber run the
9+
following commands from the example directory (this is necessary to ensure the
10+
application loads the QoS defined in *USER_QOS_PROFILES.xml*):
11+
12+
```sh
13+
python waitset_status_cond_publisher.py
14+
python waitset_status_cond_subscriber.py
15+
```
16+
17+
Note: you can run multiple publishers and subscribers at the same time.
18+
19+
For the full list of arguments pass `-h`.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
(c) 2024 Copyright, Real-Time Innovations, Inc. All rights reserved.
4+
RTI grants Licensee a license to use, modify, compile, and create derivative
5+
works of the Software. Licensee has the right to distribute object form only
6+
for use with RTI products. The Software is provided "as is", with no warranty
7+
of any type, including any warranty for fitness for any purpose. RTI is under
8+
no obligation to maintain or support the Software. RTI shall not be liable for
9+
any incidental or consequential damages arising out of the use or inability to
10+
use the software.
11+
-->
12+
<!-- Description XML QoS Profile for waitsets The QoS configuration of the
13+
DDS entities in the generated example is loaded from this file. This file
14+
is used only when it is in the current working directory or when the enviroment
15+
variable NDDS_QOS_PROFILES is defined and points to this file. For more information
16+
about XML QoS Profiles see Chapter 15 in the RTI Connext user manual. -->
17+
18+
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:noNamespaceSchemaLocation="https://community.rti.com/schema/current/rti_dds_qos_profiles.xsd">
20+
21+
<!-- QoS Library containing the QoS profile used in the generated example
22+
A QoS library is a named set of QoS profiles.
23+
-->
24+
<qos_library name="waitset_status_cond_py_Library">
25+
<!-- QoS profile used to configure reliable communication between the DataWriter
26+
and DataReader created in the example code.
27+
A QoS profile groups a set of related QoS.
28+
-->
29+
<qos_profile name="waitset_status_cond_py_Profile" base_name="BuiltinQosLib::Generic.StrictReliable" is_default_qos="true">
30+
31+
<domain_participant_qos>
32+
<!-- The participant name, if it is set, will be displayed in the RTI
33+
Analyzer tool, making it easier for you to tell one application from another
34+
when you're debugging. -->
35+
<participant_name>
36+
<name>RTI Waitsets with Status Conditions Python Example</name>
37+
</participant_name>
38+
39+
</domain_participant_qos>
40+
</qos_profile>
41+
42+
</qos_library>
43+
</dds>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# (c) Copyright, Real-Time Innovations, 2024. All rights reserved.
2+
# RTI grants Licensee a license to use, modify, compile, and create derivative
3+
# works of the software solely for use with RTI Connext DDS. Licensee may
4+
# redistribute copies of the software provided that all such copies are subject
5+
# to this license. The software is provided "as is", with no warranty of any
6+
# type, including any warranty for fitness for any purpose. RTI is under no
7+
# obligation to maintain or support the software. RTI shall not be liable for
8+
# any incidental or consequential damages arising out of the use or inability
9+
# to use the software.
10+
11+
import rti.idl as idl
12+
13+
14+
@idl.struct
15+
class Foo:
16+
x: idl.int16 = 0
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# (c) Copyright, Real-Time Innovations, 2024. All rights reserved.
2+
# RTI grants Licensee a license to use, modify, compile, and create derivative
3+
# works of the software solely for use with RTI Connext DDS. Licensee may
4+
# redistribute copies of the software provided that all such copies are subject
5+
# to this license. The software is provided "as is", with no warranty of any
6+
# type, including any warranty for fitness for any purpose. RTI is under no
7+
# obligation to maintain or support the software. RTI shall not be liable for
8+
# any incidental or consequential damages arising out of the use or inability
9+
# to use the software.
10+
11+
import argparse
12+
13+
import rti.connextdds as dds
14+
15+
from foo import Foo
16+
17+
18+
def publisher_main(domain_id, sample_count):
19+
# Create a DomainParticipant with default QoS
20+
participant = dds.DomainParticipant(domain_id)
21+
22+
# Create a Topic and automatically register the type
23+
topic = dds.Topic(participant, "Example Foo", Foo)
24+
25+
# Create a DataWriter with default QoS
26+
writer = dds.DataWriter(topic)
27+
28+
# Create a Status Condition for the writer
29+
status_condition = dds.StatusCondition(writer)
30+
31+
# Enable statuses configuration for the Status Condition
32+
status_condition.enabled_statuses = dds.StatusMask.PUBLICATION_MATCHED
33+
34+
# Define a handler for the Status Condition
35+
def status_handler(_):
36+
status_mask = writer.status_changes
37+
st = writer.publication_matched_status
38+
39+
if dds.StatusMask.PUBLICATION_MATCHED in status_mask:
40+
print(
41+
f"Publication matched changed => Matched readers = {st.current_count}"
42+
)
43+
44+
status_condition.set_handler(status_handler)
45+
46+
# Create a WaitSet and attach our Status Condition
47+
waitset = dds.WaitSet()
48+
waitset += status_condition
49+
50+
# Instantiate a sample
51+
sample = Foo()
52+
53+
# Write every second until the specified amount of samples is reached
54+
samples_sent = 0
55+
while (sample_count == 0) or (samples_sent < sample_count):
56+
# Catch control-C interrupt
57+
try:
58+
# Dispatch will call the handlers associated to the
59+
# WaitSet conditions when they activate
60+
waitset.dispatch(dds.Duration(1, 0)) # Wait up to 1s each time
61+
62+
print(f"Writing Foo, count = {samples_sent}")
63+
sample.x = samples_sent
64+
writer.write(sample)
65+
samples_sent += 1
66+
except KeyboardInterrupt:
67+
break
68+
69+
70+
if __name__ == "__main__":
71+
parser = argparse.ArgumentParser(
72+
description="RTI Connext DDS Example: Waitsets with Status Conditions (Publisher)"
73+
)
74+
parser.add_argument(
75+
"-d", "--domain", type=int, default=0, help="DDS Domain ID"
76+
)
77+
parser.add_argument(
78+
"-c", "--count", type=int, default=0, help="Number of samples to send"
79+
)
80+
81+
args = parser.parse_args()
82+
assert 0 <= args.domain < 233
83+
assert args.count >= 0
84+
85+
publisher_main(args.domain, args.count)
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# (c) Copyright, Real-Time Innovations, 2024. All rights reserved.
2+
# RTI grants Licensee a license to use, modify, compile, and create derivative
3+
# works of the software solely for use with RTI Connext DDS. Licensee may
4+
# redistribute copies of the software provided that all such copies are subject
5+
# to this license. The software is provided "as is", with no warranty of any
6+
# type, including any warranty for fitness for any purpose. RTI is under no
7+
# obligation to maintain or support the software. RTI shall not be liable for
8+
# any incidental or consequential damages arising out of the use or inability
9+
# to use the software.
10+
11+
import argparse
12+
13+
import rti.connextdds as dds
14+
15+
from foo import Foo
16+
17+
18+
def subscriber_main(domain_id, sample_count):
19+
# Create a DomainParticipant with default QoS
20+
participant = dds.DomainParticipant(domain_id)
21+
22+
# Create a Topic and automatically register the type
23+
topic = dds.Topic(participant, "Example Foo", Foo)
24+
25+
# Create a DataReader with default QoS
26+
reader = dds.DataReader(topic)
27+
28+
# Create a Status Condition for the reader
29+
status_condition = dds.StatusCondition(reader)
30+
31+
# Enable statuses configuration for the Status Condition
32+
status_condition.enabled_statuses = (
33+
dds.StatusMask.LIVELINESS_CHANGED | dds.StatusMask.DATA_AVAILABLE
34+
)
35+
36+
# This counter will keep track of the samples we have processed
37+
samples_read = 0
38+
39+
# Define a handler for the Status Condition
40+
def status_handler(_):
41+
status_mask = reader.status_changes
42+
43+
# Handle liveliness status changes
44+
if dds.StatusMask.LIVELINESS_CHANGED in status_mask:
45+
st = reader.liveliness_changed_status
46+
print(f"Liveliness changed => Active writers = {st.alive_count}")
47+
48+
# Handle when there's new data available
49+
if dds.StatusMask.DATA_AVAILABLE in status_mask:
50+
nonlocal samples_read
51+
for data in reader.take_data():
52+
samples_read += 1
53+
print(data)
54+
55+
status_condition.set_handler(status_handler)
56+
57+
# Create a WaitSet and attach our Status Condition
58+
waitset = dds.WaitSet()
59+
waitset += status_condition
60+
61+
# Loop until the application is shut down or the sample count is reached
62+
while (sample_count == 0) or (samples_read < sample_count):
63+
# Catch control-C interrupt
64+
try:
65+
# Dispatch will call the handlers associated to the
66+
# WaitSet conditions when they activate
67+
waitset.dispatch(dds.Duration(4, 0)) # Wait up to 4s each time
68+
except KeyboardInterrupt:
69+
break
70+
71+
72+
if __name__ == "__main__":
73+
parser = argparse.ArgumentParser(
74+
description="RTI Connext DDS Example: Waitsets with Status Conditions (Subscriber)"
75+
)
76+
parser.add_argument(
77+
"-d", "--domain", type=int, default=0, help="DDS Domain ID"
78+
)
79+
parser.add_argument(
80+
"-c",
81+
"--count",
82+
type=int,
83+
default=0,
84+
help="Number of samples to receive",
85+
)
86+
87+
args = parser.parse_args()
88+
assert 0 <= args.domain < 233
89+
assert args.count >= 0
90+
91+
subscriber_main(args.domain, args.count)

examples/connext_secure/certificate_revocation_list/c++11/USER_QOS_PROFILES.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ to use the software. -->
5252
</element>
5353
<element>
5454
<name>com.rti.serv.secure.files_poll_interval</name>
55-
<value>5000</value>
55+
<value>5</value>
5656
</element>
5757
<!--
5858
Needed to allow a previously-revoked participant to fail
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#
2+
# (c) 2024 Copyright, Real-Time Innovations, Inc. All rights reserved.
3+
#
4+
# RTI grants Licensee a license to use, modify, compile, and create derivative
5+
# works of the Software. Licensee has the right to distribute object form
6+
# only for use with RTI products. The Software is provided "as is", with no
7+
# warranty of any type, including any warranty for fitness for any purpose.
8+
# RTI is under no obligation to maintain or support the Software. RTI shall
9+
# not be liable for any incidental or consequential damages arising out of the
10+
# use or inability to use the software.
11+
#
12+
cmake_minimum_required(VERSION 3.11)
13+
project(SocketAdapterCpp)
14+
15+
# Find RTI Connext dependencies
16+
list(APPEND CMAKE_MODULE_PATH
17+
"${CMAKE_CURRENT_SOURCE_DIR}/../../../resources/cmake/Modules"
18+
)
19+
include(ConnextDdsConfigureCmakeUtils)
20+
connextdds_configure_cmake_utils()
21+
22+
find_package(
23+
RTIConnextDDS "7.3.0"
24+
REQUIRED
25+
COMPONENTS
26+
core
27+
routing_service
28+
)
29+
30+
# It may not be necessary to include the hpp files
31+
add_library(${PROJECT_NAME}
32+
"${CMAKE_CURRENT_SOURCE_DIR}/src/SocketAdapter.cxx"
33+
"${CMAKE_CURRENT_SOURCE_DIR}/src/SocketAdapter.hpp"
34+
"${CMAKE_CURRENT_SOURCE_DIR}/src/SocketConnection.cxx"
35+
"${CMAKE_CURRENT_SOURCE_DIR}/src/SocketConnection.hpp"
36+
"${CMAKE_CURRENT_SOURCE_DIR}/src/SocketInputDiscoveryStreamReader.cxx"
37+
"${CMAKE_CURRENT_SOURCE_DIR}/src/SocketInputDiscoveryStreamReader.hpp"
38+
"${CMAKE_CURRENT_SOURCE_DIR}/src/SocketStreamReader.cxx"
39+
"${CMAKE_CURRENT_SOURCE_DIR}/src/SocketStreamReader.hpp"
40+
"${CMAKE_CURRENT_SOURCE_DIR}/src/UdpSocket.cxx"
41+
"${CMAKE_CURRENT_SOURCE_DIR}/src/UdpSocket.hpp"
42+
)
43+
44+
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
45+
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
46+
47+
target_link_libraries(${PROJECT_NAME}
48+
RTIConnextDDS::routing_service_infrastructure
49+
RTIConnextDDS::cpp2_api
50+
)
51+
52+
# To differentiate between debug and release builds
53+
set_target_properties(${PROJECT_NAME}
54+
PROPERTIES
55+
DEBUG_POSTFIX "d"
56+
)

0 commit comments

Comments
 (0)