summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBang Kwang min <justine.bang@samsung.com>2012-08-28 15:20:24 +0900
committerBang Kwang min <justine.bang@samsung.com>2012-08-30 15:10:27 +0900
commit6d329981d1f650e806324bd925ea2258d33009e5 (patch)
treed9d995273df936f13208dd1b4f70d5ffd672e1cc
parent9ce7a0a7272c23312091a74775fe9847837305a8 (diff)
downloaddownload-provider-6d329981d1f650e806324bd925ea2258d33009e5.tar.gz
download-provider-6d329981d1f650e806324bd925ea2258d33009e5.tar.bz2
download-provider-6d329981d1f650e806324bd925ea2258d33009e5.zip
support Pause/Resume with new connection
[Title] support Pause/Resume with new connection [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] N/A [SCMRequest] N/A Change-Id: I0acad9c35d3119e9f69fba174657ec1aa580f2c6
-rw-r--r--src/download-provider-receiver.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/download-provider-receiver.c b/src/download-provider-receiver.c
index c331bc8..a6c7379 100644
--- a/src/download-provider-receiver.c
+++ b/src/download-provider-receiver.c
@@ -248,7 +248,9 @@ int _handle_new_connection(download_clientinfo_slot *clientinfo_list, download_c
}
if (type == DOWNLOAD_CONTROL_STOP
- || type == DOWNLOAD_CONTROL_GET_STATE_INFO) {
+ || type == DOWNLOAD_CONTROL_GET_STATE_INFO
+ || type == DOWNLOAD_CONTROL_RESUME
+ || type == DOWNLOAD_CONTROL_PAUSE) {
// get requestid from socket.
if (request_clientinfo->requestinfo
&& request_clientinfo->requestinfo->requestid > 0) {
@@ -308,6 +310,38 @@ int _handle_new_connection(download_clientinfo_slot *clientinfo_list, download_c
}
ipc_send_stateinfo(request_clientinfo);
// estabilish the spec of return value.
+ } else if (type == DOWNLOAD_CONTROL_PAUSE) {
+ if (searchindex >= 0) {
+ if (da_suspend_download
+ (clientinfo_list[searchindex].clientinfo->req_id)
+ == DA_RESULT_OK) {
+ request_clientinfo->state = DOWNLOAD_STATE_PAUSE_REQUESTED;
+ request_clientinfo->err = DOWNLOAD_ERROR_NONE;
+ } else {
+ request_clientinfo->state = DOWNLOAD_STATE_FAILED;
+ request_clientinfo->err = DOWNLOAD_ERROR_INVALID_PARAMETER;
+ }
+ } else { // no found
+ request_clientinfo->state = DOWNLOAD_STATE_NONE;
+ request_clientinfo->err = DOWNLOAD_ERROR_NONE;
+ }
+ ipc_send_stateinfo(request_clientinfo);
+ } else if (type == DOWNLOAD_CONTROL_RESUME) {
+ if (searchindex >= 0) {
+ if (da_resume_download
+ (clientinfo_list[searchindex].clientinfo->req_id)
+ == DA_RESULT_OK) {
+ request_clientinfo->state = DOWNLOAD_STATE_DOWNLOADING;
+ request_clientinfo->err = DOWNLOAD_ERROR_NONE;
+ } else {
+ request_clientinfo->state = DOWNLOAD_STATE_FAILED;
+ request_clientinfo->err = DOWNLOAD_ERROR_INVALID_PARAMETER;
+ }
+ } else { // no found
+ request_clientinfo->state = DOWNLOAD_STATE_NONE;
+ request_clientinfo->err = DOWNLOAD_ERROR_NONE;
+ }
+ ipc_send_stateinfo(request_clientinfo);
}
}
clear_clientinfo(request_clientinfo);