cd76c4d78a872febeedd601e5b39404f2589a888
[platform/framework/native/content.git] / inc / FCntIDownloadListener.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 /**
17  * @file                FCntIDownloadListener.h
18  * @brief               This is the header file for the %IDownloadListener interface.
19  *
20  * This header file contains the declarations of the %IDownloadListener interface.
21  */
22
23 #ifndef _FCNT_IDOWNLOAD_LISTENER_H_
24 #define _FCNT_IDOWNLOAD_LISTENER_H_
25
26 #include <FBaseString.h>
27 #include <FBaseRtIEventListener.h>
28
29 namespace Tizen { namespace Content
30 {
31
32 /**
33 * @interface IDownloadListener
34 * @brief    This interface is used for receiving the download operation events.
35 *
36 * @since 2.0
37 *
38 * The %IDownloadListener interface is used for receiving the download operation events.
39 */
40 class _OSP_EXPORT_ IDownloadListener
41         : virtual public Tizen::Base::Runtime::IEventListener
42 {
43 public:
44         /**
45          * This polymorphic destructor should be overridden if required. @n
46          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
47          *
48          * @since 2.0
49          */
50         virtual ~IDownloadListener(void) {}
51
52         /**
53          * Called when the download operation is cancelled.
54          *
55          * @since 2.0
56          *
57          * @param[in] reqId           The request ID returned by DownloadManager::Start()
58          */
59         virtual void OnDownloadCanceled(RequestId reqId) = 0;
60
61         /**
62          * Called when the download operation is completed.
63          *
64          * @since 2.0
65          *
66          * @param[in] reqId           The request ID returned by DownloadManager::Start()
67          * @param[in] path            The path of the downloaded file
68          */
69         virtual void OnDownloadCompleted(RequestId reqId, const Tizen::Base::String& path) = 0;
70
71         /**
72          * Called when the download operation fails.
73          *
74          * @since 2.0
75          *
76          * @param[in] reqId                     The request ID returned by DownloadManager::Start()
77          * @param[in] r                         The error of the download operation @n 
78          *                                                                      The following error codes may be given through this argument.
79          * @param[in] errorCode                 The http error code from the server
80          * @exception E_SUCCESS                         The method is successful.
81          * @exception E_INVALID_URL                     The specified URL is invalid.
82          * @exception E_CONNECTION_FAILED       The server connection failed.
83          * @exception E_TIMEOUT                         The connection has timed out.
84          * @exception E_MAX_EXCEEDED            The request has exceeded the maximum limit.
85          * @exception E_STORAGE_FULL            The storage is full.
86          * @exception E_OUT_OF_MEMORY           The memory is insufficient.
87          * @exception E_SYSTEM                          The method cannot proceed due to a severe system error.
88          */
89         virtual void OnDownloadFailed(RequestId reqId, result r, const Tizen::Base::String& errorCode) = 0;
90
91         /**
92          * Called when the download operation pauses.
93          *
94          * @since 2.0
95          *
96          * @param[in] reqId           The request ID returned by DownloadManager::Start()
97          */
98         virtual void OnDownloadPaused(RequestId reqId) = 0;
99
100         /**
101          * Called when the progress of the download operation is changed.
102          *
103          * @since 2.0
104          *
105          * @param[in] reqId           The request ID
106          * @param[in] receivedSize    The size of the received data in bytes
107          * @param[in] totalSize       The total size of the data to receive in bytes
108          */
109         virtual void OnDownloadInProgress(RequestId reqId, unsigned long long receivedSize, unsigned long long totalSize) = 0;
110
111 protected:
112         //
113         // This method is for internal use only.
114         // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
115         //
116         // This method is reserved and may change its name at any time without prior notice.
117         //
118         // @since 2.0
119         //
120         virtual void IDownloadListener_Reserved1(void) {}
121
122         //
123         // This method is for internal use only.
124         // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
125         //
126         // This method is reserved and may change its name at any time without prior notice.
127         //
128         // @since 2.0
129         //
130         virtual void IDownloadListener_Reserved2(void) {}
131
132         //
133         // This method is for internal use only.
134         // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
135         //
136         // This method is reserved and may change its name at any time without prior notice.
137         //
138         // @since 2.0
139         //
140         virtual void IDownloadListener_Reserved3(void) {}
141 }; // IDownloadListener
142
143 } } // Tizen::Content
144
145 #endif // _FCNT_IDOWNLOAD_LISTENER_H_