14 #ifndef GO_SDK_HEARTBEAT_H
15 #define GO_SDK_HEARTBEAT_H
52 #define GO_HEARTBEAT_DEFAULT_PORT (3195)
57 #define GO_HEARTBEAT_DEFAULT_TIMEOUT_US (100000)
62 #define GO_HEARTBEAT_DEFAULT_INTERVAL_US (25000)
68 #if defined(K_ENDIAN_LITTLE)
69 #define GO_HEARTBEAT_HTON16(x) ((k16u)(((x) >> 8) | ((x) << 8)))
70 #define GO_HEARTBEAT_HTON32(x) ((k32u)(((x) >> 24) | (((x) >> 8) & 0xFF00) | (((x) << 8) & 0xFF0000) | ((x) << 24)))
71 #define GO_HEARTBEAT_HTON64(x) ((k64u)(((k64u)GO_HEARTBEAT_HTON32((k32u)(x)) << 32) | GO_HEARTBEAT_HTON32((k32u)((x) >> 32))))
73 #define GO_HEARTBEAT_HTON16(x) (x)
74 #define GO_HEARTBEAT_HTON32(x) (x)
75 #define GO_HEARTBEAT_HTON64(x) (x)
78 #define GO_HEARTBEAT_NTOH16(x) GO_HEARTBEAT_HTON16(x)
79 #define GO_HEARTBEAT_NTOH32(x) GO_HEARTBEAT_HTON32(x)
80 #define GO_HEARTBEAT_NTOH64(x) GO_HEARTBEAT_HTON64(x)
104 #define GO_HEARTBEAT_MAGIC (0x474F)
342 #include <GoSdk/GoHeartbeat.x.h>
k16u magic
Magic identifier (0x474F = "GO") - network byte order.
Definition: GoHeartbeat.h:94
void(kCall * GoHeartbeatReconnectFx)(kPointer context, GoHeartbeat heartbeat, k32u sensorId)
Defines the signature for a heartbeat reconnect callback function.
Definition: GoHeartbeat.h:175
Represents a heartbeat UDP packet (wire format).
Definition: GoHeartbeat.h:92
kStatus GoHeartbeat_Destroy(GoHeartbeat heartbeat)
Destroys a GoHeartbeat object.
k16u lastSequence
Last received sequence number (wraps every 65536 packets)
Definition: GoHeartbeat.h:117
k32u sensorId
Sensor ID that sent this heartbeat - network byte order.
Definition: GoHeartbeat.h:95
kStatus GoHeartbeat_Stop(GoHeartbeat heartbeat)
Stops heartbeat monitoring.
k64u packetsReceived
Total packets received.
Definition: GoHeartbeat.h:118
Provides fast UDP-based heartbeat monitoring for sensor disconnection detection.
k64u GoHeartbeat_Timeout(GoHeartbeat heartbeat)
Gets the current timeout duration.
kStatus GoHeartbeat_SetDisconnectHandler(GoHeartbeat heartbeat, GoHeartbeatDisconnectFx function, kPointer context)
Sets the disconnect callback handler.
k32u GoHeartbeat_LocalPort(GoHeartbeat heartbeat)
Returns the UDP port the heartbeat receiver is bound to.
kBool GoHeartbeat_IsRunning(GoHeartbeat heartbeat)
Reports whether heartbeat monitoring is currently active.
Essential SDK declarations.
kStatus GoHeartbeat_Construct(GoHeartbeat *heartbeat, kAlloc allocator)
Constructs a GoHeartbeat object.
k32u sensorId
Sensor ID being monitored.
Definition: GoHeartbeat.h:114
Represents heartbeat status information.
Definition: GoHeartbeat.h:112
k64u packetsMissed
Total packets missed (sequence gaps)
Definition: GoHeartbeat.h:119
kStatus GoHeartbeat_SetTimeout(GoHeartbeat heartbeat, k64u timeoutUs)
Sets the timeout duration for disconnection detection.
kStatus GoHeartbeat_Start(GoHeartbeat heartbeat, k32u sensorId, kIpAddress address, k32u port)
Starts heartbeat monitoring for a sensor.
k64u lastReceivedTime
Timestamp of last received heartbeat (microseconds)
Definition: GoHeartbeat.h:116
kStatus GoHeartbeat_SetReconnectHandler(GoHeartbeat heartbeat, GoHeartbeatReconnectFx function, kPointer context)
Sets the reconnect callback handler.
kStatus GoHeartbeat_GetInfo(GoHeartbeat heartbeat, GoHeartbeatInfo *info)
Gets detailed heartbeat status information.
kBool connected
Current connection status.
Definition: GoHeartbeat.h:115
void(kCall * GoHeartbeatDisconnectFx)(kPointer context, GoHeartbeat heartbeat, k32u sensorId)
Defines the signature for a heartbeat disconnect callback function.
Definition: GoHeartbeat.h:163
k16u sequence
Rolling sequence number (0-65535) - network byte order.
Definition: GoHeartbeat.h:96
k64u GoHeartbeat_LastReceivedTime(GoHeartbeat heartbeat)
Gets the timestamp of the last received heartbeat.
kBool GoHeartbeat_IsConnected(GoHeartbeat heartbeat)
Reports whether the monitored sensor is currently connected.
k64u timestamp
Timestamp when packet was sent (microseconds) - network byte order.
Definition: GoHeartbeat.h:97