Ref T610, support for XPlane COM volume and receive/transmit

* proxy and
* DBus service functions
This commit is contained in:
Klaus Basan
2019-08-24 03:10:12 +02:00
committed by Mat Sutcliffe
parent 62f5ddab99
commit d1fac2e1a4
6 changed files with 197 additions and 10 deletions

View File

@@ -72,13 +72,17 @@ namespace BlackMisc
template <class AVIO>
void CModulator<AVIO>::setVolumeReceive(int volume)
{
m_volumeReceive = volume;
if (volume >= 100) { m_volumeReceive = 100; }
else if (volume <= 0) { m_volumeReceive = 0; }
else { m_volumeReceive = volume; }
}
template <class AVIO>
void CModulator<AVIO>::setVolumeTransmit(int volume)
{
m_volumeTransmit = volume;
if (volume >= 100) { m_volumeTransmit = 100; }
else if (volume <= 0) { m_volumeTransmit = 0; }
else { m_volumeTransmit = volume; }
}
template <class AVIO>

View File

@@ -75,17 +75,23 @@ namespace BlackSimPlugin
QString aircraftModelPath; //!< Aircraft model path
QString aircraftIcaoCode; //!< Aircraft ICAO code
double latitudeDeg; //!< Longitude [deg]
double longitudeDeg; //!< Latitude [deg]
double altitudeM; //!< Altitude [m]
double longitudeDeg; //!< Latitude [deg]
double altitudeM; //!< Altitude [m]
double groundspeedMs; //!< Ground speed [m/s]
double pitchDeg; //!< Pitch [deg]
double rollDeg; //!< Roll [deg]
double rollDeg; //!< Roll [deg]
double trueHeadingDeg; //!< True heading [deg]
bool onGroundAll; //!< All wheels on ground?
int com1ActiveKhz; //!< COM1 active [kHz]
int com1ActiveKhz; //!< COM1 active [kHz]
int com1StandbyKhz; //!< COM1 standby [kHz]
int com2ActiveKhz; //!< COM2 active [kHz]
bool isCom1Receiving; //!< COM1 receiving
bool isCom1Transmitting; //!< COM1 transmittings
double com1Volume; //!< COM1 volume 0..1
int com2ActiveKhz; //!< COM2 active [kHz]
int com2StandbyKhz; //!< COM2 standby [kHz]
bool isCom2Receiving; //!< COM2 receiving
bool isCom2Transmitting; //!< COM2 transmittings
double com2Volume; //!< COM2 volume 0..1
int xpdrCode; //!< Transpondder code
int xpdrMode; //!< Transponder mode (off=0,stdby=1,on=2,test=3)
bool xpdrIdent; //!< Is transponder in ident?
@@ -95,7 +101,7 @@ namespace BlackSimPlugin
bool strobeLightsOn; //!< Strobe lights on?
bool taxiLightsOn; //!< Taxi lights on?
double flapsReployRatio; //!< Flaps deployment ratio [%]
double gearReployRatio; //!< Gear deployment ratio [%]
double gearReployRatio; //!< Gear deployment ratio [%]
QList<double> enginesN1Percentage; //!< N1 per engine [%]
double speedBrakeRatio; //!< Speed break ratio [%]
double seaLevelPressureInHg; //!< Sea level pressure [inhg]
@@ -257,10 +263,11 @@ namespace BlackSimPlugin
//! Reset the XPlane data
void resetXPlaneData()
{
m_xplaneData = { "", "", 0, 0, 0, 0, 0, 0, 0, false, 122800, 122800, 122800, 122800, 2000, 0, false, false, false, false,
m_xplaneData = { "", "", 0, 0, 0, 0, 0, 0, 0, false,
122800, 122800, true, true, 1.0, 122800, 122800, true, true, 1.0,
2000, 0, false, false, false, false,
false, false, 0, 0, {}, 0.0, 0.0
};
}
};

View File

