Stateflow    

Imported Events

The preceding pager example for exported events can clarify the use of imported events. For example, someone buys a pager and tells you that you might want to use this number to page them in the future and they give you the pager number to record. You can then use that number to page that person.

Similarly, you might want to broadcast an event that is defined externally (outside the Stateflow diagram, its Stateflow machine, and its Simulink model). By defining an event's scope to be Imported, you can broadcast the event 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 Stateflow machine, because the machine has the highest level in the Stateflow hierarchy and 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 Stateflow machine, the source machine must define the same event as Exported. Stateflow generates the appropriate import and export event code for both machines.

Imported Event Example

The following example shows the format required in an external code source (custom code) to generate an Imported event in Stateflow.


  Exported Events Exported Data