Code Mappings Editor
Configure DDS application inports and outports as DataReaders and DataWriters
Description
The Code Mappings editor is a graphical interface where you can configure inports and outports as DataReaders and DataWriters in a DDS application.
To configure the inports and outports, use the Code Mappings editor panes:
Inports
Outports
Open the Code Mappings Editor
Open a model in the DDS Blockset app. On the DDS tab, click Code Interface and select Individual Element Code Mappings.
Open a model in the DDS Blockset app. The Code Mappings editor appears as a minimized tab directly below the model canvas. Click the tab to expand the editor.
Examples
Configure DataReaders and DataWriters by Using Default Behavior
This example uses the Shapes Demo example model to show how to configure the DataReaders and DataWriters for a DDS application by using default behavior.
Open the Shapes Demo example model,
shapesdemo
.Create DDS definitions. In the DDS Application Quick Start, on the second page, select Create and use default dictionary.
Open the Code Mappings editor. On the DDS tab, click Code Interface and select Individual Element Code Mappings.
Configure the inports. The inports represent DataReaders in a DDS application.
Select the Topic. Set the Topic to the Square Topic specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Square
).Select the DataReader. Set the Reader XML Path to
Auto
to have DDS Blockset automatically generate a reader for the application.Select the Quality of Service (QoS). Set the Reader QoS to
Default
to have the reader use the vendor provided QoS.
Configure the outports. The outports represent DataWriters in a DDS application.
Select the Topic. Set the Topic to the Circle Topic specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Circle
).Select the DataWriter. Set the Writer XML Path to
Auto
to have DDS Blockset automatically generate a reader for the application.Select the Quality of Service (QoS). Set the Writer QoS to
Default
to have the reader use the vendor provided QoS.
Set up the build environment for your target vendor.
On the DDS tab, click Build.
Deploy the application executable on DDS.
Configure DataReaders and DataWriters by Using XML Definitions
This example uses the Shapes Demo example model to show how to configure the DataReaders and DataWriters for a DDS application by using definitions previously specified in imported XML definitions.
Open the Shapes Demo example model,
shapesdemo
.Create DDS definitions. In the DDS Application Quick Start, select Import from XML, and select the
shapesexample_qos
XML file. When you close the Quick Start, the DDS DataReader and DataWriter definitions from theshapesexample_qos
XML file become available in the DDS Dictionary for the example application.
Open the Code Mappings editor. On the DDS tab, click Code Interface and select Individual Element Code Mappings.
Configure the inports. The inports represent DataReaders in a DDS application. The Topic, DataReader, and QoS for each inport appears in the editor based on the imported XML definitions.
Verify the Topic. For the Topic, verify that the Square Topic specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Circle
) is shown in the editor.Verify the DataReader. For the Reader XML Path, verify that the DataReader,
MySquareRdr
, specified by its path (myParticipant/MySubscriber/MySquareRdr
).Configure the Quality of Service (QoS). Set the Reader QoS to
Default
to have the reader use the vendor provided QoS.
Configure the outports. The outports represent DataWriters in a DDS application.The Topic, DataWriter, and QoS for each outport appears in the editor based on the imported XML definitions.
Verify the Topic. For the Topic, verify that the Circle Topic is specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Circle
).Verify the DataWriter. For the Writer XML Path, verify that the DataWriter,
MyCircleWtr
, specified by its path (myParticipant/MySubscriber/MyCircleWtr
).Configure the Quality of Service (QoS). Set the Writer QoS to
Default
to have the writer use the vendor provided QoS.
Set up the build environment for your target vendor.
On the DDS tab, click Build.
Deploy the application executable on DDS.
Related Examples
Parameters
InportsSource
— Root-level Inport block or bus element
character vector
Identifies a root-level Inport block or an element of an In Bus Element block in the model. Inports map to DataReaders in DDS applications.
Topic
— Specifies the Topic that a DDS application subscribes to
character vector
Select a Topic for each DataReader.
Reader XML Path
— Specifies the DataReader
character vector
Select or generate a DataReader for each inport.
Reader QoS
— Specifies the QoS for the DataReader
character vector
Select the QoS for the DataReader for each inport.
Source
— Name of root Outport block or bus element
character vector
Identifies a root-level DDS Outport block or an element of an Out Bus Element block in the model. Outports map to DataWriters in DDS applications.
Topic
— Specifies the Topic that a DDS application publishes
character vector
Select a Topic for each DataWriter.
Writer XML Path
— Specifies the DataWriter
character vector
Select or generate a DataWriter for each outport.
Writer QoS
— Specifies the QoS for the DataWriter
character vector
Select the QoS for the DataWriter for each outport.
Version History
Introduced in R2021a