MIL_ID SysId, | //in |
MIL_INT HookType, | //in |
MIL_SYS_HOOK_FUNCTION_PTR HookHandlerPtr, | //in |
void *UserDataPtr | //in |
This function allows you to attach or detach a user-defined function to a specified system event. Once a hook-handler function is defined and hooked to an event, it is automatically called when the event occurs.
You can hook more than one function to an event by making separate calls to MsysHookFunction() for each function that you want to hook. MIL automatically chains and keeps an internal list of all these hooked functions. When a function is hooked, this new function is added to the end of the list. When the event happens, all user-defined functions in the list will be executed in the same order that they were hooked to the event. You can also remove any function from the list; in this case, MIL preserves the order of the remaining functions in the list.
You can obtain more information about the event from within the hook handler function using MsysGetHookInfo().
Note that functions hooked to an event execute on a distinct thread. This permits the functions to run concurrently from the operation that fired the event and from functions hooked to other events. Although there is a small queue to permit a certain amount of overlap, hooked functions should not take longer to execute than the period in which two of their associated events can occur. You cannot determine the instance of the event that fired the function.
Specifies the identifier of the system on which to hook a function.
For specifying the system
identifier
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
MIL system-specific tooltip (†) |
|||||||||||||||||||||||||||||||||||||
M_DEFAULT_HOST |
Specifies the default Host system of the current MIL application. |
† | b | c | e | f | g | h | j | l | m | o | p | r | s | ||||||||||||||||||||||||
MIL system identifier |
Specifies a valid system identifier, previously allocated using MsysAlloc(). |
† | b | c | e | f | g | h | j | l | m | o | p | r | s |
Specifies the system event to which to hook the function. This parameter can be set to one of the following values.
For specifying the system event to
hook
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
MIL system-specific tooltip (†) |
|||||||||||||||||||||||||||||||||||||
M_CAMERA_PRESENT + |
Hooks the function to the presence of the camera. (more details...) |
† | c | o | s | ||||||||||||||||||||||||||||||||||
M_IO_CHANGE + |
Hooks the function to the event that occurs when an I/O signal changes in accordance with its specified interrupt mode, set using MsysControl() with M_IO_INTERRUPT_ACTIVATION. (more details...) |
† | b | e | f | g | h | ||||||||||||||||||||||||||||||||
M_UART_DATA_RECEIVED + |
Hooks the function to the event that occurs when the specified UART receives data. (more details...) |
† | g | h | j | l | m | p | r | ||||||||||||||||||||||||||||||
M_WATCHDOG_WARNING + |
Hooks the function to the event that occurs when the Watchdog warning timer is not reset before the specified interval expires. (more details...) |
† | g | h |
You can add the following value to the above-mentioned value to set the UART upon which the system event occurs.
For specifying the UART upon which the
system event occurs
|
|||||||||||||||||||||||||||||||||||||||
Combination value |
Description
|
MIL system-specific tooltip (†) |
|||||||||||||||||||||||||||||||||||||
Specifies the UART upon which the system event occurs. (more details...) |
† | g | h | j | l | m | p | r | |||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies a UART, where n is from 0 to 3. |
† | g | h | j | l | m | p | r | |||||||||||||||||||||||||||||||
MIL system specific | |||||||||||||||||||||||||||||||||||||||
There is 1 UART available on Matrox Morphis. |
† | g | |||||||||||||||||||||||||||||||||||||
There are 4 UARTs available on Matrox Solios eA/XA Quad, 2 on Matrox Solios eA/XA dual, and 1 on Matrox Solios eA/XA single. |
† | l | |||||||||||||||||||||||||||||||||||||
There are 2 UARTs are available on Matrox Solios eCL/XCL dual-Base/single-Medium operating in dual-Base mode, and 1 is available on Matrox Solios eCL/XCL-B, eCL/XCL-F, and eCL/XCL dual-Base/single-Medium operating in single-Medium mode. |
† | j | m | p | r | ||||||||||||||||||||||||||||||||||
There are 2 UARTS available on Matrox Radient eCL-DB and eCL-DF, 3 on Matrox Radient eCL-QB, and 1 on Matrox Radient eCL-SF. |
† | j | p | r |
You can add the following value to the above-mentioned values to specify that the function should be unhooked.
For specifying that the function should
be unhooked
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
MIL system-specific tooltip (†) |
|||||||||||||||||||||||||||||||||||||
M_UNHOOK |
Unhooks a hooked function. |
† | b | c | e | f | g | h | j | l | m | o | p | r | s |
Specifies the address of the function that should be called when the specified event occurs. The hook-handler function must be declared as follows:
Type of system event hooked.
Event identifier to pass to MsysGetHookInfo() when inquiring about the hooked event.
Specifies the user data pointer passed to MsysHookFunction().
Upon successful completion, the hook-handler function should return M_NULL. Note, MIL_SYS_HOOK_FUNCTION_PTR and MFTYPE are reserved MIL predefined types for functions and data pointers.
Specifies the address of the user data that you want to make available to the hook-handler function. This address is passed to the hook-handler function, through its UserDataPtr parameter, when the specified event occurs. Set this parameter to M_NULL if not used.
Header | Include mil.h. |
Library | Use mil.lib. |
DLL | Requires mil.dll. |