wavelength 1.0.0
Loading...
Searching...
No Matches
filedownloadtask.h
Go to the documentation of this file.
1#pragma once
2
3#include <librtmedius.h>
4
5#include "netflow/nettask.h"
6
7class String;
8
16class FileDownloadTask : public NetTask {
17public:
27 FileDownloadTask(String *pName, char **ppBuffer, int *pnSize)
28 : mName(pName), mBuffer(ppBuffer), mSize(pnSize), mReceived(0) {
29 }
30
43 static void OnResponse(int nConnection,
44 int nType,
45 int nSize,
46 const rtMediusFileTransferResponse *pResponse);
47
48protected:
55 void OnStart() override;
56
64 void OnPoll() override;
65
66private:
75 void Append(const rtMediusFileTransferResponse *pResponse, int nBytes);
76
77 String *mName;
78 char **mBuffer;
79 int *mSize;
80 int mReceived;
81 int mDone;
82 float mPolls;
83 float mRate;
84 float mProgress;
85};
void OnStart() override
Send the request.
static void OnResponse(int nConnection, int nType, int nSize, const rtMediusFileTransferResponse *pResponse)
Copy a part of the file, and mark the step done after the last part.
void OnPoll() override
Report the estimated progress, and finish once the last part arrived and the estimate passes 99 perce...
FileDownloadTask(String *pName, char **ppBuffer, int *pnSize)
Construct a step.
Definition filedownloadtask.h:27
NetTask()
Construct a task outside any NetMultiTask.
Definition nettask.h:24
Growable text buffer that is also a PrnStream.
Definition string.h:19