mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T295, moved getDbClientPingServiceUrl to global setup
This commit is contained in:
@@ -31,6 +31,7 @@ namespace BlackCore
|
||||
namespace Data
|
||||
{
|
||||
CGlobalSetup::CGlobalSetup() :
|
||||
CIdentifiable("CGlobalSetup"),
|
||||
ITimestampBased(0)
|
||||
{
|
||||
this->initDefaultValues();
|
||||
@@ -46,7 +47,7 @@ namespace BlackCore
|
||||
m_vatsimDataFileUrls = CUrlList({ "http://info.vroute.net/vatsim-data.txt" });
|
||||
m_sharedUrls = CUrlList(
|
||||
{
|
||||
"https://datastore.swift-project.org/shared",
|
||||
"https://datastore.swift-project.net/shared/",
|
||||
"http://www.siliconmind.de/datastore/shared/",
|
||||
"http://swift-project.org/datastore/shared/"
|
||||
});
|
||||
@@ -143,6 +144,19 @@ namespace BlackCore
|
||||
withSwitchedScheme("https", m_dbHttpsPort);
|
||||
}
|
||||
|
||||
CUrl CGlobalSetup::getDbClientPingServiceUrl(PingType type) const
|
||||
{
|
||||
CUrl pingUrl = this->getDbClientPingServiceUrl();
|
||||
if (pingUrl.isEmpty()) { CUrl(); }
|
||||
|
||||
pingUrl.appendQuery("uuid", this->identifier().toUuidString());
|
||||
pingUrl.appendQuery("application", sApp->getApplicationNameAndVersion());
|
||||
if (type.testFlag(PingLogoff)) { pingUrl.appendQuery("logoff", "true"); }
|
||||
if (type.testFlag(PingShutdown)) { pingUrl.appendQuery("shutdown", "true"); }
|
||||
if (type.testFlag(PingStarted)) { pingUrl.appendQuery("started", "true"); }
|
||||
return pingUrl;
|
||||
}
|
||||
|
||||
CUrl CGlobalSetup::getAlphaXSwiftBusFilesServiceUrl() const
|
||||
{
|
||||
return getDbRootDirectoryUrl().
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
#define BLACKCORE_DATA_GLOBALSETUP_H
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackmisc/datacache.h"
|
||||
#include "blackmisc/metaclass.h"
|
||||
#include "blackmisc/network/serverlist.h"
|
||||
#include "blackmisc/network/url.h"
|
||||
#include "blackmisc/network/urllist.h"
|
||||
#include "blackmisc/identifiable.h"
|
||||
#include "blackmisc/datacache.h"
|
||||
#include "blackmisc/metaclass.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/timestampbased.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
@@ -34,6 +35,7 @@ namespace BlackCore
|
||||
//! \note also called the bootstrap file as it is required once to get information where all the data are located
|
||||
class BLACKCORE_EXPORT CGlobalSetup :
|
||||
public BlackMisc::CValueObject<CGlobalSetup>,
|
||||
public BlackMisc::CIdentifiable,
|
||||
public BlackMisc::ITimestampBased
|
||||
{
|
||||
public:
|
||||
@@ -61,6 +63,17 @@ namespace BlackCore
|
||||
IndexMappingMinimumVersion
|
||||
};
|
||||
|
||||
//! Add info when pinging
|
||||
enum PingTypeFlag
|
||||
{
|
||||
PingUnspecific = 0,
|
||||
PingLogoff = 1 << 0,
|
||||
PingStarted = 1 << 1,
|
||||
PingShutdown = 1 << 2,
|
||||
PingCompleteShutdown = PingLogoff | PingShutdown
|
||||
};
|
||||
Q_DECLARE_FLAGS(PingType, PingTypeFlag)
|
||||
|
||||
//! Default constructor
|
||||
CGlobalSetup();
|
||||
|
||||
@@ -126,6 +139,9 @@ namespace BlackCore
|
||||
//! \remark based on getDbRootDirectoryUrl
|
||||
BlackMisc::Network::CUrl getDbClientPingServiceUrl() const;
|
||||
|
||||
//! Ping the DB server, fire and forget (no feedback etc)
|
||||
BlackMisc::Network::CUrl getDbClientPingServiceUrl(PingType type) const;
|
||||
|
||||
//! alpha XSwiftBus files available
|
||||
BlackMisc::Network::CUrl getAlphaXSwiftBusFilesServiceUrl() const;
|
||||
|
||||
@@ -275,5 +291,8 @@ namespace BlackCore
|
||||
} // ns
|
||||
|
||||
Q_DECLARE_METATYPE(BlackCore::Data::CGlobalSetup)
|
||||
Q_DECLARE_METATYPE(BlackCore::Data::CGlobalSetup::PingTypeFlag)
|
||||
Q_DECLARE_METATYPE(BlackCore::Data::CGlobalSetup::PingType)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::Data::CGlobalSetup::PingType)
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user