refs #279, added version info to FSUIPC class

This commit is contained in:
Klaus Basan
2014-06-23 00:22:58 +02:00
parent e7c14e2c1c
commit 317ea93701
2 changed files with 18 additions and 3 deletions

View File

@@ -8,6 +8,7 @@
// bug in FSUIPC_User.h, windows.h not included, so we have to import it first
#include "FSUIPC/FSUIPC_User.h"
#include <QDebug>
#include <QLatin1Char>
namespace BlackSimPlugin
{
@@ -30,13 +31,27 @@ namespace BlackSimPlugin
if (FSUIPC_Open(SIM_ANY, &result))
{
this->m_connected = true;
qDebug() << "FSUIPC connected";
// KB_REMOVE: Remove this later
int simIndex = static_cast<int>(FSUIPC_FS_Version);
QString sim(
(simIndex >= 0 && simIndex < CFsuipc::simulators().size()) ?
CFsuipc::simulators().at(simIndex) :
"Unknown FS");
QString ver("%1.%2.%3.%4%5");
ver = ver.arg(QLatin1Char(48 + (0x0f & (FSUIPC_Version >> 28))))
.arg(QLatin1Char(48 + (0x0f & (FSUIPC_Version >> 24))))
.arg(QLatin1Char(48 + (0x0f & (FSUIPC_Version >> 20))))
.arg(QLatin1Char(48 + (0x0f & (FSUIPC_Version >> 16))))
.arg((FSUIPC_Version & 0xffff) ? "a" + (FSUIPC_Version & 0xff) - 1 : "");
this->m_fsuipcVersion = QString("FSUIPC %1 (%2)").arg(ver).arg(sim);
qDebug() << "FSUIPC connected" << this->m_fsuipcVersion;
}
else
{
this->m_connected = false;
int index = static_cast<int>(result);
this->m_lastErrorMessage = CFsuipc::errorMessages().at(index);
// KB_REMOVE: Remove this later
qDebug() << "FSUIPC" << this->m_lastErrorMessage;
}
return this->m_connected;

View File

@@ -67,7 +67,7 @@ namespace BlackSimPlugin
{
static const QStringList sims(
{
"FS98", "FS2000", "CFS2", "CFS1", "Fly!", "FS2002", "FS2004"
"any", "FS98", "FS2000", "CFS2", "CFS1", "Fly!", "FS2002", "FS2004", "FSX", "ESP", "P3D"
}
);
return sims;
@@ -76,7 +76,7 @@ namespace BlackSimPlugin
private:
bool m_connected;
QString m_lastErrorMessage;
QString m_fsuipcVersion;
};
}
}