SinelaboreRT Header Logo

SinelaboreRT

It's better when it's simple!

User Tools

Site Tools


Sidebar

Modelling-Tool specific Intro

Getting started

How-To

Language Backends

Designers Toolbox

Examples

There are better ways to model state machines than using spread sheets!

In the past different μC manufacturers have published application notes about the benefit of using state machines for the design of embedded software. An example is the application note SLAA402 from Texas Instruments (TI). It suggests to generate source code based on a spread sheet table. Nowadays several affordable UML modeling tools are available supporting the efficient design of state machines in a graphical way. SinelaboreRT generates production quality source code from state diagrams created with many different UML tools. Give it a try!

Latest Changes

wiki:backends:java_lang

Generating Java Code

To generate Java code call the code generator with the command line flag ’-l java’. The generator generates just one Java class which implements the complete state machine. This has the benefit that your Java project does not become bloated with all kinds of helper classes. If required an optional base class can be specified in the config file. Also the package (Namespace=…) can be defined there. The events that can be sent to the machine are defined in a public enumeration.

The following example shows how to use the generated code together with a GUI class based on a simple SWING application. Each time a button is pressed an event is sent to the state machine. Which then writes entry/exit code of the current state to the text window.

Class SMBase.java serves as bridge between the java GUI code and the generated state machine code.

The state machine that realises the behaviour of the button presses looks as follows:

The complete project file for Apache Netbeans can be downloaded here.

More information is available in the manual in section “Generating Java Code”.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
wiki/backends/java_lang.txt · Last modified: 2022/06/09 20:30 by pmueller