Add/edit Protocols for Software Interfaces
by Marco Wuelser
A Protocol defines the interface between software components. When one component sends a message to another, both must know the Protocol. A Protocol has a unique identifier and a number of fields. The fields are serialized in the given order without any padding bytes. Fields can be scalar types (integer, Boolean, floating point) or arrays of scalar types. Fields can also be Enumerations (see above) or other Protocols. In that way, complex data types can be created.
Create Protocol/Signal from Output Port
To create a new protocol or signal from an output port, right-click the output port and select "Create Protocol" from the context menu.
|
|
Figure 1 - Create Protocol/Signal from Port
Assign Protocol/Signal to output Port
To assign a protocol or signal to an output port, drag the protocol/signal from the toolbox to the port. The protocol must be first created in the Protocol Explorer. The protocol is located in the same subdirectory that was created there.
The lines at both sides of the port will turn black to indicate that a protocol/signal is assigned.
|
|
Figure 2 - Assign Protocol/Signal
NOTE
Protocols can only be assigned to output ports in the Active Part and Interrupt components. To affect the output port of an Active Container, the protocol must be assigned to the connected output port in the child diagram.
Protocol Explorer
To create a Protocol in the Protocol Explorer, follow this step-by-step guide:
- Select the group in the Protocol Explorer that should contain it.
- Press the add button and select Protocol, or select ‘Add Protocol’ from the context menu.
- Fill in the name of the Protocol
- Fill in the description of the Protocol.
- Add fields by dropping types from the Protocol Explorer to the field list in the Protocol Editor.
- Double-click the fields to edit the field name.
Step 1-2 Step 3-6 |
Figure 3 - Create Protocol
Signal
When a Protocol is created that has no fields, it is called a signal. The runtime will then only send the protocol identifier without any additional data and there is no code generated except for the identifier constant.
To create a signal, follow this step-by-step guide:
- Select the group in the Protocol Explorer that should contain it.
- Press the add button and select Protocol or select ‘Add Protocol’ from the context menu.
- Fill in the name of the signal.
- Fill in the description of the signal.
NOTE
It is recommended to add a postfix to the name of all signals, such as “Signal” or “Event”.
Step 1-2 Step 3-4 |
Figure 4 - Create Signal
Enumeration
An Enumeration can be used to define a data type that can only have a limited number of values. These values are called enumerators. The Enumeration is represented as an integer number in the program code. The number of bytes can be selected by the user but must be large enough to represent all defined enumerator values. Values can also be negative if a signed base type is selected.
To create an enumeration, follow this step-by-step guide:
- Select the group in the Protocol Explorer that should contain it.
- Press the add button and select Enumeration or select Add Enumeration from the context menu.
- Fill in the name of the Enumeration.
- Fill in the description of the Enumeration.
- Select a base type using the drop-down menu.
- Add Enumerators by entering the name and value for each enumerator.
Step 1-2 Step 3-6 |
Figure 5 - Create Enumeration
Further Articles
How To - Define Data Flow Channels
How To - Define Software Architecture
How To - Design a System - System Architecture
How To - System Decomposition - Sub-System-Architecture