Tizen 2.0 Release
[framework/system/oma-dm-agent.git] / include / dm-engine / dl-manager / fw_downloader.h
1 /*
2  * oma-dm-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef FW_DOWNLOADER_H_
19 #define FW_DOWNLOADER_H_
20
21 /*dm-agent*/
22 #include "common/dm_error.h"
23 #include "dm-engine/dl-manager/dd_object.h"
24
25 typedef enum {
26         EXIST_PARTIAL_FILE = 1,
27         EXIST_COMPLETED_FILE,
28         NOT_EXIST_FILE
29 } DOWNLOAD_FILE_STATUS;
30
31 typedef struct {
32         int current_data_size;
33         int total_data_size;
34         char *file_path;
35 } Data_Resume_Infomation;
36
37 /**
38  * @par Description: API to get object information from dd_server_uri
39  *
40  *
41  * @par Purpose:
42  * @par Typical use case:
43  * @par par Method of function operation:
44  * @par Important notes:
45  * @param[in]   dd_server_uri                                   dd server uri
46  * @param[out]  download_descriptor             download_descriptor
47  * @param[out]  dd_object_information           dd object information
48  *
49  * @return                              DM_OK
50  *                                              DM_ERROR
51  *
52  * @par Errors:
53  *
54  * @pre None.
55  * @post
56  * @see
57  * @remarks None.
58  *
59  * @par Sample Code:
60  * @code
61  * @endcode
62  */
63 DM_ERROR get_object_information(char *dd_server_uri, int *file_size, Download_Descriptor ** download_descriptor, DM_ERROR * download_status);
64
65 /**
66  * @par Description: API to check file resume
67  *
68  *
69  * @par Purpose:
70  * @par Typical use case:
71  * @par par Method of function operation:
72  * @par Important notes:
73  * @param[in]   checked_download_folder folder path
74  * @param[in]   download_descriptor                     download_descriptor
75  * @param[out]  file_status                                                     file status
76  *
77  * @return                              DM_OK
78  *                                              DM_ERROR
79  *
80  * @par Errors:
81  *
82  * @pre None.
83  * @post
84  * @see
85  * @remarks None.
86  *
87  * @par Sample Code:
88  * @code
89  * @endcode
90  */
91 DM_ERROR check_file_resume(const char *checked_download_folder, DOWNLOAD_FILE_STATUS * file_status, Download_Descriptor * download_descriptor, Data_Resume_Infomation ** data_resume_info);
92
93 /**
94  * @par Description: API to download object for object path
95  *
96  *
97  * @par Purpose:
98  * @par Typical use case:
99  * @par par Method of function operation:
100  * @par Important notes:
101  * @param[in]   download_folder                                 downloaded folder path
102  * @parma[in]   config                                                          wifi config
103  * @param[in]   download_descriptor                     download_descriptor
104  * @param[out]  object_downloaded_path          downloaded file path
105  *
106  *
107  * @return                              DM_OK
108  *                                              DM_ERROR
109  *
110  * @par Errors:
111  *
112  * @pre None.
113  * @post
114  * @see
115  * @remarks None.
116  *
117  * @par Sample Code:
118  * @code
119  * @endcode
120  */
121 DM_ERROR download_object(const char *download_folder, char **object_downloaded_path, Data_Resume_Infomation * data_resume_info, int config, Download_Descriptor * download_descriptor, DM_ERROR * downoad_status);
122
123 /**
124  * @par Description: API to send download status to server
125  *
126  *
127  * @par Purpose:
128  * @par Typical use case:
129  * @par par Method of function operation:
130  * @par Important notes:
131  * @param[in]   download_status         DM_ERROR
132  * @param[in]   download_descriptor     download_descriptor
133  *
134  * @return                              DM_OK
135  *                                              DM_ERROR
136  *
137  * @par Errors:
138  *
139  * @pre None.
140  * @post
141  * @see
142  * @remarks None.
143  *
144  * @par Sample Code:
145  * @code
146  * @endcode
147  */
148 DM_ERROR send_donwload_status(DM_ERROR download_status, Download_Descriptor * download_descriptor);
149
150 /**
151  * @par Description: API to free download descriptor
152  *
153  *
154  * @par Purpose:
155  * @par Typical use case:
156  * @par par Method of function operation:
157  * @par Important notes:
158  * @param[in]   download_descriptor     download_descriptor
159  *
160  * @return
161  *
162  * @par Errors:
163  *
164  * @pre None.
165  * @post
166  * @see
167  * @remarks None.
168  *
169  * @par Sample Code:
170  * @code
171  * @endcode
172  */
173 void free_Download_Descriptor(Download_Descriptor ** download_descriptor);
174
175 #endif                          /* FW_DOWNLOADER_H_ */