NDEVR
API Documentation
ReplyTimeout.h
1#pragma once
2#include <NDEVR/ItemDownloader.h>
3#include <QBasicTimer>
4#include <QTimerEvent>
5namespace NDEVR
6{
10 class ReplyTimeout : public QObject
11 {
12 public:
17 {
20 };
21
27 ReplyTimeout(NetworkRequest* reply, const int timeout, HandleMethod method = Abort);
31 void refresh();
38 static void set(NetworkRequest* reply, const int timeout, HandleMethod method = Abort);
39 protected:
44 void timerEvent(QTimerEvent* ev);
45 QBasicTimer m_timer;
48 };
49}
A request for data or information from a network.
void timerEvent(QTimerEvent *ev)
Handles the timer event; triggers the timeout action when the timer fires.
HandleMethod m_method
The method used to handle a timeout (Abort or Close).
void refresh()
Resets the timeout timer, restarting the countdown.
HandleMethod
Specifies how to handle a timed-out network request.
@ Abort
Abort the request immediately.
@ Close
Close the request gracefully.
static void set(NetworkRequest *reply, const int timeout, HandleMethod method=Abort)
Convenience method to attach a timeout to a network request.
int m_timeout
The timeout duration in milliseconds.
QBasicTimer m_timer
The basic timer used to track the timeout interval.
ReplyTimeout(NetworkRequest *reply, const int timeout, HandleMethod method=Abort)
Constructs a timeout watcher for the given network request.
The primary namespace for the NDEVR SDK.