mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Also added new icon as application and table view icon.
This commit is contained in:
@@ -25,20 +25,14 @@ namespace BlackCore
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* \brief Service name
|
||||
* \return
|
||||
*/
|
||||
//! Service name
|
||||
static const QString &InterfaceName()
|
||||
{
|
||||
static QString s(BLACKCORE_CONTEXTAPPLICATION_INTERFACENAME);
|
||||
return s;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Service path
|
||||
* \return
|
||||
*/
|
||||
//! Service path
|
||||
static const QString &ObjectPath()
|
||||
{
|
||||
static QString s(BLACKCORE_CONTEXTAPPLICATION_OBJECTPATH);
|
||||
@@ -50,10 +44,7 @@ namespace BlackCore
|
||||
* \param parent
|
||||
*/
|
||||
IContextApplication(QObject *parent = nullptr) : QObject(parent) {}
|
||||
|
||||
/*!
|
||||
* Destructor
|
||||
*/
|
||||
//! Destructor
|
||||
virtual ~IContextApplication() {}
|
||||
|
||||
signals:
|
||||
@@ -68,13 +59,8 @@ namespace BlackCore
|
||||
|
||||
public slots:
|
||||
|
||||
/*!
|
||||
* \brief Ping
|
||||
* \param token
|
||||
* \return
|
||||
*/
|
||||
//! \brief Ping a token, used to check if application is alive
|
||||
virtual qint64 ping(qint64 token) const = 0;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -30,16 +30,11 @@ namespace BlackCore
|
||||
*/
|
||||
CContextApplication(QObject *parent = nullptr);
|
||||
|
||||
/*!
|
||||
* Destructor
|
||||
*/
|
||||
//! Destructor
|
||||
virtual ~CContextApplication() {}
|
||||
|
||||
/*!
|
||||
* \brief Register myself in DBus
|
||||
* \param server
|
||||
*/
|
||||
void registerWithDBus(CDBusServer *server)
|
||||
//! Register myself in DBus
|
||||
CContextApplication *registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
server->addObject(IContextApplication::ObjectPath(), this);
|
||||
}
|
||||
|
||||
@@ -29,19 +29,14 @@ namespace BlackCore
|
||||
*/
|
||||
CContextApplicationProxy(const QString &serviceName, QDBusConnection &connection, QObject *parent = nullptr);
|
||||
|
||||
/*!
|
||||
* Destructor
|
||||
*/
|
||||
//! Destructor
|
||||
virtual ~CContextApplicationProxy() {}
|
||||
|
||||
private:
|
||||
BlackMisc::CGenericDBusInterface *m_dBusInterface;
|
||||
|
||||
/*!
|
||||
* Relay connection signals to local signals
|
||||
* No idea why this has to be wired and is not done automatically
|
||||
* \param connection
|
||||
*/
|
||||
//! Relay connection signals to local signals
|
||||
//! No idea why this has to be wired and is not done automatically
|
||||
void relaySignals(const QString &serviceName, QDBusConnection &connection);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -28,47 +28,31 @@ namespace BlackCore
|
||||
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTAUDIO_INTERFACENAME)
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Interface name
|
||||
* \return
|
||||
*/
|
||||
//! \brief Interface name
|
||||
static const QString &InterfaceName()
|
||||
{
|
||||
static QString s(BLACKCORE_CONTEXTAUDIO_INTERFACENAME);
|
||||
return s;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Object path
|
||||
* \return
|
||||
*/
|
||||
//! \brief Object path
|
||||
static const QString &ObjectPath()
|
||||
{
|
||||
static QString s(BLACKCORE_CONTEXTAUDIO_OBJECTPATH);
|
||||
return s;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructor
|
||||
* \param parent
|
||||
*/
|
||||
//! \brief Constructor
|
||||
IContextAudio(QObject *parent = nullptr) : QObject(parent) {}
|
||||
|
||||
/*!
|
||||
* Destructor
|
||||
*/
|
||||
//! \brief Destructor
|
||||
virtual ~IContextAudio() {}
|
||||
|
||||
/*!
|
||||
* \brief Using local objects?
|
||||
* \return
|
||||
*/
|
||||
//! \brief Using local objects?
|
||||
virtual bool usingLocalObjects() const = 0;
|
||||
|
||||
signals:
|
||||
/*!
|
||||
* \brief Audio test has been completed
|
||||
*/
|
||||
//! \brief Audio test has been completed
|
||||
void audioTestCompleted();
|
||||
|
||||
public slots:
|
||||
@@ -80,16 +64,10 @@ namespace BlackCore
|
||||
*/
|
||||
virtual void setOwnAircraft(const BlackMisc::Aviation::CAircraft &ownAiricraft) = 0;
|
||||
|
||||
/*!
|
||||
* Get voice rooms for COM1, COM2:
|
||||
* From this connection audio status can be obtained
|
||||
*/
|
||||
//! Get voice rooms for COM1, COM2:
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const = 0;
|
||||
|
||||
/*!
|
||||
* Get voice rooms for COM1, COM2, but without latest audio status
|
||||
* \return all voice rooms
|
||||
*/
|
||||
//! Get voice rooms for COM1, COM2, but without latest audio status
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const = 0;
|
||||
|
||||
/*!
|
||||
@@ -106,39 +84,25 @@ namespace BlackCore
|
||||
*/
|
||||
virtual BlackMisc::Audio::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Set voice rooms
|
||||
*/
|
||||
//! Set voice rooms
|
||||
virtual void setComVoiceRooms(const BlackMisc::Audio::CVoiceRoom &voiceRoomCom1, const BlackMisc::Audio::CVoiceRoom &voiceRoomCom2) = 0;
|
||||
|
||||
/*!
|
||||
* Leave all voice rooms
|
||||
*/
|
||||
//! Leave all voice rooms
|
||||
virtual void leaveAllVoiceRooms() = 0;
|
||||
|
||||
/*!
|
||||
* \brief COM1 room users callsigns
|
||||
*/
|
||||
//! COM1 room users callsigns
|
||||
virtual BlackMisc::Aviation::CCallsignList getCom1RoomCallsigns() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief COM2 room users callsigns
|
||||
*/
|
||||
//! COM2 room users callsigns
|
||||
virtual BlackMisc::Aviation::CCallsignList getCom2RoomCallsigns() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief COM1 room users
|
||||
*/
|
||||
//! COM1 room users
|
||||
virtual BlackMisc::Network::CUserList getCom1RoomUsers() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief COM2 room users
|
||||
*/
|
||||
//! COM2 room users
|
||||
virtual BlackMisc::Network::CUserList getCom2RoomUsers() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Audio devices
|
||||
*/
|
||||
//! Audio devices
|
||||
virtual BlackMisc::Audio::CAudioDeviceList getAudioDevices() const = 0;
|
||||
|
||||
/*!
|
||||
@@ -160,14 +124,10 @@ namespace BlackCore
|
||||
*/
|
||||
virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2) = 0;
|
||||
|
||||
/*!
|
||||
* \brief Is muted?
|
||||
*/
|
||||
//! Is muted?
|
||||
virtual bool isMuted() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Play SELCAL tone
|
||||
*/
|
||||
//! Play SELCAL tone
|
||||
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const = 0;
|
||||
|
||||
/*!
|
||||
@@ -176,24 +136,16 @@ namespace BlackCore
|
||||
*/
|
||||
virtual void playNotification(uint notification) const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Microphone test
|
||||
*/
|
||||
//! Microphone test
|
||||
virtual void runMicrophoneTest() = 0;
|
||||
|
||||
/*!
|
||||
* \brief Microphone test
|
||||
*/
|
||||
//! Microphone test
|
||||
virtual void runSquelchTest() = 0;
|
||||
|
||||
/*!
|
||||
* \brief Get the microphone test result
|
||||
*/
|
||||
//! Get the microphone test result
|
||||
virtual QString getMicrophoneTestResult() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Get the squelch value
|
||||
*/
|
||||
//! Get the squelch value
|
||||
virtual double getSquelchValue() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -29,11 +29,8 @@ namespace BlackCore
|
||||
//! \brief Destructor
|
||||
virtual ~CContextAudio();
|
||||
|
||||
/*!
|
||||
* \brief Register myself in DBus
|
||||
* \param server DBus server
|
||||
*/
|
||||
void registerWithDBus(CDBusServer *server)
|
||||
//! \brief Register myself in DBus
|
||||
CContextAudio *registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
Q_ASSERT(server);
|
||||
server->addObject(IContextAudio::ObjectPath(), this);
|
||||
|
||||
@@ -33,9 +33,7 @@ namespace BlackCore
|
||||
*/
|
||||
CContextAudioProxy(const QString &serviceName, QDBusConnection &connection, QObject *parent = nullptr);
|
||||
|
||||
/*!
|
||||
* Destructor
|
||||
*/
|
||||
//! Destructor
|
||||
virtual ~CContextAudioProxy() {}
|
||||
|
||||
//! \copydoc IContextVoice::usingLocalObjects()
|
||||
@@ -44,11 +42,8 @@ namespace BlackCore
|
||||
private:
|
||||
BlackMisc::CGenericDBusInterface *m_dBusInterface;
|
||||
|
||||
/*!
|
||||
* Relay connection signals to local signals
|
||||
* No idea why this has to be wired and is not done automatically
|
||||
* \param connection
|
||||
*/
|
||||
//! Relay connection signals to local signals
|
||||
//! No idea why this has to be wired and is not done automatically
|
||||
void relaySignals(const QString &serviceName, QDBusConnection &connection);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -68,15 +68,16 @@ namespace BlackCore
|
||||
*/
|
||||
void statusMessages(const BlackMisc::CStatusMessageList &messages);
|
||||
|
||||
//! \brief ATC station (online) list has been changed
|
||||
//! ATC station (online) list has been changed
|
||||
void changedAtcStationsOnline();
|
||||
|
||||
//! \brief ATC station (booked) list has been changed
|
||||
//! ATC station (booked) list has been changed
|
||||
void changedAtcStationsBooked();
|
||||
|
||||
//! \brief Aircraft list has been changed
|
||||
//! Aircraft list has been changed
|
||||
void changedAircraftsInRange();
|
||||
|
||||
<<<<<<< HEAD
|
||||
/*!
|
||||
* \brief Aircraft situation update
|
||||
* \param callsign
|
||||
@@ -85,7 +86,7 @@ namespace BlackCore
|
||||
*/
|
||||
void aircraftSituationUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! \brief Terminated connection
|
||||
//! Terminated connection
|
||||
void connectionTerminated();
|
||||
|
||||
/*!
|
||||
@@ -97,15 +98,12 @@ namespace BlackCore
|
||||
*/
|
||||
void connectionStatusChanged(uint from, uint to);
|
||||
|
||||
/*!
|
||||
* \brief Text messages (also private chat messages)
|
||||
* \param textMessages message list
|
||||
*/
|
||||
//! Text messages received (also private chat messages, rfaio channel messages)
|
||||
void textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages);
|
||||
|
||||
public slots:
|
||||
|
||||
//! \brief Reload bookings from booking service
|
||||
//! Reload bookings from booking service
|
||||
virtual void readAtcBookingsFromSource() const = 0;
|
||||
|
||||
/*!
|
||||
@@ -114,19 +112,19 @@ namespace BlackCore
|
||||
*/
|
||||
virtual const BlackMisc::Aviation::CAtcStationList getAtcStationsOnline() const = 0;
|
||||
|
||||
//! \brief ATC list, with booked controllers
|
||||
//! ATC list, with booked controllers
|
||||
virtual const BlackMisc::Aviation::CAtcStationList getAtcStationsBooked() const = 0 ;
|
||||
|
||||
//! \brief Aircraft list
|
||||
//! Aircraft list
|
||||
virtual const BlackMisc::Aviation::CAircraftList getAircraftsInRange() const = 0;
|
||||
|
||||
//! \brief Get all users
|
||||
//! Get all users
|
||||
virtual BlackMisc::Network::CUserList getUsers() const = 0;
|
||||
|
||||
//! \brief Users for given callsigns, e.g. for voice room resolution
|
||||
//! Users for given callsigns, e.g. for voice room resolution
|
||||
virtual BlackMisc::Network::CUserList getUsersForCallsigns(const BlackMisc::Aviation::CCallsignList &callsigns) const = 0;
|
||||
|
||||
//! \brief Get own aircraft
|
||||
//! Get own aircraft
|
||||
virtual BlackMisc::Aviation::CAircraft getOwnAircraft() const = 0;
|
||||
|
||||
/*!
|
||||
@@ -152,16 +150,16 @@ namespace BlackCore
|
||||
*/
|
||||
virtual BlackMisc::CStatusMessageList setOwnAircraft(const BlackMisc::Aviation::CAircraft &aircraft) = 0;
|
||||
|
||||
//! \brief Own position, be aware height is terrain height
|
||||
//! Own position, be aware height is terrain height
|
||||
virtual void updateOwnPosition(const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::Aviation::CAltitude &altitude) = 0;
|
||||
|
||||
//! \brief Complete situation update
|
||||
//! Complete situation update
|
||||
virtual void updateOwnSituation(const BlackMisc::Aviation::CAircraftSituation &situation) = 0;
|
||||
|
||||
//! \brief Update own cockpit
|
||||
//! Update own cockpit
|
||||
virtual void updateOwnCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder) = 0;
|
||||
|
||||
//! \brief Text messages (radio and private chat messages)
|
||||
//! Text messages (radio and private chat messages)
|
||||
virtual void sendTextMessages(const BlackMisc::Network::CTextMessageList &textMessages) = 0;
|
||||
|
||||
/*!
|
||||
@@ -171,16 +169,16 @@ namespace BlackCore
|
||||
*/
|
||||
virtual BlackMisc::Aviation::CInformationMessage getMetar(const QString &airportIcaoCode) = 0;
|
||||
|
||||
//! \brief Use the selected COM1/2 frequencies, and get the corresponding voice room for it
|
||||
//! Use the selected COM1/2 frequencies, and get the corresponding voice room for it
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getSelectedVoiceRooms() const = 0;
|
||||
|
||||
//! \brief Use the selected COM1/2 frequencies, and get the corresponding ATC stations for it
|
||||
//! Use the selected COM1/2 frequencies, and get the corresponding ATC stations for it
|
||||
virtual BlackMisc::Aviation::CAtcStationList getSelectedAtcStations() const = 0;
|
||||
|
||||
//! \brief Request data updates (pilot's frequencies, ATIS, ..)
|
||||
//! Request data updates (pilot's frequencies, ATIS, ..)
|
||||
virtual void requestDataUpdates() = 0;
|
||||
|
||||
//! \brief Request ATIS updates (for all stations)
|
||||
//! Request ATIS updates (for all stations)
|
||||
virtual void requestAtisUpdates() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,8 +33,7 @@ namespace BlackCore
|
||||
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTSETTINGS_INTERFACENAME)
|
||||
|
||||
public:
|
||||
|
||||
//! \brief Settings type
|
||||
//! Settings type
|
||||
enum SettingsType
|
||||
{
|
||||
SettingsHotKeys,
|
||||
@@ -121,10 +120,10 @@ namespace BlackCore
|
||||
|
||||
public slots:
|
||||
|
||||
//! \brief Network settings
|
||||
//! Network settings
|
||||
virtual BlackMisc::Settings::CSettingsNetwork getNetworkSettings() const = 0;
|
||||
|
||||
//! \brief Hotkeys
|
||||
//! Hotkeys
|
||||
virtual BlackMisc::Hardware::CKeyboardKeyList getHotkeys() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,10 +32,7 @@ namespace BlackCore
|
||||
* \brief DBus version constructor
|
||||
*/
|
||||
CContextSettingsProxy(const QString &serviceName, QDBusConnection &connection, QObject *parent = nullptr);
|
||||
|
||||
/*!
|
||||
* Destructor
|
||||
*/
|
||||
//! \brief Destructor
|
||||
virtual ~CContextSettingsProxy() {}
|
||||
|
||||
|
||||
@@ -54,11 +51,8 @@ namespace BlackCore
|
||||
private:
|
||||
BlackMisc::CGenericDBusInterface *m_dBusInterface;
|
||||
|
||||
/*!
|
||||
* Relay connection signals to local signals
|
||||
* No idea why this has to be wired and is not done automatically
|
||||
* \param connection
|
||||
*/
|
||||
//! Relay connection signals to local signals
|
||||
//! No idea why this has to be wired and is not done automatically
|
||||
void relaySignals(const QString &serviceName, QDBusConnection &connection);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -24,20 +24,14 @@ namespace BlackCore
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* \brief Service name
|
||||
* \return
|
||||
*/
|
||||
//! \brief Service name
|
||||
static const QString &InterfaceName()
|
||||
{
|
||||
static QString s(BLACKCORE_CONTEXTSIMULATOR_INTERFACENAME);
|
||||
return s;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Service path
|
||||
* \return
|
||||
*/
|
||||
//! \brief Service path
|
||||
static const QString &ObjectPath()
|
||||
{
|
||||
static QString s(BLACKCORE_CONTEXTSIMULATOR_OBJECTPATH);
|
||||
@@ -57,10 +51,7 @@ namespace BlackCore
|
||||
virtual bool usingLocalObjects() const = 0;
|
||||
|
||||
signals:
|
||||
/*!
|
||||
* \brief Emitted when the simulator connection changes
|
||||
* \param value
|
||||
*/
|
||||
//! Emitted when the simulator connection changes
|
||||
void connectionChanged(bool value);
|
||||
|
||||
public slots:
|
||||
@@ -69,12 +60,10 @@ namespace BlackCore
|
||||
virtual bool isConnected() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Get user aircraft value object
|
||||
* \return
|
||||
*/
|
||||
//! Get user aircraft value object
|
||||
virtual BlackMisc::Aviation::CAircraft getOwnAircraft() const = 0;
|
||||
};
|
||||
|
||||
} // namespace BlackCore
|
||||
|
||||
#endif // BLACKCORE_CONTEXTSIMULATOR_H
|
||||
#endif // guard
|
||||
|
||||
@@ -31,10 +31,8 @@ namespace BlackCore
|
||||
virtual ~CContextSimulator();
|
||||
|
||||
/*!
|
||||
* \brief Register myself in DBus
|
||||
* \param server
|
||||
*/
|
||||
void registerWithDBus(CDBusServer *server)
|
||||
//! Register myself in DBus
|
||||
CContextSimulator *registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
Q_ASSERT(server);
|
||||
server->addObject(CContextSimulator::ObjectPath(), this);
|
||||
@@ -77,10 +75,7 @@ namespace BlackCore
|
||||
//! \copydoc IContextSimulator::updateOwnAircraft()
|
||||
virtual void updateOwnAircraft();
|
||||
|
||||
/*!
|
||||
* \brief Set new connection status
|
||||
* \param value
|
||||
*/
|
||||
//! Set new connection status
|
||||
void setConnectionStatus(bool value);
|
||||
|
||||
private:
|
||||
|
||||
@@ -36,11 +36,7 @@ namespace BlackCore
|
||||
private:
|
||||
BlackMisc::CGenericDBusInterface *m_dBusInterface;
|
||||
|
||||
/*!
|
||||
* Relay connection signals to local signals
|
||||
* No idea why this has to be wired and is not done automatically
|
||||
* \param connection
|
||||
*/
|
||||
//! Relay connection signals to local signals
|
||||
void relaySignals(const QString &serviceName, QDBusConnection &connection);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -5,125 +5,80 @@
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
// forward declaration, see review
|
||||
// https://dev.vatsim-germany.org/boards/22/topics/1350?r=1359#message-1359
|
||||
class CDBusServer;
|
||||
class CContextNetwork;
|
||||
class CContextAudio;
|
||||
class CContextSettings;
|
||||
class CContextApplication;
|
||||
class CContextSimulator;
|
||||
class IContextNetwork;
|
||||
class IContextAudio;
|
||||
class IContextSettings;
|
||||
class IContextApplication;
|
||||
class IContextSimulator;
|
||||
// forward declaration, see review
|
||||
// https://dev.vatsim-germany.org/boards/22/topics/1350?r=1359#message-1359
|
||||
class CDBusServer;
|
||||
class CContextNetwork;
|
||||
class CContextAudio;
|
||||
class CContextSettings;
|
||||
class CContextApplication;
|
||||
class CContextSimulator;
|
||||
class IContextNetwork;
|
||||
class IContextAudio;
|
||||
class IContextSettings;
|
||||
class IContextApplication;
|
||||
class IContextSimulator;
|
||||
|
||||
/*!
|
||||
* \brief The CCoreRuntime class
|
||||
*/
|
||||
class CCoreRuntime : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
//! \brief The CCoreRuntime class
|
||||
class CCoreRuntime : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
bool m_init; /*!< flag */
|
||||
CDBusServer *m_dbusServer;
|
||||
CContextNetwork *m_contextNetwork;
|
||||
CContextAudio *m_contextAudio;
|
||||
CContextSettings *m_contextSettings;
|
||||
CContextApplication *m_contextApplication;
|
||||
CContextSimulator *m_contextSimulator;
|
||||
private:
|
||||
bool m_init; /*!< flag */
|
||||
CDBusServer *m_dbusServer;
|
||||
CContextNetwork *m_contextNetwork;
|
||||
CContextAudio *m_contextAudio;
|
||||
CContextSettings *m_contextSettings;
|
||||
CContextApplication *m_contextApplication;
|
||||
CContextSimulator *m_contextSimulator;
|
||||
|
||||
//! \brief Init
|
||||
void init(bool withDbus);
|
||||
|
||||
/*!
|
||||
* \brief Init
|
||||
* \param withDbus
|
||||
*/
|
||||
void init(bool withDbus);
|
||||
public:
|
||||
//! \brief Constructor
|
||||
CCoreRuntime(bool withDbus = true, QObject *parent = nullptr);
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Constructor
|
||||
* \param withDbus
|
||||
* \param parent
|
||||
*/
|
||||
CCoreRuntime(bool withDbus = true, QObject *parent = nullptr);
|
||||
//! \brief Destructor
|
||||
virtual ~CCoreRuntime() {}
|
||||
|
||||
/*!
|
||||
* \brief Destructor
|
||||
*/
|
||||
virtual ~CCoreRuntime() {}
|
||||
//! \brief DBus server
|
||||
const CDBusServer *getDBusServer() const
|
||||
{
|
||||
return this->m_dbusServer;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief DBus server
|
||||
* \return
|
||||
*/
|
||||
const CDBusServer *getDBusServer() const {
|
||||
return this->m_dbusServer;
|
||||
}
|
||||
//! \brief Context for network
|
||||
IContextNetwork *getIContextNetwork();
|
||||
|
||||
/*!
|
||||
* \brief Context for network
|
||||
* \return
|
||||
*/
|
||||
IContextNetwork *getIContextNetwork();
|
||||
//! \brief Context for network
|
||||
const IContextNetwork *getIContextNetwork() const;
|
||||
|
||||
/*!
|
||||
* \brief Context for network
|
||||
* \return
|
||||
*/
|
||||
const IContextNetwork *getIContextNetwork() const;
|
||||
//! \brief Context for network
|
||||
IContextAudio *getIContextAudio();
|
||||
|
||||
/*!
|
||||
* \brief Context for network
|
||||
* \return
|
||||
*/
|
||||
IContextAudio *getIContextAudio();
|
||||
//! \brief Context for network
|
||||
const IContextAudio *getIContextAudio() const;
|
||||
|
||||
/*!
|
||||
* \brief Context for network
|
||||
* \return
|
||||
*/
|
||||
const IContextAudio *getIContextAudio() const;
|
||||
//! \brief Settings
|
||||
IContextSettings *getIContextSettings();
|
||||
|
||||
//! \brief Settings
|
||||
const IContextSettings *getIContextSettings() const;
|
||||
|
||||
/*!
|
||||
* \brief Settings
|
||||
* \return
|
||||
*/
|
||||
IContextSettings *getIContextSettings();
|
||||
//! \brief Context for application
|
||||
const IContextApplication *getIContextApplication() const;
|
||||
|
||||
/*!
|
||||
* \brief Settings
|
||||
* \return
|
||||
*/
|
||||
const IContextSettings *getIContextSettings() const;
|
||||
//! \brief Application
|
||||
IContextApplication *getIContextApplication();
|
||||
|
||||
/*!
|
||||
* \brief Context for application
|
||||
* \return
|
||||
*/
|
||||
const IContextApplication *getIContextApplication() const;
|
||||
//! \brief Context for simulator
|
||||
const IContextSimulator *getIContextSimulator() const;
|
||||
|
||||
/*!
|
||||
* \brief Application
|
||||
* \return
|
||||
*/
|
||||
IContextApplication *getIContextApplication();
|
||||
//! \brief Simulator
|
||||
IContextSimulator *getIContextSimulator();
|
||||
|
||||
/*!
|
||||
* \brief Context for simulator
|
||||
* \return
|
||||
*/
|
||||
const IContextSimulator *getIContextSimulator() const;
|
||||
|
||||
/*!
|
||||
* \brief Simulator
|
||||
* \return
|
||||
*/
|
||||
IContextSimulator *getIContextSimulator();
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
#endif // guard
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BlackCore
|
||||
|
||||
/*!
|
||||
* \brief Custom DBusServer
|
||||
* \details This class implements a custom DBusServer for DBus peer connections
|
||||
* \details This class implements a custom DBusServer for DBus peer connections, but can also be used as session or system bus
|
||||
*/
|
||||
class CDBusServer : public QObject
|
||||
{
|
||||
@@ -33,9 +33,7 @@ namespace BlackCore
|
||||
//! \brief Service name of DBus serve
|
||||
static const QString ServiceName;
|
||||
|
||||
/*!
|
||||
* \brief Server mode, normally P2P, but can be changed for debugging / testing
|
||||
*/
|
||||
//! \brief Server mode, normally P2P, but can be changed for debugging / testing
|
||||
enum ServerMode
|
||||
{
|
||||
SERVERMODE_P2P,
|
||||
@@ -49,24 +47,13 @@ namespace BlackCore
|
||||
QMap<QString, QObject *> m_objects; //!< Mapping of all exposed objects
|
||||
QMap<QString, QDBusConnection> m_DBusConnections; //!< Mapping of all DBusConnection objects
|
||||
|
||||
/*!
|
||||
* \brief Check if address means a real server with P2P connection
|
||||
* \param address
|
||||
* \return
|
||||
*/
|
||||
//! \brief Check if address means a real server with P2P connection
|
||||
static bool isP2P(const QString &address);
|
||||
|
||||
/*!
|
||||
* \brief Get the class info
|
||||
* \param object
|
||||
* \return
|
||||
*/
|
||||
//! \brief Get the class info
|
||||
static const QString getClassInfo(QObject *object);
|
||||
|
||||
/*!
|
||||
* \brief Register options with connection
|
||||
* \return
|
||||
*/
|
||||
//! \brief Register options with connection
|
||||
static const QDBusConnection::RegisterOptions &RegisterOptions()
|
||||
{
|
||||
static QDBusConnection::RegisterOptions opt = QDBusConnection::ExportAdaptors | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots;
|
||||
@@ -80,55 +67,35 @@ namespace BlackCore
|
||||
//!! \brief Adds a QObject to be exposed to DBus
|
||||
void addObject(const QString &name, QObject *object);
|
||||
|
||||
/*!
|
||||
* \brief Last error
|
||||
* \return
|
||||
*/
|
||||
//! \brief Last error
|
||||
QDBusError lastError() const;
|
||||
|
||||
/*!
|
||||
* \brief Connected?
|
||||
* \return
|
||||
*/
|
||||
//! \brief Connected?
|
||||
bool isConnected() const
|
||||
{
|
||||
return this->m_busServer.isConnected();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief address
|
||||
* \return
|
||||
*/
|
||||
//! \brief address
|
||||
QString address() const
|
||||
{
|
||||
|
||||
return this->m_busServer.address();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Connection by name
|
||||
* \param connectionName
|
||||
* \return
|
||||
*/
|
||||
//! \brief Connection by name
|
||||
const QDBusConnection getDbusConnection(const QString &connectionName) const
|
||||
{
|
||||
return this->m_DBusConnections.value(connectionName, CDBusServer::defaultConnection());
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Get DBbus connections
|
||||
* \return
|
||||
*/
|
||||
//! \brief Get DBbus connections
|
||||
const QList<QDBusConnection> getDbusConnections() const
|
||||
{
|
||||
// http://stackoverflow.com/questions/1124340/any-ideas-why-qhash-and-qmap-return-const-t-instead-of-const-t
|
||||
return this->m_DBusConnections.values();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Default connection
|
||||
* \return
|
||||
*/
|
||||
//! \brief Default connection
|
||||
static const QDBusConnection &defaultConnection()
|
||||
{
|
||||
static QDBusConnection defaultConnection("default");
|
||||
@@ -137,11 +104,7 @@ namespace BlackCore
|
||||
|
||||
private slots:
|
||||
|
||||
/*!
|
||||
* \brief Called when a new DBus client has connected
|
||||
* \param connection
|
||||
* \return
|
||||
*/
|
||||
//! \brief Called when a new DBus client has connected
|
||||
bool newConnection(const QDBusConnection &connection);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user