mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
@@ -38,14 +38,10 @@ namespace BlackCore
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
//! \brief Constructor
|
||||||
* \brief Constructor
|
|
||||||
*/
|
|
||||||
CContextVoice(CCoreRuntime *runtime);
|
CContextVoice(CCoreRuntime *runtime);
|
||||||
|
|
||||||
/*!
|
//! \brief Destructor
|
||||||
* \brief Destructor
|
|
||||||
*/
|
|
||||||
virtual ~CContextVoice();
|
virtual ~CContextVoice();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -57,129 +53,81 @@ namespace BlackCore
|
|||||||
server->addObject(IContextVoice::ServicePath(), this);
|
server->addObject(IContextVoice::ServicePath(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//! \brief Runtime
|
||||||
* \brief Runtime
|
|
||||||
*/
|
|
||||||
const CCoreRuntime *getRuntime() const
|
const CCoreRuntime *getRuntime() const
|
||||||
{
|
{
|
||||||
return static_cast<CCoreRuntime *>(this->parent());
|
return static_cast<CCoreRuntime *>(this->parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//! \brief Using local objects?
|
||||||
* \brief Using local objects?
|
|
||||||
*/
|
|
||||||
virtual bool usingLocalObjects() const { return true; }
|
virtual bool usingLocalObjects() const { return true; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/*!
|
//! \copydoc IContextVoice::setOwnAircraft
|
||||||
* \copydoc IContextVoice::setOwnAircraft
|
virtual void setOwnAircraft(const BlackMisc::Aviation::CAircraft &ownAircraft) override;
|
||||||
*/
|
|
||||||
virtual void setOwnAircraft(const BlackMisc::Aviation::CAircraft &ownAircraft);
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getComVoiceRooms()
|
||||||
* \copydoc IContextVoice::getComVoiceRooms()
|
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const override;
|
||||||
*/
|
|
||||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getComVoiceRoomsWithAudioStatus()
|
||||||
* \copydoc IContextVoice::getComVoiceRoomsWithAudioStatus()
|
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const override;
|
||||||
*/
|
|
||||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getCom1VoiceRoom
|
||||||
* \copydoc IContextVoice::getCom1VoiceRoom
|
virtual BlackMisc::Voice::CVoiceRoom getCom1VoiceRoom(bool withAudioStatus) const override;
|
||||||
*/
|
|
||||||
virtual BlackMisc::Voice::CVoiceRoom getCom1VoiceRoom(bool withAudioStatus) const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getCom2VoiceRoom
|
||||||
* \copydoc IContextVoice::getCom2VoiceRoom
|
virtual BlackMisc::Voice::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const override;
|
||||||
*/
|
|
||||||
virtual BlackMisc::Voice::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::setComVoiceRooms()
|
||||||
* \copydoc IContextVoice::setComVoiceRooms()
|
virtual void setComVoiceRooms(const BlackMisc::Voice::CVoiceRoom &voiceRoomCom1, const BlackMisc::Voice::CVoiceRoom &voiceRoomCom2) override;
|
||||||
*/
|
|
||||||
virtual void setComVoiceRooms(const BlackMisc::Voice::CVoiceRoom &voiceRoomCom1, const BlackMisc::Voice::CVoiceRoom &voiceRoomCom2);
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getCom1RoomCallsigns()
|
||||||
* \copydoc IContextVoice::getCom1RoomCallsigns()
|
virtual BlackMisc::Aviation::CCallsignList getCom1RoomCallsigns() const override;
|
||||||
*/
|
|
||||||
virtual BlackMisc::Aviation::CCallsignList getCom1RoomCallsigns() const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getCom2RoomCallsigns()
|
||||||
* \copydoc IContextVoice::getCom2RoomCallsigns()
|
virtual BlackMisc::Aviation::CCallsignList getCom2RoomCallsigns() const override;
|
||||||
*/
|
|
||||||
virtual BlackMisc::Aviation::CCallsignList getCom2RoomCallsigns() const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getCom1RoomUsers()
|
||||||
* \copydoc IContextVoice::getCom1RoomUsers()
|
virtual BlackMisc::Network::CUserList getCom1RoomUsers() const override;
|
||||||
*/
|
|
||||||
virtual BlackMisc::Network::CUserList getCom1RoomUsers() const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getCom2RoomUsers()
|
||||||
* \copydoc IContextVoice::getCom2RoomUsers()
|
virtual BlackMisc::Network::CUserList getCom2RoomUsers() const override;
|
||||||
*/
|
|
||||||
virtual BlackMisc::Network::CUserList getCom2RoomUsers() const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::leaveAllVoiceRooms
|
||||||
* \copydoc IContextVoice::leaveAllVoiceRooms
|
virtual void leaveAllVoiceRooms() override;
|
||||||
*/
|
|
||||||
virtual void leaveAllVoiceRooms();
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getAudioDevices()
|
||||||
* \copydoc IContextVoice::getAudioDevices()
|
virtual BlackMisc::Voice::CAudioDeviceList getAudioDevices() const override;
|
||||||
*/
|
|
||||||
virtual BlackMisc::Voice::CAudioDeviceList getAudioDevices() const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getCurrentAudioDevices()
|
||||||
* \copydoc IContextVoice::getCurrentAudioDevices()
|
virtual BlackMisc::Voice::CAudioDeviceList getCurrentAudioDevices() const override;
|
||||||
*/
|
|
||||||
virtual BlackMisc::Voice::CAudioDeviceList getCurrentAudioDevices() const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::setCurrentAudioDevice()
|
||||||
* \copydoc IContextVoice::setCurrentAudioDevice()
|
virtual void setCurrentAudioDevice(const BlackMisc::Voice::CAudioDevice &audioDevice) override;
|
||||||
*/
|
|
||||||
virtual void setCurrentAudioDevice(const BlackMisc::Voice::CAudioDevice &audioDevice);
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::setVolumes()
|
||||||
* \copydoc IContextVoice::setVolumes()
|
virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2) override;
|
||||||
*/
|
|
||||||
virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::isMuted()
|
||||||
* \copydoc IContextVoice::isMuted()
|
virtual bool isMuted() const override;
|
||||||
*/
|
|
||||||
virtual bool isMuted() const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::playSelcalTone()
|
||||||
* \copydoc IContextVoice::playSelcalTone()
|
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
|
||||||
*/
|
|
||||||
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::playNotification()
|
||||||
* \copydoc IContextVoice::playNotification()
|
virtual void playNotification(uint notification) const override;
|
||||||
*/
|
|
||||||
virtual void playNotification(uint notification) const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::runMicrophoneTest()
|
||||||
* \copydoc IContextVoice::runMicrophoneTest()
|
virtual void runMicrophoneTest() override;
|
||||||
*/
|
|
||||||
virtual void runMicrophoneTest();
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::runSquelchTest()
|
||||||
* \copydoc IContextVoice::runSquelchTest()
|
virtual void runSquelchTest() override;
|
||||||
*/
|
|
||||||
virtual void runSquelchTest();
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getMicrophoneTestResult()
|
||||||
* \copydoc IContextVoice::getMicrophoneTestResult()
|
virtual QString getMicrophoneTestResult() const override;
|
||||||
*/
|
|
||||||
virtual QString getMicrophoneTestResult() const;
|
|
||||||
|
|
||||||
/*!
|
//! \copydoc IContextVoice::getSquelchValue()
|
||||||
* \copydoc IContextVoice::getSquelchValue()
|
virtual double getSquelchValue() const override;
|
||||||
*/
|
|
||||||
virtual double getSquelchValue() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CVoiceVatlib *m_voice; //!< underlying voice lib
|
CVoiceVatlib *m_voice; //!< underlying voice lib
|
||||||
|
|||||||
@@ -14,102 +14,102 @@
|
|||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
|
|
||||||
/*!
|
|
||||||
* \typedef Plane's orientation
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
BlackMisc::Aviation::CHeading heading; // honestly I think this is a track TODO
|
|
||||||
BlackMisc::PhysicalQuantities::CAngle pitch;
|
|
||||||
BlackMisc::PhysicalQuantities::CAngle bank;
|
|
||||||
|
|
||||||
} TOrientation;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \typedef Plane's state
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Reset data
|
* \brief Plane's orientation
|
||||||
*/
|
*/
|
||||||
void reset() {}
|
typedef struct
|
||||||
|
{
|
||||||
|
BlackMisc::Aviation::CHeading heading; //!< heading, honestly I think this is a track TODO
|
||||||
|
BlackMisc::PhysicalQuantities::CAngle pitch; //!< pitch
|
||||||
|
BlackMisc::PhysicalQuantities::CAngle bank; //!< bank
|
||||||
|
|
||||||
qint64 timestamp;
|
} TOrientation;
|
||||||
TOrientation orientation;
|
|
||||||
BlackMisc::PhysicalQuantities::CSpeed groundspeed;
|
|
||||||
BlackMisc::Math::CVector3D velocity;
|
|
||||||
BlackMisc::Geo::CCoordinateEcef position;
|
|
||||||
BlackMisc::Geo::CCoordinateNed velNED;
|
|
||||||
|
|
||||||
} TPlaneState;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Interpolator, calculation inbetween positions
|
|
||||||
*/
|
|
||||||
class CInterpolator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/*!
|
|
||||||
* \brief Default constructor
|
|
||||||
*/
|
|
||||||
CInterpolator();
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Virtual destructor
|
* \brief Plane's state
|
||||||
*/
|
*/
|
||||||
virtual ~CInterpolator();
|
typedef struct
|
||||||
|
{
|
||||||
|
/*!
|
||||||
|
* \brief Reset data
|
||||||
|
*/
|
||||||
|
void reset() {}
|
||||||
|
|
||||||
|
qint64 timestamp; //!< timestamp
|
||||||
|
TOrientation orientation; //!< orientation
|
||||||
|
BlackMisc::PhysicalQuantities::CSpeed groundspeed; //!< groundspeed
|
||||||
|
BlackMisc::Math::CVector3D velocity; //!< velocity
|
||||||
|
BlackMisc::Geo::CCoordinateEcef position; //!< position
|
||||||
|
BlackMisc::Geo::CCoordinateNed velNED; //!< NED coordinate
|
||||||
|
|
||||||
|
} TPlaneState;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Init object
|
* \brief Interpolator, calculation inbetween positions
|
||||||
*/
|
*/
|
||||||
void initialize();
|
class CInterpolator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/*!
|
||||||
|
* \brief Default constructor
|
||||||
|
*/
|
||||||
|
CInterpolator();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Push an update
|
* \brief Virtual destructor
|
||||||
* \param pos
|
*/
|
||||||
* \param groundSpeed
|
virtual ~CInterpolator();
|
||||||
* \param heading
|
|
||||||
* \param pitch
|
|
||||||
* \param bank
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
BlackMisc::Geo::CCoordinateNed pushUpdate(const BlackMisc::Geo::CCoordinateGeodetic &pos,
|
|
||||||
const BlackMisc::PhysicalQuantities::CSpeed &groundSpeed,
|
|
||||||
const BlackMisc::Aviation::CHeading &heading,
|
|
||||||
const BlackMisc::PhysicalQuantities::CAngle &pitch,
|
|
||||||
const BlackMisc::PhysicalQuantities::CAngle &bank);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Valid state?
|
* \brief Init object
|
||||||
* \return
|
*/
|
||||||
*/
|
void initialize();
|
||||||
bool isValid() const;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Calculate current state
|
* \brief Push an update
|
||||||
* \param state
|
* \param pos
|
||||||
* \return
|
* \param groundSpeed
|
||||||
*/
|
* \param heading
|
||||||
bool stateNow(TPlaneState *state);
|
* \param pitch
|
||||||
|
* \param bank
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
BlackMisc::Geo::CCoordinateNed pushUpdate(const BlackMisc::Geo::CCoordinateGeodetic &pos,
|
||||||
|
const BlackMisc::PhysicalQuantities::CSpeed &groundSpeed,
|
||||||
|
const BlackMisc::Aviation::CHeading &heading,
|
||||||
|
const BlackMisc::PhysicalQuantities::CAngle &pitch,
|
||||||
|
const BlackMisc::PhysicalQuantities::CAngle &bank);
|
||||||
|
|
||||||
private:
|
/*!
|
||||||
BlackMisc::Math::CVector3D m_a;
|
* \brief Valid state?
|
||||||
BlackMisc::Math::CVector3D m_b;
|
* \return
|
||||||
QElapsedTimer m_time;
|
*/
|
||||||
TPlaneState *m_state_begin;
|
bool isValid() const;
|
||||||
TPlaneState *m_state_end;
|
|
||||||
bool m_valid;
|
|
||||||
double m_timeEnd;
|
|
||||||
double m_timeBegin;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Normalize radians
|
* \brief Calculate current state
|
||||||
* \param angle
|
* \param state
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
BlackMisc::PhysicalQuantities::CAngle normalizeRadians(const BlackMisc::PhysicalQuantities::CAngle &angle) const;
|
bool stateNow(TPlaneState *state);
|
||||||
};
|
|
||||||
|
private:
|
||||||
|
BlackMisc::Math::CVector3D m_a;
|
||||||
|
BlackMisc::Math::CVector3D m_b;
|
||||||
|
QElapsedTimer m_time;
|
||||||
|
TPlaneState *m_state_begin;
|
||||||
|
TPlaneState *m_state_end;
|
||||||
|
bool m_valid;
|
||||||
|
double m_timeEnd;
|
||||||
|
double m_timeBegin;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Normalize radians
|
||||||
|
* \param angle
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
BlackMisc::PhysicalQuantities::CAngle normalizeRadians(const BlackMisc::PhysicalQuantities::CAngle &angle) const;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace BlackCore
|
} // namespace BlackCore
|
||||||
|
|
||||||
|
|||||||
@@ -147,41 +147,49 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
static double factor() { return 1; } //!< factor \return
|
static double factor() { return 1; } //!< factor \return
|
||||||
};
|
};
|
||||||
|
//! \brief 2 (two)
|
||||||
template <class Policy>
|
template <class Policy>
|
||||||
struct Two
|
struct Two
|
||||||
{
|
{
|
||||||
static double factor() { return Policy::factor() * 2.0; } //!< factor \return
|
static double factor() { return Policy::factor() * 2.0; } //!< factor \return
|
||||||
};
|
};
|
||||||
|
//! \brief 10^-3
|
||||||
template <class Policy>
|
template <class Policy>
|
||||||
struct Milli
|
struct Milli
|
||||||
{
|
{
|
||||||
static double factor() { return Policy::factor() / 1000.0; } //!< factor \return
|
static double factor() { return Policy::factor() / 1000.0; } //!< factor \return
|
||||||
};
|
};
|
||||||
template <class Policy>
|
template <class Policy>
|
||||||
|
//! \brief 10^-2
|
||||||
struct Centi
|
struct Centi
|
||||||
{
|
{
|
||||||
static double factor() { return Policy::factor() / 100.0; } //!< factor \return
|
static double factor() { return Policy::factor() / 100.0; } //!< factor \return
|
||||||
};
|
};
|
||||||
|
//! \brief 10^2
|
||||||
template <class Policy>
|
template <class Policy>
|
||||||
struct Hecto
|
struct Hecto
|
||||||
{
|
{
|
||||||
static double factor() { return Policy::factor() * 100.0; } //!< factor \return
|
static double factor() { return Policy::factor() * 100.0; } //!< factor \return
|
||||||
};
|
};
|
||||||
|
//! \brief 10^3
|
||||||
template <class Policy>
|
template <class Policy>
|
||||||
struct Kilo
|
struct Kilo
|
||||||
{
|
{
|
||||||
static double factor() { return Policy::factor() * 1000.0; } //!< factor \return
|
static double factor() { return Policy::factor() * 1000.0; } //!< factor \return
|
||||||
};
|
};
|
||||||
|
//! \brief 10^6
|
||||||
template <class Policy>
|
template <class Policy>
|
||||||
struct Mega
|
struct Mega
|
||||||
{
|
{
|
||||||
static double factor() { return Policy::factor() * 1e+6; } //!< factor \return
|
static double factor() { return Policy::factor() * 1e+6; } //!< factor \return
|
||||||
};
|
};
|
||||||
|
//! \brief 10^9
|
||||||
template <class Policy>
|
template <class Policy>
|
||||||
struct Giga
|
struct Giga
|
||||||
{
|
{
|
||||||
static double factor() { return Policy::factor() * 1e+9; } //!< factor \return
|
static double factor() { return Policy::factor() * 1e+9; } //!< factor \return
|
||||||
};
|
};
|
||||||
|
//! \brief in each hundred
|
||||||
template <int Subfactor>
|
template <int Subfactor>
|
||||||
struct InEachHundred
|
struct InEachHundred
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -186,8 +186,8 @@ namespace BlackMisc
|
|||||||
/*!
|
/*!
|
||||||
* \brief Set property by index
|
* \brief Set property by index
|
||||||
* \remarks Intentionally not abstract, avoiding all classes need to implement this method
|
* \remarks Intentionally not abstract, avoiding all classes need to implement this method
|
||||||
|
* \param variant
|
||||||
* \param index as used in Qt table views
|
* \param index as used in Qt table views
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual void setPropertyByIndex(const QVariant &variant, int index);
|
virtual void setPropertyByIndex(const QVariant &variant, int index);
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ namespace BlackSound
|
|||||||
/*!
|
/*!
|
||||||
* \brief Play sound, open device
|
* \brief Play sound, open device
|
||||||
* \param volume 0..100
|
* \param volume 0..100
|
||||||
* \param pull, if false push mode
|
* \param pull if false push mode
|
||||||
*/
|
*/
|
||||||
void start(int volume, bool pull = true);
|
void start(int volume, bool pull = true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user