IDS Peak comfortSDK, genericSDK, IPL, and AFL developer manuals are external documents. Please contact us if you need them.
A message queue provides an asynchronous communication protocol so that the sender and receiver of messages do not have to interact with the message queue at the same time. The messages added to the message queue are stored until they are retrieved by the recipient. The messages will be deleted afterwards. Each message is processed only once by a single recipient. Thus, the message queue provides temporary storage in case the target program is busy or disconnected.
You can use the message queue to retrieve notifications for camera-based and host-based events if required. This allows you to act in a targeted manner - for example, when focusing or exposure is completed and you want to manually trigger subsequent processes. Each message queue in IDS peak comfortSDK has its own handle and you can create more than one message queue. You can also use one message queue for multiple cameras. The use of a message queue is demonstrated in the code sample "message_queue".
Managing a message queue
1 |
Create message queue |
peak_message_queue_handle hMessageQueue; peak_status status = peak_MessageQueue_Create(&hMessageQueue); |
---|---|---|
2 |
Enable messages |
peak_status status = peak_MessageQueue_EnableMessage(hMessageQueue, hCam, type); |
3 |
Start message queue |
status = peak_MessageQueue_Start(hMessageQueue); |
4 |
Wait for messages |
peak_message_handle hMessage; peak_status status = peak_MessageQueue_WaitForMessage(hMessageQueue, PEAK_INFINITE, &hMessage); |
5 |
Stop message queue |
peak_status status = peak_MessageQueue_Stop(hMessageQueue); |
6 |
Destroy message queue |
status = peak_MessageQueue_Destroy(hMessageQueue); |
Fig. 285: Process messages
1 |
Get message information |
peak_status status = peak_Message_GetInfo(hMessage, info); |
---|---|---|
2 |
Get message data |
peak_message_data_type dataType; peak_status status = peak_Message_Data_Type_Get(hMessage, &dataType); Depending on the return result, use the respective functions to get the message data: •PEAK_MESSAGE_DATA_TYPE_NO_DATA: No message data available •PEAK_MESSAGE_DATA_TYPE_REMOTE_DEVICE: Get data from peak_Message_Data_RemoteDevice_Get(), see also EventSelector •PEAK_MESSAGE_DATA_TYPE_REMOTE_DEVICE_ERROR: Get data from peak_Message_Data_RemoteDeviceError_Get() •PEAK_MESSAGE_DATA_TYPE_REMOTE_DEVICE_DROPPED: Get data from peak_Message_Data_RemoteDeviceDropped_Get() •PEAK_MESSAGE_DATA_TYPE_REMOTE_DEVICE_FRAME: Get data from peak_Message_Data_RemoteDeviceFrame_Get() •PEAK_MESSAGE_DATA_TYPE_REMOTE_DEVICE_TEMPERATURE: Get data from peak_Message_Data_RemoteDeviceTemperature_Get() •PEAK_MESSAGE_DATA_TYPE_AUTOFOCUS_DATA: Get data from peak_Message_Data_AutoFocusData_Get() (model-dependent) |
3 |
Release message |
peak_status status = peak_Message_Release(hMessage); |