Gocator API
kStatus GoSystem_SetDataHandler ( GoSystem  system,
GoDataFx  function,
kPointer  receiver 
)

Sets a callback function that can be used to receive sensor data messages asynchronously.

Sensor data messages can be received synchronously using the GoSystem_ReceiveData function or asynchronously by registering a callback function. If a callback function is registered, a background thread will be created to perform notifications. After using GoSystem_SetDataHandler function, SDK application is responsible for disposing of the GoDataSet objects that hold the data received from the sensor on the data connection.

Warning
Do not call GoSensor_*() or GoSystem_*() functions from within the callback. These objects are not thread-safe. Calling SDK functions from the callback thread while the main thread also uses the SDK can corrupt shared internal state, leading to undefined behavior.

To unregister a previously-registered data handler, call this function using kNULL in place of the callback function argument.

Version
Introduced in firmware 4.0.10.27
Parameters
systemGoSystem object.
functionData callback function (or kNULL to unregister).
receiverReceiver argument for callback.
Returns
Operation status.
See also
GoDataFx, GoSystem_ReceiveData, GoSystem_SetDataCapacity, GoSystem_EnableData