2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef _Download_Agent_Client_Mgr_H
18 #define _Download_Agent_Client_Mgr_H
22 #include "download-agent-type.h"
23 #include "download-agent-interface.h"
25 #include "download-agent-pthread.h"
28 Q_CLIENT_NOTI_TYPE_STARTED_INFO = 0,
29 Q_CLIENT_NOTI_TYPE_PROGRESS_INFO,
30 Q_CLIENT_NOTI_TYPE_PAUSED_INFO,
31 Q_CLIENT_NOTI_TYPE_FINISHED_INFO,
32 Q_CLIENT_NOTI_TYPE_TERMINATE,
35 typedef struct _client_noti_t client_noti_t;
36 struct _client_noti_t {
39 client_noti_type noti_type;
41 user_download_info_t update_dl_info;
42 user_progress_info_t update_progress_info;
43 user_paused_info_t paused_info;
44 user_finished_info_t finished_info;
50 typedef struct _client_queue_t {
51 da_bool_t having_data;
52 client_noti_t *client_q_head;
53 pthread_mutex_t mutex_client_queue;
54 pthread_cond_t cond_client_queue;
57 typedef struct _client_app_info_t {
58 da_client_cb_t client_callback;
59 char *client_user_agent;
62 typedef struct _client_app_mgr_t {
64 client_queue_t client_queue;
65 client_app_info_t client_app_info;
67 da_bool_t is_thread_init;
68 pthread_mutex_t mutex_client_mgr;
71 da_result_t init_client_app_mgr(void);
72 da_bool_t is_client_app_mgr_init(void);
74 da_result_t reg_client_app(da_client_cb_t *da_client_callback);
75 da_result_t dereg_client_app(void);
77 da_result_t send_client_paused_info (int slot_id);
78 da_result_t send_client_update_dl_info (int slot_id, int dl_id,
79 char *file_type, unsigned long int file_size, char *tmp_saved_path,
80 char *pure_file_name, char *etag, char *extension);
81 da_result_t send_client_update_progress_info (int slot_id, int dl_id,
82 unsigned long int received_size);
83 da_result_t send_client_finished_info (int slot_id, int dl_id,
84 char *saved_path, char *etag, int error, int http_status);
86 char *get_client_user_agent_string(void);
88 void push_client_noti(client_noti_t *client_noti);