Gocator API
kStatus GoSensor_SetHeartbeatDisconnectHandler ( GoSensor  sensor,
GoSensorHeartbeatDisconnectFx  function,
kPointer  receiver 
)

Sets the handler for fast heartbeat-based disconnect detection.

This callback is invoked when the sensor is detected as disconnected via the heartbeat mechanism (~100ms detection time). The callback is invoked from a background thread.

Note: This is separate from the standard connection state change callback (GoSystem_SetDataHandler), which detects disconnection via health messages (~6 seconds detection time).

Callback re-entry rules:

  • The callback must not synchronously call GoSystem_* APIs that take the GoSystem state lock (e.g. GoSystem_FindSensor, GoSystem_RefreshSensors, GoSystem_SensorCount). The discovery thread holds that lock while it may be tearing down this same heartbeat in response to a topology transition; a synchronous call from the callback can deadlock against the in-progress teardown.
  • Calling GoSensor_Disconnect from inside this callback is supported (the heartbeat layer's self-call detector handles the re-entry).
  • The recommended pattern is to set a flag here and act on it from your application's main thread.
Version
Introduced in firmware 6.6.4.3
Parameters
sensorGoSensor object.
functionDisconnect callback function (or kNULL to unregister).
receiverReceiver argument for callback.
Returns
Operation status.