API Documentation v0.0.1
Loading...
Searching...
No Matches
DcsRunningChecker.h File Reference

DCS Connection Monitor for OpenHornet. More...

#include <DcsBios.h>

Go to the source code of this file.

Functions

bool checkDcsRunning ()
 Check if DCS World is currently running and sending data.
 
void onDcsUpdateCounterChange (unsigned int newValue)
 
DcsBios::IntegerBuffer dcsUpdateCounterBuffer (0xfffe, 0x00ff, 0, onDcsUpdateCounterChange)
 

Detailed Description

DCS Connection Monitor for OpenHornet.

This function monitors DCS-BIOS communication and returns TRUE as long as DCS is running; FALSE if DCS has stopped sending data, after a timeout.

Definition in file DcsRunningChecker.h.

Function Documentation

◆ checkDcsRunning()

bool checkDcsRunning ( )

Check if DCS World is currently running and sending data.

Monitors DCS-BIOS heartbeat counter to determine if DCS is actively communicating. Call this function regularly in your main loop.

Returns
true if DCS is running and sending data
false if DCS has stopped or communication timeout occurred
Note
Must be called regularly (every loop cycle) to maintain accurate timing

Definition at line 29 of file DcsRunningChecker.h.

29 {
30 if (currDcsHeartbeat != prevDcsHeartbeat) {
31 dcsLastUpdateTime = millis();
32 prevDcsHeartbeat = currDcsHeartbeat;
33 return true;
34 }
35
36 // Check if we've exceeded the timeout period
37 if (millis() - dcsLastUpdateTime >= DCS_TIMEOUT_MS) {
38 // No communication from DCS for over 1 second
39 return false;
40 }
41
42 // Within timeout window - assume DCS is still running
43 return true;
44}

◆ onDcsUpdateCounterChange()

void onDcsUpdateCounterChange ( unsigned int newValue)

Definition at line 47 of file DcsRunningChecker.h.

47 {
48 currDcsHeartbeat = newValue;
49 }