@@ -314,11 +314,42 @@ namespace BlackSimPlugin
{
return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom1StandbyKhz"));
}
void CXSwiftBusServiceProxy::getCom1StandbyKhzAsync(int *o_com1Standby)
{
m_dbusInterface->callDBusAsync(QLatin1String("getCom1StandbyKhz"), setterCallback(o_com1Standby));
}
bool CXSwiftBusServiceProxy::isCom1Receiving() const
{
return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom1Receiving"));
}
void CXSwiftBusServiceProxy::isCom1ReceivingAsync(bool *o_com1Rec)
{
m_dbusInterface->callDBusAsync(QLatin1String("isCom1Receiving"), setterCallback(o_com1Rec));
}
bool CXSwiftBusServiceProxy::isCom1Transmitting() const
{
return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom1Transmitting"));
}
void CXSwiftBusServiceProxy::isCom1TransmittingAsync(bool *o_com1Tx)
{
m_dbusInterface->callDBusAsync(QLatin1String("isCom1Transmitting"), setterCallback(o_com1Tx));
}
double CXSwiftBusServiceProxy::getCom1Volume() const
{
return m_dbusInterface->callDBusRet<double>(QLatin1String("getCom1Volume"));
}
void CXSwiftBusServiceProxy::getCom1VolumeAsync(double *o_com1Volume)
{
m_dbusInterface->callDBusAsync(QLatin1String("getCom1Volume"), setterCallback(o_com1Volume));
}
int CXSwiftBusServiceProxy::getCom2ActiveKhz() const
{
return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom2ActiveKhz"));
@@ -337,6 +368,36 @@ namespace BlackSimPlugin
m_dbusInterface->callDBusAsync(QLatin1String("getCom2StandbyKhz"), setterCallback(o_com2Standby));
}
bool CXSwiftBusServiceProxy::isCom2Receiving() const
{
return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom2Receiving"));
}
void CXSwiftBusServiceProxy::isCom2ReceivingAsync(bool *o_com2Rec)
{
m_dbusInterface->callDBusAsync(QLatin1String("isCom2Receiving"), setterCallback(o_com2Rec));
}
bool CXSwiftBusServiceProxy::isCom2Transmitting() const
{
return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom2Transmitting"));
}
void CXSwiftBusServiceProxy::isCom2TransmittingAsync(bool *o_com2Tx)
{
m_dbusInterface->callDBusAsync(QLatin1String("isCom2Transmitting"), setterCallback(o_com2Tx));
}
double CXSwiftBusServiceProxy::getCom2Volume() const
{
return m_dbusInterface->callDBusRet<double>(QLatin1String("getCom2Volume"));
}
void CXSwiftBusServiceProxy::getCom2VolumeAsync(double *o_com2Volume)
{
m_dbusInterface->callDBusAsync(QLatin1String("getCom2Volume"), setterCallback(o_com2Volume));
}
int CXSwiftBusServiceProxy::getTransponderCode() const
{
return m_dbusInterface->callDBusRet<int>(QLatin1String("getTransponderCode"));

View File

@@ -271,6 +271,24 @@ namespace BlackSimPlugin
void getCom1StandbyKhzAsync(int *o_com1Standby);
//! @}
//! \copydoc XSwiftBus::CService::isCom1Receiving
//! @{
bool isCom1Receiving() const;
void isCom1ReceivingAsync(bool *o_com1Rec);
//! @}
//! \copydoc XSwiftBus::CService::isCom1Transmitting
//! @{
bool isCom1Transmitting() const;
void isCom1TransmittingAsync(bool *o_com1Tx);
//! @}
//! \copydoc XSwiftBus::CService::getCom1Volume
//! @{
double getCom1Volume() const;
void getCom1VolumeAsync(double *o_com1Volume);
//! @}
//! \copydoc XSwiftBus::CService::getCom2ActiveKhz
//! @{
int getCom2ActiveKhz() const;
@@ -283,6 +301,24 @@ namespace BlackSimPlugin
void getCom2StandbyKhzAsync(int *o_com2Standby);
//! @}
//! \copydoc XSwiftBus::CService::isCom2Receiving
//! @{
bool isCom2Receiving() const;
void isCom2ReceivingAsync(bool *o_com2Rec);
//! @}
//! \copydoc XSwiftBus::CService::isCom2Transmitting
//! @{
bool isCom2Transmitting() const;
void isCom2TransmittingAsync(bool *o_com2Tx);
//! @}
//! \copydoc XSwiftBus::CService::getCom2Volume
//! @{
double getCom2Volume() const;
void getCom2VolumeAsync(double *o_com2Volume);
//! @}
//! \copydoc XSwiftBus::CService::getTransponderCode
//! @{
int getTransponderCode() const;

View File

@@ -507,6 +507,48 @@ namespace XSwiftBus
sendDBusReply(sender, serial, getCom2StandbyKhz());
});
}
else if (message.getMethodName() == "isCom1Receiving")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, isCom1Receiving());
});
}
else if (message.getMethodName() == "isCom1Transmitting")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, isCom1Transmitting());
});
}
else if (message.getMethodName() == "getCom1Volume")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getCom1Volume());
});
}
else if (message.getMethodName() == "isCom2Receiving")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, isCom2Receiving());
});
}
else if (message.getMethodName() == "isCom2Transmitting")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, isCom2Transmitting());
});
}
else if (message.getMethodName() == "getCom2Volume")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getCom2Volume());
});
}
else if (message.getMethodName() == "getTransponderCode")
{
queueDBusCall([ = ]()

View File

@@ -149,12 +149,42 @@ namespace XSwiftBus
//! Get the current COM1 standby frequency in kHz
int getCom1StandbyKhz() const { return m_com1Standby.get(); }
//! Get the COM1 power on/off
bool getCom1Power() const { return m_com1Power.get(); }
//! Get the COM1 listening yes/no
bool getCom1Listening() const { return m_com1Listening.get(); }
//! Get the COM1 volume 0..1
float getCom1Volume() const { return m_com1Volume.get(); }
//! Is COM1 receiving?
bool isCom1Receiving() const { return this->getCom1Power() && this->getCom1Listening(); }
//! Is COM1 transmitting?
bool isCom1Transmitting() const { return this->getCom1Power(); }
//! Get the current COM2 active frequency in kHz
int getCom2ActiveKhz() const { return m_com2Active.get(); }
//! Get the current COM2 standby frequency in kHz
int getCom2StandbyKhz() const { return m_com2Standby.get(); }
//! Get the COM2 power on/off
bool getCom2Power() const { return m_com2Power.get(); }
//! Get the COM2 listening yes/no
bool getCom2Listening() const { return m_com2Listening.get(); }
//! Get the COM2 volume 0..1
float getCom2Volume() const { return m_com2Volume.get(); }
//! Is COM2 receiving?
bool isCom2Receiving() const { return this->getCom2Power() && this->getCom2Listening(); }
//! Is COM2 transmitting?
bool isCom2Transmitting() const { return this->getCom2Power(); }
//! Get the current transponder code in decimal
int getTransponderCode() const { return m_xpdrCode.get(); }
@@ -267,6 +297,7 @@ namespace XSwiftBus
void readAirportsDatabase();
std::vector<CNavDataReference> findClosestAirports(int number, double latitude, double longitude);
//! Redraw message box after reading from the settings
void updateMessageBoxFromSettings();
StringDataRef<xplane::data::sim::aircraft::view::acf_livery_path> m_liveryPath;
@@ -288,8 +319,14 @@ namespace XSwiftBus
DataRef<xplane::data::sim::flightmodel::failures::onground_all> m_onGroundAll;
DataRef<xplane::data::sim::cockpit2::radios::actuators::com1_frequency_hz_833> m_com1Active;
DataRef<xplane::data::sim::cockpit2::radios::actuators::com1_standby_frequency_hz_833> m_com1Standby;
DataRef<xplane::data::sim::cockpit2::radios::actuators::com1_power> m_com1Power;
DataRef<xplane::data::sim::cockpit2::radios::actuators::audio_volume_com1> m_com1Volume; // 0..1
DataRef<xplane::data::sim::cockpit2::radios::actuators::audio_selection_com1> m_com1Listening;
DataRef<xplane::data::sim::cockpit2::radios::actuators::com2_frequency_hz_833> m_com2Active;
DataRef<xplane::data::sim::cockpit2::radios::actuators::com2_standby_frequency_hz_833> m_com2Standby;
DataRef<xplane::data::sim::cockpit2::radios::actuators::com2_power> m_com2Power;
DataRef<xplane::data::sim::cockpit2::radios::actuators::audio_volume_com2> m_com2Volume; // 0..1
DataRef<xplane::data::sim::cockpit2::radios::actuators::audio_selection_com2> m_com2Listening;
DataRef<xplane::data::sim::cockpit::radios::transponder_code> m_xpdrCode;
DataRef<xplane::data::sim::cockpit::radios::transponder_mode> m_xpdrMode;
DataRef<xplane::data::sim::cockpit::radios::transponder_id> m_xpdrIdent;