Stateflow    

Importing Events

The Stateflow machine can import events defined by external code. Importing an event allows the Stateflow machine built into a stand-alone or Real-Time Workshop target to trigger the event in external code. To import an event, first add the event to the data dictionary as a child of the Stateflow machine that needs to trigger the event (see Adding Events to the Data Dictionary). Then set the new event's Scope property to Imported.

Stateflow assumes that external code defines each imported event as a function whose prototype is of the form

where EVENT is the Stateflow name of the imported event. For example, suppose that the Stateflow machine imports an external event named switch_on. Then Stateflow assumes that external code defines a function named external_broadcast_switch_on that broadcasts the event to external code. When building a target for the Stateflow machine, the Stateflow code generator encodes actions that signal imported events as calls to the corresponding external broadcast event functions defined by the external code.


  Exporting Events Specifying Trigger Types