mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
refs #452, data readers / writers for DB (via web services)
* flags for readers (which reader is reading specific entities etc.) * web data services: bundling multiple readers (webdataservices) and implementing IWebDataReaderProvider * readers now able to read single entities
This commit is contained in:
committed by
Mathew Sutcliffe
parent
33330394a9
commit
07c6370819
60
src/blackcore/databasewriter.h
Normal file
60
src/blackcore/databasewriter.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef BLACKCORE_DATABASE_WRITER_H
|
||||
#define BLACKCORE_DATABASE_WRITER_H
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackmisc/threadedreader.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
|
||||
#include <QNetworkReply>
|
||||
#include <QJsonArray>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
//! Write to the swift DB
|
||||
class BLACKCORE_EXPORT CDatabaseWriter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
CDatabaseWriter(const QString &protocol, const QString &server, const QString &baseUrl, QObject *parent);
|
||||
|
||||
//! Write model to DB
|
||||
BlackMisc::CStatusMessageList asyncWriteModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
//! Shutdown
|
||||
void gracefulShutdown();
|
||||
|
||||
private slots:
|
||||
//! Post response
|
||||
void ps_postResponse(QNetworkReply *nwReplyPtr);
|
||||
|
||||
private:
|
||||
QString m_modelUrl;
|
||||
QNetworkAccessManager *m_networkManager = nullptr;
|
||||
QNetworkReply *m_pendingReply = nullptr;
|
||||
bool m_shutdown = false;
|
||||
bool m_phpDebug = true;
|
||||
|
||||
//! URL model web service
|
||||
static QString getModelWriteUrl(const QString &protocol, const QString &server, const QString &baseUrl);
|
||||
|
||||
//! Split data array
|
||||
static QList<QByteArray> splitData(const QByteArray &data, int size);
|
||||
|
||||
};
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user