Stateflow    

Imported Events

Consider the same pager example discussed for Exported events to clarify the use of Imported events. Someone buys a pager and indicates you may want to use this number to page them in the future. They tell you the pager number and you take note of the number by writing it down. You can then use the number to page that person.

Similarly, you may want to broadcast an event that is defined externally (outside the Stateflow diagram, the machine, and the Simulink model). By defining an event's scope to be Imported, the event can be broadcast anywhere within the hierarchy of that machine (including any offspring of the machine). An Imported event's parent is external. However, the event needs an `adoptive' parent to resolve symbols for code generation. An Imported event's adoptive parent must be the machine because the machine is the (highest) level in the Stateflow hierarchy that can interface to external sources. It is the responsibility of the external source to make the Imported event available (in the manner appropriate to the source).

If the external source is another machine, it must define the same event to be Exported. Stateflow generates the appropriate import and export event code for both machines.

This example shows the format required in the external code source (custom code) to make the event available.


 Exported Events Exported Data