Skip to end of metadata
Go to start of metadata

You can add enumerations to your model and generate code for them.

To do so, add a new class to your model and use the stereotype enumeration on this class.
If the enumeration is part of another class, the code for the enumeration will be written with the code for the file. If the enumeration is not part of a class, a new file will be generated for the enumeration.
Then define the members of the enumeration as attributes.

You can also influence the values for the generated enumeration attribute by defining a custom "Initial Value" inside the model.

All Signals used inside a State Machine will be stored in a signals enumeration. 

Signals are used to Trigger Transitions inside the State Machine.

Signals Enumeration

The signals enumeration is a special kind of enumeration in your project which contains the signals of your state machines.

A signals enumeration must - by convention - be named Signals. When generating the signals for a package, Embedded Engineer examines your package and collects all signals. It will then look for the signals enumeration and update the enumeration so that it contains all signals it collected.

If there is more than one signals enumeration in your package, Embedded Engineer will issue an error. Likewise, it will issue an error if no signals enumeration is found.
Signals added to the enumeration by Embedded Engineer are marked with the generated stereotype. When generating the signals, the following procedure takes place:

  • Signals which are new to the model and aren't part of the signals enumeration yet are added with stereotype generated
  • Signals with the stereotype generated in the enumeration, for which no signal in the model could be found, are removed from the enumeration
  • Signals which are part of the enumeration, but don't have the generated stereotype, are preserved even if they've not been found in the model

To make persistent changes to a signal in your signals enumeration, you need to remove the generated stereotype from that particular signal. From then on, you can make changes to that signal without your changes being overwritten every time you re-generate the signals.

Keep in mind that removing the generated stereotype makes you responsible for keeping that signal up-to-date. If your signal in the model changes its name, a new signal will be introduced to the signals enumeration.

Update in version 2.2

In version 2.2 multiple/custom signal enums are allowed.

Custom signals enumerations can be accomplished by creating a standardt Enumeration and adding the stereotype signals.

To support multiple signal enums the following constraints where added:

  1. a custom signals enum needs to be linked with a "use" link to the Class
  2. if no "use" link, from a Class to a signals enum, was found the code generation will fall back the default signals enum
  3. a signals enum may be used by multiple Classes
  4. a Class may only have one "use" link to a singals enum
  5. "Generating Singals" feature of Embedded Engineer will use point 1. and 2. to determin where to add the signals.
  6. due to point 1. - 4. it will be possible that a signal enum entry will be genereated in multiple signal enums
  7. if one wants to "send signals" to another Class/State Machine he/she should eather use the same signals enum or needs to take care of "signal mapping" him-/herself.

See also


  • No labels