mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-08 21:05:34 +08:00
[FS9] Implement time synchronisation
This commit is contained in:
committed by
Mat Sutcliffe
parent
464528da9a
commit
6a5e59b76a
@@ -53,6 +53,9 @@ namespace BlackSimPlugin
|
||||
//! Write weather grid to simulator
|
||||
bool write(const BlackMisc::Weather::CWeatherGrid &weatherGrid);
|
||||
|
||||
//! Set simulator time
|
||||
bool setSimulatorTime(int hour, int minute);
|
||||
|
||||
//! Get the version
|
||||
QString getVersion() const;
|
||||
|
||||
|
||||
@@ -66,6 +66,13 @@ namespace BlackSimPlugin
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CFsuipc::setSimulatorTime(int hour, int minute)
|
||||
{
|
||||
Q_UNUSED(hour);
|
||||
Q_UNUSED(minute);
|
||||
return false;
|
||||
}
|
||||
|
||||
QString CFsuipc::getVersion() const
|
||||
{
|
||||
return QStringLiteral("N/A");
|
||||
|
||||
@@ -330,6 +330,23 @@ namespace BlackSimPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFsuipc::setSimulatorTime(int hour, int minute)
|
||||
{
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
||||
if (!this->isOpened()) { return false; }
|
||||
|
||||
// should be the same as writing via SimConnect data area
|
||||
DWORD dwResult;
|
||||
quint8 hourRaw = hour;
|
||||
quint8 minuteRaw = minute;
|
||||
|
||||
const bool ok =
|
||||
FSUIPC_Write(0x023b, 1, &hourRaw, &dwResult) &&
|
||||
FSUIPC_Write(0x023c, 1, &minuteRaw, &dwResult);
|
||||
if (ok) { FSUIPC_Process(&dwResult); }
|
||||
return ok && dwResult == 0;
|
||||
}
|
||||
|
||||
QString CFsuipc::getVersion() const
|
||||
{
|
||||
return m_fsuipcVersion;
|
||||
|
||||
Reference in New Issue
Block a user