dcs-bios-arduino-library
dcs-bios-arduino-library copied to clipboard
Question: How to check DCS BIOS Connection state (up/down)
Hello guys ! Thanks you for your work here 👍 I would like to know if there is a way to check if DCS BIOS connection is up or down ? (up = currently live with the plane's data) I need it in one of my script to do something like this:
if (DcsBios::connectionIsUp() {
// do whatever
} else {
// whatever else
}
Sorry if it is already in the docs, I didn't find it.
if you are using DCSBIOS_DEFAULT_SERIAL (witch is my case)
I found a way to do it :
// when dcs bios is up
if (Serial.available()) {
// do whatever
}
Does somebody have a solution for those who use DCSBIOS_IRQ_SERIAL ?
I just use something like this
bool isDCSinmission = false; char airCravftname[24];
void onAcftNameChange((char* newValue)) { if(strsmp(newValue,"") isDCSinmission = true; else isDCSinmission = false; strcpy(newValue,airCraftname); } DcsBios::StringBuffer<24> AcftNameBuffer(0x0000, onAcftNameChange);
I think this is a good solution. Thanks @kbastronomics :)
for those who want a corrected and simplified version:
bool isDCSinmission = false;
[...]
void onAircraftNameChange(char* newValue) {
if(strcmp(newValue,""))
isDCSinmission = true;
else
isDCSinmission = false;
}
DcsBios::StringBuffer<24> AcftNameBuffer(0x0000, onAircraftNameChange);