Show/Hide Toolbars

Irinos Measurement System

Navigation: MscDll Reference Guide > API (programming interface) > Notifications

MSC_SetNotificationCallback

Scroll Prev Top Next More

This function registers a callback function for notification.

 

Definition


MSC_STATUS
MSC_SetNotificationCallback(
    MSC_HANDLE Handle,
    int OpCode,
    MSC_NOTIFICATION_CALLBACK* CallbackFunction,
    void* NotificationContext
);

 

Parameter


Handle

Device-Handle, which has been returned by a previous call of the function MSC_OpenDevice.

Opcode

oOpcode of the static channel (opcRS, opcRHS oder opcBIO). A notification message will be sent, if new data has arrived for the respective opcode.

o-1 for a notification in case of a communication timeout (see MSC_Start).

oThe opcode of the dynamic measurement (opcRDM1 oder opcRDM2). If the receive buffer of the respective dynamic measurement is full, a notification message will be sent.

CallbackFunction

The address of the callback function. Use NULL to unregister the callback function.

NotificationContext

A caller provided context pointer which is passed unchanged to the callback function.

 

Return value


If successful, MSC_STATUS_SUCCESS will be returned. In case of an error, an error code will be returned.

 

Comments


The notification is only used for devices and for static and dynamic data transfer channels.

A device notification reports about a communication error.

For a static data transfer channel, the notification is sent each time new data has arrived (-> once per send period).

For a dynamic data transfer channel, the notification is only sent, if the receive buffer is completely full.

The notification can be unregistered if the function is called with Event == NULL.

The callback function is called from the communication thread. Only very limited code can be executed in the callback-function. Otherwise this may lead to communication delays or even to a breakdown of the communication.

 

See also


MSC_OpenDevice

MSC_Start

 

Callback function

This function is the prototype for a callback notification.

Definition


void
MSC_NOTIFICATION_CALLBACK(
    void* NotificationContext
);

 

Parameter


NotificationContext

This parameter is the same which was passed to the function MSC_SetNotificationCallback. The application can store a context information in this pointer.

 

Comments


This function is called in a different thread context. The application must handle the synchronisation.