Stateflow    

Exported Events

Consider a real world example to clarify when to define an Exported event. You have purchased a communications pager. There are a few people you want to be able to page you, so you give those people your personal pager number. These people now know your pager number and can call that number and page you whatever you might be doing. You do not usually page yourself, but you can do so. Telling someone the pager number does not mean they have heard and recorded the number. It is the other person's responsibility to retain the number.

Similarly, you may want an external source (outside the Stateflow diagram, the machine, and the Simulink model) to be able to broadcast an event. By defining an event's scope to be Exported, that event is made available to external sources for broadcast purposes. Exported events must be parented by the machine because the machine is the (highest) level in the Stateflow hierarchy that can interface to external sources. The machine also retains the ability to broadcast the Exported event. Exporting the event does not imply anything about what the external source does with the information. It is the responsibility of the external source to include the Exported event (in the manner appropriate to the source) to make use of the right to broadcast the event.

If the external source is another machine, then one machine defines an Exported event and the other machine defines the same event to be Imported. Stateflow generates the appropriate export and import event code for both machines.

This example shows the format required in the external code source (custom code) to take advantage of an Exported event.


 Defining the Interface to External Sources Imported Events