Using Stateflow     Search    Help Desk 

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. You cannot receive the page because you do not own the pager.

Similarly, you may want to broadcast an event that is externally (outside the Stateflow diagram, the machine, and the Simulink model) defined. 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. Importing the event does not imply anything about what the external source does with the information. It is the responsibility of the external source to make the Imported event available (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 Imported event and the other machine defines 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.




[ Previous | Help Desk | Next ]