21 |
22 |
23 |
24 |
25 | The Connext Python API can be installed with `pip` as follows:
26 |
27 | ```
28 | pip install rti.connext
29 | ```
30 |
31 | See the [Connext Getting Started Guide](https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds_professional/getting_started_guide/index.html)
32 | for more information to install the software and run your first RTI Connext Python application while learning general concepts of Connext.
33 |
34 | Note: starting with Connext 7.2.0, the Connext Python API is **no longer
35 | distributed as buildable source**. This repository only contains the source for older versions.
--------------------------------------------------------------------------------
/docs/Dockerfile:
--------------------------------------------------------------------------------
1 | # (c) 2022 Copyright, Real-Time Innovations, Inc. All rights reserved.
2 | # No duplications, whole or partial, manual or electronic, may be made
3 | # without express written permission. Any such copies, or revisions thereof,
4 | # must display this notice unaltered.
5 | # This code contains trade secrets of Real-Time Innovations, Inc.
6 | FROM quay.io/pypa/manylinux2014_x86_64
7 | ARG USER_NAME=jenkins
8 | ARG USER_UID
9 |
10 | RUN adduser $USER_NAME -u $USER_UID
11 | COPY requirements.txt .
12 | RUN /opt/python/cp38-cp38/bin/pip install -r requirements.txt
13 |
14 | ENV PATH=/home/jenkins/.local/bin:/opt/python/cp38-cp38/bin:$PATH
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = source
9 | BUILDDIR = build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=source
11 | set BUILDDIR=build
12 |
13 | if "%1" == "" goto help
14 |
15 | %SPHINXBUILD% >NUL 2>NUL
16 | if errorlevel 9009 (
17 | echo.
18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19 | echo.installed, then set the SPHINXBUILD environment variable to point
20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
21 | echo.may add the Sphinx directory to PATH.
22 | echo.
23 | echo.If you don't have Sphinx installed, grab it from
24 | echo.http://sphinx-doc.org/
25 | exit /b 1
26 | )
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | --index-url https://repo.rti.com/artifactory/api/pypi/pypi/simple
2 | Sphinx==2.4.4
3 | m2r==0.2.1
4 | mistune==0.8.4
5 | docutils==0.16
6 | sphinx-autodoc-typehints==1.10.3
7 | sphinxcontrib-programoutput==0.16
8 | sphinx-tabs==1.2.1
9 | sphinx-rtd-theme==0.4.3
10 | sphinxemoji==0.1.8
11 | Jinja2==3.0
--------------------------------------------------------------------------------
/docs/source/_static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rticommunity/connextdds-py/f9c30bb5d33353db36ba38a44bdf88b7c993dc89/docs/source/_static/favicon.ico
--------------------------------------------------------------------------------
/docs/source/_static/py-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rticommunity/connextdds-py/f9c30bb5d33353db36ba38a44bdf88b7c993dc89/docs/source/_static/py-logo.png
--------------------------------------------------------------------------------
/docs/source/_static/rti-logo-FINALv2-White-OrangeDot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rticommunity/connextdds-py/f9c30bb5d33353db36ba38a44bdf88b7c993dc89/docs/source/_static/rti-logo-FINALv2-White-OrangeDot.png
--------------------------------------------------------------------------------
/docs/source/_static/rti-logo-tag-StackedRight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rticommunity/connextdds-py/f9c30bb5d33353db36ba38a44bdf88b7c993dc89/docs/source/_static/rti-logo-tag-StackedRight.png
--------------------------------------------------------------------------------
/docs/source/_static/theme_overrides.css:
--------------------------------------------------------------------------------
1 |
2 | .wy-nav-content {
3 | max-width: 950px;
4 | }
5 |
6 | .wy-table-responsive table td,
7 | .wy-table-responsive table th {
8 | white-space: initial;
9 | }
10 |
11 | .wy-side-nav-search {
12 | background: #004C97;
13 | }
14 |
15 | .rst-content .definition-alert .admonition-title {
16 | background: #ed8b00
17 | }
18 |
19 | .rst-content .definition-alert {
20 | background: #fed8b1
21 | }
22 |
23 | /* override table width restrictions */
24 | @media screen and (min-width: 767px) {
25 |
26 | .wy-table-responsive table td {
27 | /* !important prevents the common CSS stylesheets from overriding
28 | this as on RTD they are loaded after this stylesheet */
29 | white-space: normal !important;
30 | }
31 |
32 | .wy-table-responsive {
33 | overflow: visible !important;
34 | }
35 | }
--------------------------------------------------------------------------------
/docs/source/examples.rst:
--------------------------------------------------------------------------------
1 | .. py:currentmodule:: rti.connextdds
2 |
3 | Examples
4 | ~~~~~~~~
5 |
6 | In addition to the code snippets in the
7 | `RTI Connext Getting Started Guide `_
8 | and the :ref:`overview:API Overview`, you can find more examples here:
9 |
10 | - `connextdds-py repository `_
11 | - `rticonnextdds-examples repository `_
12 |
--------------------------------------------------------------------------------
/docs/source/hello.rst:
--------------------------------------------------------------------------------
1 | .. py:currentmodule:: rti.connextdds
2 |
3 | Hello World
4 | ~~~~~~~~~~~
5 |
6 | This section shows the basic code to publish and subscribe to a topic defined
7 | by a simple data type. Similar code can be generated by *rtiddsgen* from an IDL
8 | or XML file defining your data types. The sections that follow expand on the
9 | concepts shown in this example.
10 |
11 | Define your types:
12 |
13 | .. code-block:: python
14 |
15 | # hello.py
16 |
17 | import rti.types as idl
18 |
19 | @idl.struct
20 | class HelloWorld:
21 | message: str = ""
22 |
23 | Create a *DataWriter* to publish the HelloWorld Topic:
24 |
25 | .. code-block:: python
26 |
27 | # hello_publisher.py
28 |
29 | import time
30 | import rti.connextdds as dds
31 | from hello import HelloWorld
32 |
33 | participant = dds.DomainParticipant(domain_id=0)
34 | topic = dds.Topic(participant, 'HelloWorld Topic', HelloWorld)
35 | writer = dds.DataWriter(participant.implicit_publisher, topic)
36 |
37 | for i in range(10):
38 | writer.write(HelloWorld(message=f'Hello World! #{i}'))
39 | time.sleep(1)
40 |
41 | Create a *DataReader* to subscribe to the HelloWorld Topic:
42 |
43 | .. code-block:: python
44 |
45 | # hello_subscriber.py
46 |
47 | import rti.connextdds as dds
48 | import rti.asyncio
49 | from hello import HelloWorld
50 |
51 | participant = dds.DomainParticipant(domain_id=0)
52 | topic = dds.Topic(participant, 'HelloWorld Topic', HelloWorld)
53 | reader = dds.DataReader(participant.implicit_subscriber, topic)
54 |
55 | async def print_data():
56 | async for data in reader.take_data_async():
57 | print(f"Received: {data}")
58 |
59 | rti.asyncio.run(print_data())
60 |
61 | Continue to the next sections to learn about a
62 | :ref:`participant:DomainParticipant`, :ref:`topic:Topics`,
63 | :ref:`writer:Publications`, :ref:`reader:Subscriptions`,
64 | and :ref:`types:Data Types`.
--------------------------------------------------------------------------------
/docs/source/index.rst:
--------------------------------------------------------------------------------
1 | ######################################
2 | Welcome to the RTI Connext Python API!
3 | ######################################
4 |
5 | **RTI® Connext®** is a connectivity framework for building distributed
6 | applications with requirements for high performance and scalability.
7 |
8 | The **RTI Connext Python API** provides access to most Connext features from
9 | Python.
10 |
11 | .. attention::
12 |
13 | This release of the Connext Python API is experimental and provided as
14 | buildable source. As an experimental release, it cannot be used in
15 | production systems and is subject to change. A production-ready release is
16 | expected in the future.
17 |
18 | Getting Started
19 | ===============
20 |
21 | The `RTI Connext Getting Started Guide `_
22 | helps you install the software and run your first RTI Connext Python application
23 | while learning general concepts of Connext.
24 |
25 | To learn more about the Python API, see :ref:`overview:API Overview`; you can
26 | start with the :ref:`hello:Hello World` example.
27 |
28 | If you're looking for specific documentation, check out the :ref:`quick:Quick Reference`,
29 | or the full :ref:`API reference `.
30 |
31 | Contents
32 | ========
33 |
34 |
35 | .. toctree::
36 | :maxdepth: 2
37 |
38 | building.rst
39 | overview.rst
40 | quick.rst
41 | API Reference
42 | examples.rst
43 | copyright.rst
44 |
45 |
46 | Additional documentation
47 | ========================
48 |
49 | For more documentation, including the Connext User's Manual and the reference
50 | for the C, C++, Java and C# APIs, see `RTI Community `_.
--------------------------------------------------------------------------------
/docs/source/overview.rst:
--------------------------------------------------------------------------------
1 | .. py:currentmodule:: rti.connextdds
2 |
3 | API Overview
4 | ~~~~~~~~~~~~
5 |
6 | .. toctree::
7 | :maxdepth: 2
8 | :caption: Contents:
9 |
10 | hello
11 | participant
12 | topic
13 | writer
14 | reader
15 | types
16 | xmlapp
17 |
--------------------------------------------------------------------------------
/docs/source/participant.rst:
--------------------------------------------------------------------------------
1 | .. py:currentmodule:: rti.connextdds
2 |
3 | DomainParticipant
4 | ~~~~~~~~~~~~~~~~~
5 |
6 | *DomainParticipants* are the focal point for creating, destroying, and managing
7 | other *Connext* objects. A DDS domain is a logical network of applications:
8 | only applications that belong to the same DDS domain may communicate using
9 | *Connext*. A DDS domain is identified by a unique integer value known as a
10 | domain ID. An application participates in a DDS domain by creating a
11 | *DomainParticipant* for that domain ID.
12 |
13 | The following code creates a :class:`DomainParticipant` on domain `0`.
14 |
15 | .. code-block:: python
16 |
17 | import rti.connextdds as dds
18 | participant = dds.DomainParticipant(domain_id=0)
19 |
20 |
21 | Like all :class:`IEntity` types, *DomainParticipants* have QoS policies and
22 | listeners. The following example shows how to create a *DomainParticipant*
23 | with a specific QoS policy:
24 |
25 | .. code-block:: python
26 |
27 | qos = dds.DomainParticipantQos()
28 | qos.database.shutdown_cleanup_period = dds.Duration.from_milliseconds(10)
29 | participant = dds.DomainParticipant(domain_id=0, qos=qos)
30 |
31 |
32 | A *DomainParticipant* and its contained entities can also be created from an XML
33 | definition with the :meth:`QosProvider.create_participant_from_config` function.
34 |
35 | *DomainParticipants* (and all other *Entities*) get destroyed automatically
36 | when they are garbage collected; however, to ensure that they are destroyed at a
37 | certain point in your application, you can call ``close()`` or create them
38 | within a ``with`` block:
39 |
40 | .. code-block:: python
41 |
42 | with dds.DomainParticipant(domain_id=0) as participant:
43 | print(participant.domain_id)
44 | # ...
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/source/quick.rst:
--------------------------------------------------------------------------------
1 |
2 | .. py:currentmodule:: rti.connextdds
3 |
4 | Quick Reference
5 | ~~~~~~~~~~~~~~~
6 | This section includes links to common ``rti.connextdds`` types.
7 |
8 | See also :ref:`overview:API Overview`
9 |
10 | DDS Entities:
11 | - :class:`DomainParticipant`
12 | - :class:`Publisher`
13 | - :class:`Subscriber`
14 | - :class:`Topic`, :class:`ContentFilteredTopic`
15 | - :class:`DataReader`
16 | - :class:`DataWriter`
17 |
18 | Data types:
19 | - User types: :ref:`types:Data Types`
20 | - :ref:`rti.types:rti.types.builtin`
21 | - :class:`DynamicData`
22 |
23 | Quality of Service (QoS):
24 | - :class:`QosProvider`
25 | - :class:`DomainParticipantQos`
26 | - :class:`TopicQos`
27 | - :class:`PublisherQos`
28 | - :class:`SubscriberQos`
29 | - :class:`DataReaderQos`
30 | - :class:`DataWriterQos`
31 |
32 | Listeners:
33 | - :class:`DomainParticipantListener`
34 | - :class:`TopicListener`
35 | - :class:`PublisherListener`
36 | - :class:`SubscriberListener`
37 | - :class:`DataReaderListener`
38 | - :class:`DataWriterListener`
39 |
40 | Conditions:
41 | - :class:`WaitSet`
42 | - :class:`Condition`
43 | - :class:`GuardCondition`
44 | - :class:`StatusCondition`
45 | - :class:`ReadCondition`
46 | - :class:`QueryCondition`
47 |
48 | Full module documentation: :mod:`rti.connextdds`
49 |
--------------------------------------------------------------------------------
/docs/source/rti.asyncio.rst:
--------------------------------------------------------------------------------
1 | rti.asyncio
2 | ~~~~~~~~~~~
3 |
4 | .. note::
5 |
6 | This module requires Python 3.7 or newer
7 |
8 | This module must be imported in order to use the methods
9 | :meth:`rti.connextdds.DataReader.take_async`
10 | and :meth:`rti.connextdds.DataReader.take_data_async`.
11 |
12 | These two methods are added to the DataReader class when this module is
13 | imported.
14 |
15 | The module also defines a convenience function ``rti.asyncio.run``, which
16 | is similar to ``asyncio.run``, and can synchronously run the main async function
17 | in an application.
18 |
19 | See :ref:`reader:Subscriptions`.
20 |
21 | .. automodule:: rti.asyncio
22 | :members:
23 |
24 |
--------------------------------------------------------------------------------
/docs/source/rti.connextdds.rst:
--------------------------------------------------------------------------------
1 | rti.connextdds
2 | ~~~~~~~~~~~~~~
3 |
4 | ``rti.connextdds`` (often aliased as ``dds``) is the main package and contains
5 | the DDS API.
6 |
7 | The following is the alphabetical list of all classes in the module. For a
8 | list of the most relevant ones, see :ref:`quick:Quick Reference`.
9 |
10 | .. automodule:: rti.connextdds
11 | :members:
12 | :undoc-members:
13 | :show-inheritance:
14 | :special-members:
15 |
--------------------------------------------------------------------------------
/docs/source/rti.logging.rst:
--------------------------------------------------------------------------------
1 | rti.logging
2 | ~~~~~~~~~~~
3 |
4 | Submodules
5 | ----------
6 |
7 | rti.logging.distlog module
8 | ==========================
9 |
10 | .. automodule:: rti.logging.distlog
11 | :members:
12 | :undoc-members:
13 | :show-inheritance:
14 |
15 | rti.logging.handler module
16 | ==========================
17 |
18 | .. automodule:: rti.logging.handler
19 | :members:
20 | :undoc-members:
21 | :show-inheritance:
22 |
23 |
24 | Module contents
25 | ---------------
26 |
27 | .. automodule:: rti.logging
28 | :members:
29 | :undoc-members:
30 | :show-inheritance:
31 |
--------------------------------------------------------------------------------
/docs/source/rti.rst:
--------------------------------------------------------------------------------
1 | rti package
2 | ===========
3 |
4 | The ``rti`` package contains the following packages and modules:
5 |
6 | .. toctree::
7 | :hidden:
8 |
9 | rti.connextdds
10 | rti.types
11 | rti.asyncio
12 | rti.logging
13 |
14 | - :ref:`rti.connextdds:rti.connextdds` - the main package, containing the DDS API.
15 | - :ref:`rti.types:rti.types` - allows defining user types to be published and subscribed to.
16 | - :ref:`rti.asyncio:rti.asyncio` - adds support for asynchronous operations.
17 | - :ref:`rti.logging:rti.logging` - provides logging utilities.
18 |
19 |
--------------------------------------------------------------------------------
/docs/source/rti.types.rst:
--------------------------------------------------------------------------------
1 | rti.types
2 | ~~~~~~~~~
3 |
4 | This module defines the ``struct``, ``union``, ``enum``, ``alias``
5 | decorators that allow turning Python ``dataclasses`` into DDS topic-types.
6 |
7 | See :ref:`types:Data Types` for more information.
8 |
9 | ``rti.types`` also contains ``rti.types.builtin``.
10 |
11 | rti.types.builtin
12 | =================
13 |
14 | This submodule defines the DDS built-in types. These simple, general-purpose
15 | types are available for the user's convenience to quickly write a publisher or
16 | subscriber application.
17 |
18 |
19 | .. automodule:: rti.types.builtin
20 | :members:
21 |
22 |
--------------------------------------------------------------------------------
/docs/source/topic.rst:
--------------------------------------------------------------------------------
1 | .. py:currentmodule:: rti.connextdds
2 |
3 | Topics
4 | ~~~~~~
5 |
6 | Shared knowledge of the data types is a requirement for different
7 | applications to communicate with DDS. The applications must also
8 | share a way to identify what data is to be shared. Data (regardless of
9 | type) is uniquely distinguished by using a name called a *Topic*.
10 |
11 | *Topics* allow for *Publishers* and *Subscribers* to communicate
12 | without knowing about each other. They dynamically discover
13 | each other through *Topics*. The data that the :class:`DataReader` and
14 | :class:`DataWriter` share is described by a *Topic*.
15 |
16 | *Topics* are identified by a name, and they are associated with a type and a
17 | :class:`DomainParticipant`.
18 |
19 | The following code creates a :class:`Topic` named "Car Position" for a type ``Point``:
20 |
21 | .. code-block:: python
22 |
23 | topic = dds.Topic(participant, "Car Position", Point)
24 |
25 | Where ``Point`` can be defined in IDL as:
26 |
27 | .. code-block:: idl
28 |
29 | struct Point {
30 | int64 x;
31 | int64 y;
32 | };
33 |
34 | And in Python as follows:
35 |
36 | .. code-block:: python
37 |
38 | import rti.types as idl
39 |
40 | @idl.struct
41 | class Point:
42 | x: int = 0
43 | y: int = 0
44 |
45 | :ref:`types:Data Types` explains how to define your types in more detail.
46 |
47 | Special Topics
48 | --------------
49 |
50 | In addition to the class :class:`Topic`, there are a few separate Topic classes
51 | for certain types:
52 |
53 | * For ``DynamicData`` *Topics*: :class:`DynamicData.Topic` (see :ref:`types:DynamicType and DynamicData`)
54 | * For the built-in discovery *Topics*: :class:`ParticipantBuiltinTopicData.Topic`, :class:`SubscriptionBuiltinTopicData.Topic`, :class:`PublicationBuiltinTopicData.Topic`, :class:`TopicBuiltinTopicData.Topic`
55 |
56 |
--------------------------------------------------------------------------------
/docs/source/writer.rst:
--------------------------------------------------------------------------------
1 | .. py:currentmodule:: rti.connextdds
2 |
3 | Publications
4 | ~~~~~~~~~~~~
5 |
6 | An application uses *DataWriters* to send data. A *DataWriter*
7 | is associated with a single *Topic*. You can have multiple
8 | *DataWriters* and *Topics* in a single application. In addition,
9 | you can have more than one *DataWriter* for a particular *Topic*
10 | in a single application. *Publishers* own and manage *DataWriters*.
11 |
12 | To create a *DataWriter*, you need a *Topic* (see :ref:`topic:Topics`)
13 | and a :ref:`participant:DomainParticipant`. Additionally,
14 | you may add a QoS parameter and a listener.
15 |
16 | The following code creates a :class:`DataWriter` for the *Topic*
17 | we created in the :ref:`topic:Topics` section:
18 |
19 | .. code-block:: python
20 |
21 | publisher = dds.Publisher(participant)
22 | writer = dds.DataWriter(publisher, topic)
23 |
24 | To publish data, create a sample, set the values, and write it:
25 |
26 | .. code-block:: python
27 |
28 | data = Point(x=1, y=2)
29 | writer.write(data)
30 |
31 | A special DataWriter type for DynamicData, :class:`DynamicData.DataWriter` is
32 | also available. Find more information in :ref:`types:DynamicType and DynamicData`.
--------------------------------------------------------------------------------
/examples/builtin_topics/msg.idl:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2013-2019 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 |
13 | struct msg {
14 | short x;
15 | };
16 |
--------------------------------------------------------------------------------
/examples/builtin_topics/msg.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/examples/coherent_presentation/coherent.idl:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2014-2019 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 |
13 | struct coherent {
14 | @key long id;
15 | char field;
16 | long value;
17 | };
18 |
--------------------------------------------------------------------------------
/examples/coherent_presentation/coherent.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/coherent_presentation/coherent_subscriber.py:
--------------------------------------------------------------------------------
1 | import rti.connextdds as dds
2 | import time
3 | import argparse
4 |
5 | try:
6 | xrange
7 | except NameError:
8 | xrange = range
9 |
10 |
11 | # The listener for a coherent set will only output when a set is received
12 | class CoherentListener(dds.DynamicData.NoOpDataReaderListener):
13 | def on_data_available(self, reader):
14 | print("Received updates:")
15 | for data in reader.take_data():
16 | print(" {} = {};".format(data["field"], data["value"]))
17 |
18 |
19 | def subscriber_main(domain_id, sample_count):
20 | participant = dds.DomainParticipant(domain_id)
21 |
22 | subscriber_qos = dds.QosProvider.default.subscriber_qos
23 | subscriber = dds.Subscriber(participant, subscriber_qos)
24 |
25 | coherent_type = dds.QosProvider("coherent.xml").type("coherent_lib", "coherent")
26 | topic = dds.DynamicData.Topic(participant, "Example coherent", coherent_type)
27 | datareader_qos = dds.QosProvider.default.datareader_qos
28 | reader = dds.DynamicData.DataReader(subscriber, topic, datareader_qos)
29 | reader.set_listener(CoherentListener(), dds.StatusMask.DATA_AVAILABLE)
30 |
31 | count = 0
32 | while (sample_count == 0) or (count < sample_count):
33 | time.sleep(1)
34 |
35 |
36 | if __name__ == "__main__":
37 | parser = argparse.ArgumentParser(
38 | description="RTI Connext DDS Example: Using Coherent Presentation (Subscriber)"
39 | )
40 | parser.add_argument("-d", "--domain", type=int, default=0, help="DDS Domain ID")
41 | parser.add_argument(
42 | "-c", "--count", type=int, default=0, help="Number of samples to send"
43 | )
44 |
45 | args = parser.parse_args()
46 | assert 0 <= args.domain < 233
47 | assert args.count >= 0
48 |
49 | subscriber_main(args.domain, args.count)
50 |
--------------------------------------------------------------------------------
/examples/content_filtered_topic/cft_publisher.py:
--------------------------------------------------------------------------------
1 | #
2 | # (c) 2022 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 solely for use with RTI products. The Software is
6 | # provided "as is", with no warranty of any type, including any warranty for
7 | # fitness for any purpose. RTI is under no obligation to maintain or support
8 | # the Software. RTI shall not be liable for any incidental or consequential
9 | # damages arising out of the use or inability to use the software.
10 | #
11 |
12 | import rti.connextdds as dds
13 | from test_type import CftExample
14 | import time
15 | import argparse
16 |
17 |
18 | def publisher_main(domain_id, sample_count):
19 | participant = dds.DomainParticipant(domain_id)
20 |
21 | topic = dds.Topic(participant, "Example cft", CftExample)
22 | writer = dds.DataWriter(participant.implicit_publisher, topic)
23 |
24 | sample = CftExample()
25 |
26 | # Output "ones" digit of count as 'x' field
27 | count = 0
28 | while sample_count == 0 or count < sample_count:
29 | sample.count = count
30 | sample.x = count % 10
31 | print(f"Writing cft, {sample}")
32 | writer.write(sample)
33 | time.sleep(1)
34 | count += 1
35 |
36 |
37 | if __name__ == "__main__":
38 | parser = argparse.ArgumentParser(
39 | description="RTI Connext DDS Example: Using CFTs (Publisher)"
40 | )
41 | parser.add_argument("-d", "--domain", type=int, default=0, help="DDS Domain ID")
42 | parser.add_argument(
43 | "-c", "--count", type=int, default=0, help="Number of samples to send"
44 | )
45 |
46 | args = parser.parse_args()
47 | assert 0 <= args.domain < 233
48 | assert args.count >= 0
49 |
50 | publisher_main(args.domain, args.count)
51 |
--------------------------------------------------------------------------------
/examples/content_filtered_topic/test_type.py:
--------------------------------------------------------------------------------
1 | #
2 | # (c) 2022 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 solely for use with RTI products. The Software is
6 | # provided "as is", with no warranty of any type, including any warranty for
7 | # fitness for any purpose. RTI is under no obligation to maintain or support
8 | # the Software. RTI shall not be liable for any incidental or consequential
9 | # damages arising out of the use or inability to use the software.
10 | #
11 |
12 | import rti.types as idl
13 |
14 | @idl.struct
15 | class CftExample:
16 | x: int = 0
17 | count: int = 0
18 |
--------------------------------------------------------------------------------
/examples/content_filtered_topic_string_filter/cft.idl:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2014-2019 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 |
13 | struct cft {
14 | long count;
15 | @key string name;
16 | };
17 |
--------------------------------------------------------------------------------
/examples/content_filtered_topic_string_filter/cft.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/content_filtered_topic_string_filter/cft_publisher.py:
--------------------------------------------------------------------------------
1 | """
2 | (c) 2020 Copyright, Real-Time Innovations, Inc. All rights reserved.
3 | RTI grants Licensee a license to use, modify, compile, and create derivative
4 | works of the Software. Licensee has the right to distribute object form only
5 | for use with RTI products. The Software is provided "as is", with no warranty
6 | of any type, including any warranty for fitness for any purpose. RTI is under
7 | no 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 to
9 | use the software.
10 | """
11 |
12 | import rti.connextdds as dds
13 | import time
14 | import argparse
15 |
16 |
17 | def publisher_main(domain_id, sample_count):
18 | participant = dds.DomainParticipant(domain_id)
19 |
20 | cft_type = dds.QosProvider("cft.xml").type("cft_lib", "cft")
21 | topic = dds.DynamicData.Topic(participant, "Example cft", cft_type)
22 |
23 | writer_qos = dds.QosProvider.default.datawriter_qos
24 | writer = dds.DynamicData.DataWriter(dds.Publisher(participant), topic, writer_qos)
25 |
26 | sample = dds.DynamicData(cft_type)
27 |
28 | count = 0
29 | while (sample_count == 0) or (count < sample_count):
30 | print("Writing cft, count={}".format(count))
31 | sample["count"] = count
32 | sample["name"] = "ODD" if count % 2 == 1 else "EVEN"
33 | writer.write(sample)
34 | time.sleep(1)
35 | count += 1
36 |
37 |
38 | if __name__ == "__main__":
39 | parser = argparse.ArgumentParser(
40 | description="RTI Connext DDS Example: Using String Filters (Publisher)"
41 | )
42 | parser.add_argument("-d", "--domain", type=int, default=0, help="DDS Domain ID")
43 | parser.add_argument(
44 | "-c", "--count", type=int, default=0, help="Number of samples to send"
45 | )
46 |
47 | args = parser.parse_args()
48 | assert 0 <= args.domain < 233
49 | assert args.count >= 0
50 |
51 | publisher_main(args.domain, args.count)
52 |
--------------------------------------------------------------------------------
/examples/custom_content_filter/ccf.idl:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2014-2019 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 |
13 | struct Foo {
14 | long x;
15 | };
16 |
--------------------------------------------------------------------------------
/examples/custom_content_filter/ccf.py:
--------------------------------------------------------------------------------
1 | import rti.connextdds as dds
2 |
3 |
4 | class CustomFilterType(dds.DynamicData.ContentFilter):
5 | def __init__(self):
6 | super(CustomFilterType, self).__init__()
7 |
8 | def compile(
9 | self, expression, parameters, type_code, type_class_name, old_compile_data
10 | ):
11 | if not expression.startswith("%0 %1 "):
12 | raise ValueError("Invalid filter expression")
13 | if len(expression) < 7:
14 | raise ValueError("Invalid filter expression length")
15 | if len(parameters) < 2:
16 | raise ValueError("Invalid number of filter parameters")
17 |
18 | if parameters[1] == "greater-than":
19 | cd = (int(parameters[0]), lambda sample_data, p: p > sample_data)
20 | elif parameters[1] == "divides":
21 | cd = (int(parameters[0]), lambda sample_data, p: sample_data % p == 0)
22 | else:
23 | raise ValueError("Invalid filter operation")
24 |
25 | return cd
26 |
27 | def evaluate(self, compile_data, sample, meta_data):
28 | return compile_data[1](sample["x"], compile_data[0])
29 |
30 | def finalize(self, compile_data):
31 | pass
32 |
--------------------------------------------------------------------------------
/examples/custom_content_filter/ccf.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/examples/custom_content_filter/ccf_publisher.py:
--------------------------------------------------------------------------------
1 | """
2 | (c) 2020 Copyright, Real-Time Innovations, Inc. All rights reserved.
3 | RTI grants Licensee a license to use, modify, compile, and create derivative
4 | works of the Software. Licensee has the right to distribute object form only
5 | for use with RTI products. The Software is provided "as is", with no warranty
6 | of any type, including any warranty for fitness for any purpose. RTI is under
7 | no 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 to
9 | use the software.
10 | """
11 |
12 | import rti.connextdds as dds
13 | import ccf
14 | import time
15 | import argparse
16 |
17 |
18 | def publisher_main(domain_id, sample_count):
19 | participant = dds.DomainParticipant(domain_id)
20 |
21 | # We can register the custom filter on the writer side
22 | participant.register_contentfilter(ccf.CustomFilterType(), "CustomFilter")
23 |
24 | ccf_type = dds.QosProvider("ccf.xml").type("ccf_lib", "Foo")
25 | topic = dds.DynamicData.Topic(participant, "Example ccf", ccf_type)
26 |
27 | writer = dds.DynamicData.DataWriter(dds.Publisher(participant), topic)
28 |
29 | instance = dds.DynamicData(ccf_type)
30 |
31 | count = 0
32 | while (sample_count == 0) or (count < sample_count):
33 | print("Writing ccf, count={}".format(count))
34 | instance["x"] = count
35 | writer.write(instance)
36 | time.sleep(1)
37 | count += 1
38 |
39 |
40 | parser = argparse.ArgumentParser(
41 | description="RTI Connext DDS Example: Using Custom Filters (Publisher)"
42 | )
43 | parser.add_argument("-d", "--domain", type=int, default=0, help="DDS Domain ID")
44 | parser.add_argument(
45 | "-c", "--count", type=int, default=0, help="Number of samples to send"
46 | )
47 |
48 | args = parser.parse_args()
49 | assert 0 <= args.domain < 233
50 | assert args.count >= 0
51 |
52 | publisher_main(args.domain, args.count)
53 |
--------------------------------------------------------------------------------
/examples/dynamic_data_access_union_discriminator/dynamic_data_union_example.py:
--------------------------------------------------------------------------------
1 | """
2 | (c) 2020 Copyright, Real-Time Innovations, Inc. All rights reserved.
3 | RTI grants Licensee a license to use, modify, compile, and create derivative
4 | works of the Software. Licensee has the right to distribute object form only
5 | for use with RTI products. The Software is provided "as is", with no warranty
6 | of any type, including any warranty for fitness for any purpose. RTI is under
7 | no 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 to
9 | use the software.
10 | """
11 |
12 | import rti.connextdds as dds
13 |
14 |
15 | # Create a union type with three possible fields
16 | def create_union_type():
17 | return dds.UnionType(
18 | "Foo",
19 | dds.Int32Type(),
20 | [
21 | dds.UnionMember("aShort", dds.Int16Type(), 0),
22 | dds.UnionMember("aLong", dds.Int32Type(), dds.UnionMember.DEFAULT_LABEL),
23 | dds.UnionMember("aDouble", dds.Float64Type(), 3),
24 | ],
25 | )
26 |
27 |
28 | if __name__ == "__main__":
29 | union_type = create_union_type()
30 |
31 | union_data = dds.DynamicData(union_type)
32 |
33 | # Set the selected field by writing a value
34 | union_data["aLong"] = 0
35 | info = union_data.member_info(union_data.discriminator_value)
36 | print("The member selected is {}".format(info.name))
37 |
38 | # Change the selected field by updating a different one
39 | union_data["aShort"] = 42
40 | info = union_data.member_info(union_data.discriminator_value)
41 | print(
42 | "The member selected is {} with value {}".format(
43 | info.name, union_data[union_data.discriminator_value]
44 | )
45 | )
46 |
--------------------------------------------------------------------------------
/examples/request_reply/Primes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/examples/waitset_query_cond/README.txt:
--------------------------------------------------------------------------------
1 | QueryCondition example
2 | ----------------------
3 |
4 | This example has one publisher application (waitset_query_cond_publisher.py)
5 | and a subscriber application. There are two equivalent versions of the
6 | subscriber application:
7 | - waitset_query_cond_subscriber.py - uses a WaitSet to wait for data
8 | - async_take_query_condition.py - uses async operations (take_data_async)
9 |
10 | The example type is defined in IDL in waitset_query_cond.idl and its Python
11 | definition is in waitset_query_cond.py.
--------------------------------------------------------------------------------
/examples/waitset_query_cond/waitset_query_cond.idl:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2014-2019 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 |
13 | struct waitset_query_cond {
14 | short x;
15 | @key string name;
16 | };
17 |
--------------------------------------------------------------------------------
/examples/waitset_query_cond/waitset_query_cond.py:
--------------------------------------------------------------------------------
1 |
2 | # WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
3 |
4 | # This file was generated from waitset_query_cond.idl
5 | # using RTI Code Generator (rtiddsgen) version 4.0.0.
6 | # The rtiddsgen tool is part of the RTI Connext DDS distribution.
7 | # For more information, type 'rtiddsgen -help' at a command shell
8 | # or consult the Code Generator User's Manual.
9 |
10 | from dataclasses import field
11 | from typing import Union, Sequence, Optional
12 | import rti.idl as idl
13 | from enum import IntEnum
14 |
15 |
16 | @idl.struct(
17 | member_annotations = {
18 | 'name': [idl.key, idl.bound(255)],
19 | }
20 | )
21 | class waitset_query_cond:
22 | x: idl.int16 = 0
23 | name: str = ""
24 |
--------------------------------------------------------------------------------
/examples/waitset_query_cond/waitset_query_cond.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/waitset_query_cond/waitset_query_cond_publisher.py:
--------------------------------------------------------------------------------
1 | """
2 | (c) 2020 Copyright, Real-Time Innovations, Inc. All rights reserved.
3 | RTI grants Licensee a license to use, modify, compile, and create derivative
4 | works of the Software. Licensee has the right to distribute object form only
5 | for use with RTI products. The Software is provided "as is", with no warranty
6 | of any type, including any warranty for fitness for any purpose. RTI is under
7 | no 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 to
9 | use the software.
10 | """
11 |
12 | import time
13 | import argparse
14 |
15 | import rti.connextdds as dds
16 |
17 | from waitset_query_cond import waitset_query_cond
18 |
19 |
20 | def publisher_main(domain_id, sample_count):
21 | participant = dds.DomainParticipant(domain_id)
22 |
23 | topic = dds.Topic(
24 | participant, "Example waitset_query_cond", waitset_query_cond)
25 | writer = dds.DataWriter(dds.Publisher(participant), topic)
26 |
27 | instance = waitset_query_cond()
28 |
29 | count = 0
30 | while (sample_count == 0) or (count < sample_count):
31 | print("Writing waitset_query_cond, count = {}".format(count))
32 | instance.x = count
33 | instance.name = "ODD" if count % 2 == 1 else "EVEN"
34 |
35 | writer.write(instance)
36 | count += 1
37 | time.sleep(1)
38 |
39 |
40 | if __name__ == "__main__":
41 | parser = argparse.ArgumentParser(
42 | description="RTI Connext DDS Example: Waitsets with Query Conditions (Publisher)"
43 | )
44 | parser.add_argument("-d", "--domain", type=int, default=0, help="DDS Domain ID")
45 | parser.add_argument(
46 | "-c", "--count", type=int, default=0, help="Number of samples to send"
47 | )
48 |
49 | args = parser.parse_args()
50 | assert 0 <= args.domain < 233
51 | assert args.count >= 0
52 |
53 | publisher_main(args.domain, args.count)
54 |
--------------------------------------------------------------------------------
/examples/waitset_status_cond/waitset_cond.idl:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2014-2019 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 |
13 | struct Foo {
14 | short x;
15 | };
16 |
--------------------------------------------------------------------------------
/examples/waitset_status_cond/waitset_cond.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/examples/waitset_status_cond/waitset_cond_publisher.py:
--------------------------------------------------------------------------------
1 | """
2 | (c) 2020 Copyright, Real-Time Innovations, Inc. All rights reserved.
3 | RTI grants Licensee a license to use, modify, compile, and create derivative
4 | works of the Software. Licensee has the right to distribute object form only
5 | for use with RTI products. The Software is provided "as is", with no warranty
6 | of any type, including any warranty for fitness for any purpose. RTI is under
7 | no 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 to
9 | use the software.
10 | """
11 |
12 | import rti.connextdds as dds
13 | import time
14 | import argparse
15 |
16 |
17 | def publisher_main(domain_id, sample_count):
18 | participant = dds.DomainParticipant(domain_id)
19 |
20 | wssc_type = dds.QosProvider("waitset_cond.xml").type("wssc_lib", "Foo")
21 | topic = dds.DynamicData.Topic(participant, "Example Foo", wssc_type)
22 | writer = dds.DynamicData.DataWriter(dds.Publisher(participant), topic)
23 |
24 | sample = dds.DynamicData(wssc_type)
25 |
26 | count = 0
27 | while (sample_count == 0) or (count < sample_count):
28 | print("Writing Foo, count = {}".format(count))
29 | sample["x"] = count
30 | writer.write(sample)
31 |
32 | count += 1
33 | time.sleep(1)
34 |
35 | if __name__ == "__main__":
36 | parser = argparse.ArgumentParser(
37 | description="RTI Connext DDS Example: Waitsets with Status Condition & Read Condition (Publisher)"
38 | )
39 | parser.add_argument("-d", "--domain", type=int, default=0, help="DDS Domain ID")
40 | parser.add_argument(
41 | "-c", "--count", type=int, default=0, help="Number of samples to send"
42 | )
43 |
44 | args = parser.parse_args()
45 | assert 0 <= args.domain < 233
46 | assert args.count >= 0
47 |
48 | publisher_main(args.domain, args.count)
49 |
--------------------------------------------------------------------------------
/format.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | find connextdds/ -iname *.cpp -o -iname *.hpp | xargs clang-format -i -style=file
3 |
--------------------------------------------------------------------------------
/modules/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | project(connext-py)
3 | include(CheckCXXCompilerFlag)
4 |
5 | file(TO_CMAKE_PATH ${CONNEXTDDS_DIR} CONNEXTDDS_DIR)
6 | if (Python_ROOT_DIR)
7 | file(TO_CMAKE_PATH ${Python_ROOT_DIR} Python_ROOT_DIR)
8 | endif()
9 |
10 | list(APPEND CMAKE_FIND_ROOT_PATH
11 | ${CONNEXTDDS_DIR}
12 | ${CONNEXTDDS_DIR}/bin
13 | ${CONNEXTDDS_DIR}/lib/$ENV{CONNEXTDDS_ARCH}
14 | ${CONNEXTDDS_DIR}/include/ndds)
15 |
16 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../resources/cmake")
17 |
18 | if(UNIX AND NOT APPLE)
19 | set(CMAKE_SKIP_RPATH OFF)
20 | set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
21 | set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
22 | endif()
23 |
24 | if(APPLE)
25 | set(CMAKE_SKIP_RPATH OFF)
26 | set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
27 | endif()
28 |
29 | string(TOUPPER ${CMAKE_BUILD_TYPE} RTI_LIB_BUILD_TYPE)
30 |
31 | if(${RTI_LIB_BUILD_TYPE} STREQUAL "DEBUG")
32 | set(RTI_DEBUG_SUFFIX "d")
33 | endif()
34 |
35 | check_cxx_compiler_flag(-std=c++17 HAVE_FLAG_STD_CXX17)
36 | check_cxx_compiler_flag(-std=c++14 HAVE_FLAG_STD_CXX14)
37 |
38 | add_subdirectory(connextdds)
39 | add_subdirectory(distlog)
40 | add_subdirectory(request)
41 |
--------------------------------------------------------------------------------
/modules/connextdds/include/IdlContentFilteredTopic.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2022 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 |
14 | #include "PyConnext.hpp"
15 | #include "PyContentFilteredTopic.hpp"
16 | #include "IdlTypeSupport.hpp"
17 |
18 | namespace pyrti {
19 |
20 | using PyIdlContentFilteredTopic =
21 | PyContentFilteredTopic;
22 |
23 | using IdlContentFilteredTopicPyClass = py::class_<
24 | PyIdlContentFilteredTopic,
25 | PyITopicDescription,
26 | PyIAnyTopic,
27 | std::unique_ptr<
28 | PyIdlContentFilteredTopic,
29 | no_gil_delete>>;
30 |
31 | } // namespace pyrti
--------------------------------------------------------------------------------
/modules/connextdds/include/IdlDataReader.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2021 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 |
14 | #include "PyConnext.hpp"
15 | #include "IdlTopic.hpp"
16 | #include "PyDataReader.hpp"
17 |
18 |
19 | namespace pyrti {
20 |
21 | using PyIdlDataReader = PyDataReader;
22 |
23 | using IdlDataReaderPyClass = py::class_<
24 | PyIdlDataReader,
25 | PyIDataReader,
26 | std::unique_ptr>>;
27 |
28 | template<>
29 | void init_dds_typed_datareader_template(IdlDataReaderPyClass& cls);
30 |
31 | PyIdlDataReader create_idl_py_reader(
32 | const PySubscriber& subscriber,
33 | const PyTopic& topic,
34 | const PyContentFilteredTopic& cft =
35 | dds::core::null,
36 | const dds::sub::qos::DataReaderQos* qos = nullptr,
37 | PyDataReaderListenerPtr* listener =
38 | nullptr,
39 | const dds::core::status::StatusMask& mask =
40 | dds::core::status::StatusMask::none());
41 |
42 | } // namespace pyrti
--------------------------------------------------------------------------------
/modules/connextdds/include/IdlDataReaderListener.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2022 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 |
14 | #include "PyConnext.hpp"
15 | #include "PyDataReaderListener.hpp"
16 | #include "IdlTypeSupport.hpp"
17 |
18 | namespace pyrti {
19 |
20 | using PyIdlDataReaderListener = PyDataReaderListener;
21 |
22 | using IdlDataReaderListenerPyClass = py::class_<
23 | PyDataReaderListener,
24 | PyDataReaderListenerTrampoline,
25 | std::shared_ptr>>;
26 |
27 | using PyIdlNoOpDataReaderListener =
28 | PyNoOpDataReaderListener;
29 |
30 | using IdlNoOpDataReaderListenerPyClass = py::class_<
31 | PyNoOpDataReaderListener,
32 | PyDataReaderListener,
33 | PyNoOpDataReaderListenerTrampoline,
34 | std::shared_ptr>>;
35 |
36 | } // namespace pyrti
--------------------------------------------------------------------------------
/modules/connextdds/include/IdlDataWriter.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2021 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 |
14 | #include "PyConnext.hpp"
15 | #include "IdlTopic.hpp"
16 | #include "PyDataWriter.hpp"
17 |
18 | namespace pyrti {
19 |
20 | using IdlDataWriter = PyDataWriter;
21 | using IdlDataWriterPyClass = PyDataWriterClass;
22 |
23 | template<>
24 | void init_dds_typed_datawriter_template(IdlDataWriterPyClass& cls);
25 |
26 | IdlDataWriter create_idl_py_writer(
27 | const PyPublisher& publisher,
28 | const PyTopic& topic,
29 | const dds::pub::qos::DataWriterQos* qos = nullptr,
30 | PyDataWriterListenerPtr* listener = nullptr,
31 | dds::core::status::StatusMask mask =
32 | dds::core::status::StatusMask::none());
33 |
34 | } // namespace pyrti
--------------------------------------------------------------------------------
/modules/connextdds/include/IdlDataWriterListener.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2022 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 |
14 | #include "PyConnext.hpp"
15 | #include "PyDataWriterListener.hpp"
16 | #include "IdlTypeSupport.hpp"
17 |
18 | namespace pyrti {
19 |
20 | using PyIdlDataWriterListener =
21 | PyDataWriterListener;
22 |
23 | using IdlDataWriterListenerPyClass = py::class_<
24 | PyDataWriterListener,
25 | PyDataWriterListenerTrampoline,
26 | std::shared_ptr>>;
27 |
28 | using PyIdlNoOpDataWriterListener =
29 | PyNoOpDataWriterListener;
30 |
31 | using IdlNoOpDataWriterListenerPyClass = py::class_<
32 | PyNoOpDataWriterListener,
33 | PyDataWriterListener,
34 | PyNoOpDataWriterListenerTrampoline,
35 | std::shared_ptr<
36 | PyNoOpDataWriterListener>>;
37 |
38 | } // namespace pyrti
--------------------------------------------------------------------------------
/modules/connextdds/include/IdlTopicListener.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2022 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 |
14 | #include "PyConnext.hpp"
15 | #include "PyTopicListener.hpp"
16 | #include "IdlTypeSupport.hpp"
17 |
18 | namespace pyrti {
19 |
20 | using PyIdlTopicListener = PyTopicListener;
21 |
22 | using IdlTopicListenerPyClass = py::class_<
23 | PyTopicListener,
24 | PyTopicListenerTrampoline,
25 | std::shared_ptr>>;
26 |
27 | using PyIdlNoOpTopicListener = PyNoOpTopicListener;
28 |
29 | using IdlNoOpTopicListenerPyClass = py::class_<
30 | PyNoOpTopicListener,
31 | PyTopicListener,
32 | PyNoOpTopicListenerTrampoline,
33 | std::shared_ptr>>;
34 |
35 | } // namespace pyrti
--------------------------------------------------------------------------------
/modules/connextdds/include/PyAsyncioExecutor.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2020 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 |
14 | #include "PyConnext.hpp"
15 | #include
16 | #include
17 |
18 | namespace pyrti {
19 |
20 | class PYRTI_SYMBOL_HIDDEN PyAsyncioExecutor {
21 | public:
22 | template
23 | static py::object run(std::function func)
24 | {
25 | auto instance = PyAsyncioExecutor::get_instance();
26 | py::object loop = instance.get_running_loop();
27 | py::object run_in_executor = loop.attr("run_in_executor");
28 | return run_in_executor(nullptr, std::function([func]() -> T {
29 | py::gil_scoped_release release;
30 | return func();
31 | }));
32 | }
33 |
34 | private:
35 | static std::unique_ptr instance;
36 | static std::recursive_mutex lock;
37 | py::object asyncio;
38 | py::object get_running_loop;
39 |
40 | PyAsyncioExecutor();
41 | static PyAsyncioExecutor& get_instance();
42 | };
43 |
44 | } // namespace pyrti
45 |
--------------------------------------------------------------------------------
/modules/connextdds/include/PyCoreUtils.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2022 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 |
14 | #include "PyConnext.hpp"
15 |
16 | void init_core_utils(py::module&);
17 |
--------------------------------------------------------------------------------
/modules/connextdds/include/PyInitOpaqueTypeContainers.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2020 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 |
14 | #include
15 | #include
16 |
17 | #define INIT_OPAQUE_TYPE_CONTAINERS(topic_type) \
18 | PYBIND11_MAKE_OPAQUE(std::vector); \
19 | PYBIND11_MAKE_OPAQUE(std::vector>); \
20 | PYBIND11_MAKE_OPAQUE(std::vector>); \
21 | PYBIND11_MAKE_OPAQUE(std::vector>); \
22 | PYBIND11_MAKE_OPAQUE(std::vector>); \
23 | PYBIND11_MAKE_OPAQUE(std::vector>)
24 |
--------------------------------------------------------------------------------
/modules/connextdds/include/PyQosPolicy.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2020 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 | #include "PyConnext.hpp"
14 |
15 | namespace pyrti {
16 | py::object get_policy_type_from_id(py::module& m, int id);
17 | }
--------------------------------------------------------------------------------
/modules/connextdds/include/PySeq.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2020 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #pragma once
13 | #include "PyConnext.hpp"
14 | #include
15 | #include "PyBindVector.hpp"
16 |
17 | namespace pyrti {
18 |
19 | template
20 | DefInitFunc init_class_with_seq(py::object& parent, const std::string& cls_name)
21 | {
22 | py::class_ cls(parent, cls_name.c_str());
23 | pyrti::bind_vector(parent, (cls_name + "Seq").c_str());
24 | py::implicitly_convertible>();
25 |
26 | return ([cls]() mutable { init_class_defs(cls); });
27 | }
28 |
29 | template
30 | DefInitFunc init_class_with_ptr_seq(
31 | py::object& parent,
32 | const std::string& cls_name)
33 | {
34 | py::class_ cls(parent, cls_name.c_str());
35 | pyrti::bind_vector(parent, (cls_name + "Seq").c_str());
36 | py::implicitly_convertible>();
37 |
38 | return ([cls]() mutable { init_class_defs(cls); });
39 | }
40 |
41 | } // namespace pyrti
--------------------------------------------------------------------------------
/modules/connextdds/include/PyThreadContext.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2021 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 | #pragma once
12 |
13 | #include "PyConnext.hpp"
14 |
15 | #if rti_connext_version_gte(6, 0, 0, 0)
16 |
17 | namespace pyrti{
18 |
19 | class PyThreadContext {
20 | public:
21 | PyThreadContext();
22 | ~PyThreadContext();
23 | void unregister();
24 | private:
25 | bool _unregistered;
26 | };
27 |
28 | }
29 |
30 | #endif
--------------------------------------------------------------------------------
/modules/connextdds/src/dds/DDSNamespace.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2020 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #include "PyConnext.hpp"
13 | #include "PyNamespaces.hpp"
14 |
15 | void init_namespace_dds(py::module& m, pyrti::ClassInitList& l, pyrti::DefInitVector& v)
16 | {
17 | init_namespace_dds_core(m, l, v);
18 | init_namespace_dds_domain(m, l, v);
19 | init_namespace_dds_pub(m, l, v);
20 | init_namespace_dds_sub(m, l, v);
21 | init_namespace_dds_topic(m, l, v);
22 | }
23 |
--------------------------------------------------------------------------------
/modules/connextdds/src/dds/core/CoreNamespace.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) 2020 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 solely for use with RTI products. The Software is
6 | * provided "as is", with no warranty of any type, including any warranty for
7 | * fitness for any purpose. RTI is under no obligation to maintain or support
8 | * the Software. RTI shall not be liable for any incidental or consequential
9 | * damages arising out of the use or inability to use the software.
10 | */
11 |
12 | #include "PyConnext.hpp"
13 | #include "PyNamespaces.hpp"
14 | #include
15 |
16 | using namespace dds::core;
17 |
18 | void init_namespace_dds_core(py::module& m, pyrti::ClassInitList& l, pyrti::DefInitVector& v)
19 | {
20 | pyrti::process_inits(m, l);
21 | pyrti::process_inits(m, l);
22 | pyrti::process_inits(m, l);
23 | pyrti::process_inits(m, l);
24 | pyrti::process_inits(m, l);
25 | pyrti::process_inits(m, l);
26 | pyrti::process_inits(m, l);
27 | pyrti::process_inits(m, l);
28 | pyrti::process_inits(m, l);
29 | pyrti::process_inits