2#include <NDEVR/NtpClient.h>
3#include <NDEVR/ItemDownloader.h>
4#include <NDEVR/String.h>
6#include <NDEVR/Thread.h>
7#include <QNetworkRequest>
8#include <QNetworkAccessManager>
9#include <QNetworkReply>
13 static uint02 ntp_rx_port = 42912;
47 #if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
48 connect(
m_reply, &QNetworkReply::socketStartedConnecting,
this
50 connect(
m_reply, &QNetworkReply::requestSent,
this
52 connect(
m_reply, &QNetworkReply::errorOccurred,
this
53 , [
this](QNetworkReply::NetworkError error)
58 connect(
m_reply, &QNetworkReply::error,
this
61 connect(
m_reply, &QNetworkReply::metaDataChanged,
this
63 connect(
m_reply, &QNetworkReply::finished,
this
65 connect(
m_reply, &QNetworkReply::redirectAllowed,
this
67 connect(
m_reply, &QNetworkReply::uploadProgress,
this
68 , [
this](qint64 bytesSent, qint64 bytesTotal) {emit
uploadProgressSignal(bytesSent, bytesTotal); });
69 connect(
m_reply, &QNetworkReply::downloadProgress,
this
71 if (
m_reply->error() != QNetworkReply::NoError)
88 virtual QByteArray
data()
override
106 qfile.open(QIODeviceBase::ReadOnly);
128 QUrl urlup(target.
url.
getAs<QString>());
135 return QNetworkRequest(urlup);
#define lib_assert(expression, message)
Asserts some logic in the code. Disabled in non debug mode by default. Can be re-enabled in release u...
Definition LibAssert.h:70
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
constexpr t_index_type size() const
Definition Buffer.hpp:1461
decltype(auto) begin()
Definition Buffer.hpp:504
NDEVR_BASE_API void throwIfNotExist() const
Definition File.cpp:794
Definition ItemDownloader.h:96
Definition ItemDownloader.h:47
void errorOccurredSignal(int error)
void downloadProgressSignal(qint64 bytesReceived, qint64 bytesTotal)
void uploadProgressSignal(qint64 bytesSent, qint64 bytesTotal)
void redirectAllowedSignal()
void socketStartedConnectingSignal()
void metaDataChangedSignal()
Definition NtpClient.h:23
Definition QTNetworkRequest.h:123
NetworkRequest * uploadToURL(const WebTarget &request, const File &data) override
Definition QTNetworkRequest.h:152
virtual TimeRequest * networkTimeFromURL(const String &url, uint02 port) override
Definition QTNetworkRequest.h:160
QNetworkAccessManager * m_manager
Definition QTNetworkRequest.h:166
QNetworkRequest ConvertToRequest(const WebTarget &target)
Definition QTNetworkRequest.h:126
virtual NetworkRequest * downloadFromURL(const WebTarget &url) override
Definition QTNetworkRequest.h:137
virtual NetworkRequest * uploadToURL(const WebTarget &request, const Buffer< uint01 > &data) override
Definition QTNetworkRequest.h:144
Definition QTNetworkRequest.h:15
QtNetworkRequest(const QNetworkRequest &request, QNetworkAccessManager *manager)
Definition QTNetworkRequest.h:18
void setData(const File &data)
Definition QTNetworkRequest.h:29
QNetworkAccessManager * m_manager
Definition QTNetworkRequest.h:118
virtual void close() override
Definition QTNetworkRequest.h:33
void setReply(QNetworkReply *reply)
Definition QTNetworkRequest.h:43
virtual bool isRunning() override
Definition QTNetworkRequest.h:81
virtual QByteArray data() override
Definition QTNetworkRequest.h:88
QNetworkRequest m_request
Definition QTNetworkRequest.h:116
Buffer< uint01 > m_data
Definition QTNetworkRequest.h:119
virtual void abort() override
Definition QTNetworkRequest.h:38
QNetworkReply * m_reply
Definition QTNetworkRequest.h:117
File m_file
Definition QTNetworkRequest.h:120
void setData(const Buffer< uint01 > &data)
Definition QTNetworkRequest.h:25
virtual bool start() override
Definition QTNetworkRequest.h:95
t_type getAs() const
Definition String.h:334
static bool IsPrimaryThread()
Definition Thread.cpp:102
Definition ItemDownloader.h:70
constexpr t_to rcast(t_from value)
Definition BaseValues.hpp:427
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:514
uint16_t uint02
-Defines an alias representing a 2 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:109
constexpr bool isNaN(const t_type &value)
Query if 'value' is valid or invalid.
Definition BaseFunctions.hpp:200
Definition ItemDownloader.h:89
uint02 port
Definition ItemDownloader.h:93
String url
Definition ItemDownloader.h:90
String password
Definition ItemDownloader.h:92
String username
Definition ItemDownloader.h:91