Built in reflex origins¶
BrainStem devices have a number of built in reflex origins that can be mapped to provide reflex functionality when certain system events occur. Each reflex routine in the reflex file is declared similarly. Built in origins do not have arguments passed in. for Example:
reflex mapEnable() {
// ... Reflex statements
}
- mapEnable
This reflex is triggered when the reflex map file is enabled.
- transportUp
On a reset of a module this reflex is triggered when its transport becomes ready (USB is enumerated, TCPIP has acquired an address).
- linkUp
A BrainStem link to the host has been created.
- linkDown
The BrainStem link has been disconnected.
- transportDown
The transport is currently down (USB no upstream connection, TCPIP has lost IP address, or has been disconnected)
- mapDisable
Actions to be executed before the map file is disabled.
Map Enable¶
The map enable reflex is the primary entry point for reflex code when a map file is enabled on a module slot. The reflex machine within the module first adds each of the reflexes defined in the map file to their respective origins, and then executes the code inside the mapEnable reflex.
Example:
reflex mapEnable() {
// ...
}
Transport Up¶
Transport Up is called when the Module detects that its primary transport to the host is configured and ready for communication. On USB modules this is when the host has successfully enumerated the Module. In TCP/IP based modules, this event occurs when the stem detects that is has a valid IP address.
reflex transportUp() {
// ...
}
Link Up¶
Link up is called when the module detects that an active BrainStem link has been established.
reflex linkUp() {
// ...
}
Link Down¶
Link down is called when the module detects that an active BrainStem link has been disconnected.
reflex linkDown() {
// ...
}
Transport Down¶
Transport Down is called when the Module detects that its primary transport to the host has been disconnected.
reflex transportDown() {
// ...
}
Map Disable¶
Map Disable is called when the map file is disabled. The reflex machine within the module first executes this reflex origin, and then removes all allocated reflex origins for the map.
Example:
reflex mapDisable() {
// ...
}