Welcome to mirror list, hosted at ThFree Co, Russian Federation.

http_thread_tizen.hpp « platform - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 838ef14c63abde63e5342f298817411cb6f12197 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#pragma once
#include "std/target_os.hpp"
#include "std/noncopyable.hpp"

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wignored-qualifiers"
#include <FNet.h>
#pragma clang diagnostic pop

namespace downloader
{
class IHttpThreadCallback;
}
using namespace Tizen::Net::Http;

class HttpThread
    : public Tizen::Net::Http::IHttpTransactionEventListener
    , public Tizen::Net::Http::IHttpProgressEventListener
    , noncopyable
{
public:

  HttpThread(std::string const & url,
             downloader::IHttpThreadCallback & callback,
             int64_t beg, int64_t end,
             int64_t size,
             std::string const & pb);
  ~HttpThread();

  bool OnStart(void);

  ///
  ///Tizen::Net::Http::IHttpTransactionEventListener
  ///
  virtual void OnTransactionAborted (HttpSession & httpSession,
                                      HttpTransaction & httpTransaction,
                                      result r);
  virtual void OnTransactionCertVerificationRequiredN (HttpSession & httpSession,
                                                        HttpTransaction & httpTransaction,
                                                        Tizen::Base::String *pCert);
  virtual void OnTransactionCompleted (HttpSession & httpSession,
                                        HttpTransaction & httpTransaction);
  virtual void OnTransactionHeaderCompleted (HttpSession & httpSession,
                                              HttpTransaction & httpTransaction,
                                              int headerLen, bool bAuthRequired);
  virtual void OnTransactionReadyToRead (HttpSession & httpSession,
                                          HttpTransaction & httpTransaction,
                                          int availableBodyLen);
  virtual void OnTransactionReadyToWrite (HttpSession & httpSession,
                                           HttpTransaction & httpTransaction,
                                           int recommendedChunkSize);

  ///
  ///Tizen::Net::Http::IHttpProgressEventListener
  ///
  virtual void OnHttpDownloadInProgress (HttpSession & httpSession,
                                          HttpTransaction & httpTransaction,
                                          int64_t currentLength,
                                          int64_t totalLength);
  virtual void OnHttpUploadInProgress (HttpSession & httpSession,
                                        HttpTransaction & httpTransaction,
                                        int64_t currentLength,
                                        int64_t totalLength);

private:
  downloader::IHttpThreadCallback & m_callback;

  int64_t m_begRange;
  int64_t m_endRange;
  int64_t m_downloadedBytes;
  int64_t m_expectedSize;
  std::string const m_url;
  std::string const & m_pb;

  HttpSession * m_pSession;
  HttpTransaction* m_pTransaction;
};