MIL_ID SysId, | //in |
MIL_INT HookType, | //in |
MIL_SYS_HOOK_FUNCTION_PTR HookHandlerPtr, | //in |
void *UserDataPtr | //in-out |
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. |
‡ | a | c M10 |
g | h | o | t U28 |
u U36 |
v | |||||||||||||||||||||||||||||
MIL system identifier |
Specifies a valid system identifier, previously allocated using MsysAlloc(). |
‡ | a | c M10 |
g | h | j | l | m | o | p | r U27 |
t U28 |
u U36 |
v | w U53 |
z | aa |
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. (summarize)Hooks the function to the presence of the camera. (more details...) |
‡ | c M10 |
o | u U36 |
||||||||||||||||||||||||||||||||||
MIL system specific | |||||||||||||||||||||||||||||||||||||||
Note that this hook requires the use of the mtxgigeservice process. If the service is not started, a MIL error will be generated when calling this value. |
‡ | c M10 |
|||||||||||||||||||||||||||||||||||||
M_FEATURE_CHANGE + |
Hooks the function to the event that occurs when the value of a GenICam feature changes. To enable an event to occur when the value of a specific feature changes, use MsysControlFeature() with M_FEATURE_CHANGE_HOOK set to M_ENABLE. Repeat for each feature for which you want to enable a feature change event. To enable an event to occur when the value of any feature changes, use M_FEATURE_CHANGE + M_ALL. This setting is only available for hooking to an image buffer. Within the hook function, use MsysGetHookInfo() with M_GC_FEATURE_CHANGE_NAME to retrieve the name of the feature that caused the event. (summarize)Hooks the function to the event that occurs when the value of a GenICam feature changes. (more details...) |
‡ | v | ||||||||||||||||||||||||||||||||||||
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. Within the scope of the hook-handler function, it is prudent to verify that the appropriate I/O signal triggered the hook-handler function, using MsysGetHookInfo() with M_IO_INTERRUPT_SOURCE. If more than one input signal triggers an interrupt at the same time, the hook-handler function (or chain of hook-handler functions) is called for each input signal that generated an interrupt. As a result, any and all user-specified function(s) hooked using this hook type will be executed for each interrupt. (summarize)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...) |
‡ | a | g | h | t U28 |
w U53 |
z | |||||||||||||||||||||||||||||||
MIL system specific | |||||||||||||||||||||||||||||||||||||||
[This is
only applicable to Matrox 4Sight-X, Matrox 4Sight GP/GPm, and
Matrox Supersight platforms]
The system must be a Host system allocated on the Matrox 4Sight GPm or Matrox Supersight platform. |
‡ | a | w U53 |
z | |||||||||||||||||||||||||||||||||||
M_TIMER_END + |
Hooks the function to the event that occurs when the specified timer completes. [Matrox 4Sight GP/GPm] On a Matrox 4Sight GPm platform, this value is only available if MIL 10 update 51 (or later) is installed. It is not available on a Matrox 4Sight GP. Hooks the function to the event that occurs when the specified timer completes. (more details...) |
‡ | a | t U28 |
w U53 |
z | |||||||||||||||||||||||||||||||||
MIL system specific | |||||||||||||||||||||||||||||||||||||||
You must specify a combination value from the following table: |
‡ | t U28 |
|||||||||||||||||||||||||||||||||||||
M_TIMER_START + |
Hooks the function to the event that occurs when the specified timer starts its active period (after the timer delay). [Matrox 4Sight GP/GPm] On a Matrox 4Sight GPm platform, this value is only available if MIL 10 update 51 (or later) is installed. It is not available on a Matrox 4Sight GP. Hooks the function to the event that occurs when the specified timer starts its active period (after the timer delay). (more details...) |
‡ | a | t U28 |
w U53 |
z | |||||||||||||||||||||||||||||||||
MIL system specific | |||||||||||||||||||||||||||||||||||||||
You must specify a combination value from the following table: |
‡ | t U28 |
|||||||||||||||||||||||||||||||||||||
M_UART_DATA_RECEIVED + |
Hooks the function to the event that occurs when the specified UART receives data. Use MsysInquire() with M_UART_PRESENT to return the number of UARTs available. Note that this value can be used in combination; see below. (summarize)Hooks the function to the event that occurs when the specified UART receives data. (more details...) |
‡ | g | j | l | m | p | r U27 |
aa | ||||||||||||||||||||||||||||||
M_WATCHDOG_WARNING + |
Hooks the function to the event that occurs when the Watchdog warning timer is not reset before the specified interval expires. From within your hook-handler function, you should reset the Watchdog's main timer. If it is not reset, the Host computer will reboot. (summarize)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 one of the following values to the above-mentioned value to specify the GenTL configuration file (XML file) associated with the feature.
For specifying to hook on a specific feature change
event associated with a GenTL configuration file
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description |
MIL system-specific tooltip (‡) |
|||||||||||||||||||||||||||||||||||||
Specifies that the hook will occur on a feature change event for a feature associated with a specific instance of the GenTL interface configuration file (XML file). (summarize)Specifies that the hook will occur on a feature change event for a feature associated with a specific instance of the GenTL interface configuration file (XML file). (more details...) |
‡ | v | |||||||||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies the index of the GenTL interface configuration file. |
‡ | v | |||||||||||||||||||||||||||||||||||||
|
‡ | v | |||||||||||||||||||||||||||||||||||||
M_ALL |
Specifies that the hook will occur on all feature change events. |
‡ | v | ||||||||||||||||||||||||||||||||||||
M_GENTL_SYSTEM |
Specifies that the hook will occur on a feature change event of a feature associated with the GenTL system configuration file (XML file). |
‡ | v |
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. Use MsysInquire() with M_UART_PRESENT to determine the number of UARTS on the system. (summarize)Specifies the UART upon which the system event occurs. (more details...) |
‡ | g | j | l | m | p | r U27 |
aa | |||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies a device (UART) on which the system event occurs. |
‡ | g | j | l | m | p | r U27 |
aa | |||||||||||||||||||||||||||||||
|
‡ | g | j | l | m | p | r U27 |
aa | |||||||||||||||||||||||||||||||
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 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 U27 |
aa | |||||||||||||||||||||||||||||||||
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. Note that, using the CLProtocol will occupy one COM port per allocated digitizer. |
‡ | j | p | r U27 |
aa |
You must add the following value to the above-mentioned values to specify the timer to which to hook the function.
For specifying the timer to which to hook the
function
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description |
MIL system-specific tooltip (‡) |
|||||||||||||||||||||||||||||||||||||
M_TIMERn |
Specifies the timer to hook. |
‡ | t U28 |
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. |
‡ | a | c M10 |
g | h | j | l | m | o | p | r U27 |
t U28 |
u U36 |
v | w U53 |
z | aa |
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. |