QPix Command Reference
![]() |
![]() ![]() |
QPx_AcqSetNotificationHandler(handlerMethod):error | |||
![]() |
handlerMethod | String31 | |
![]() |
error | Longint | Error result |
Specifies the device notification handler. The device notification handler is a 4D method that receives notification events when a device is connected or disconnected.
Parameter handlerMethod is the name of the method that will receive device notifications. If the specified method does not exist, an error is returned. To remove an already installed notification handler method, set handlerMethod to an empty string.
Note: Not all acquisition protocol devices provide connection/disconnection events. The protocols and devices that can currently send notifications are:
The device notification handler method must comply with the following calling interface:
![]() |
$1 | eventKindParam | Longint | The kind of the event |
![]() |
$2 | acqProtocolParam | Longint | The acquisition protocol identifier |
![]() |
$3 | deviceNameParam | Text | The name of the device |
![]() |
$0 | errorCode | Longint | Error code |
Parameter eventKindParam receives the kind of the event. This is one of the following constants:
qpx_AcqDeviceConnected | 0x1001 | A device has been connected |
qpx_AcqDeviceDisconnected | 0x1002 | A device has been disconnected |
Parameter acqProtocolParam receives the ID of the acquisition protocol to which the device belongs.
Parameter deviceNameParam receives the name of the device.
The notification handler returns an error code. This error code indicates to QPix if the handler executed successfully, if an error has occured, or if the notification handler was not interested in handling the event.
Even thought the error code is not currently used by QPix, it is important to follow these rules in order to allow for future expansion and compatibility.
Important note: The notification handler method should do as little as possible and not access the 4D database engine, because it is called in a local plug-in process ($QPixAcqGlobalHandler). To do any kind of database access or GUI operations like running dialogs, start a new 4D process or send a message to an existing one using your favorite interprocess communication mechanism.
Related commands
QPx_AcqGetNotificationHandler | Returns the device notification handler |