2 * Copyright (c) 2016 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.
18 using System.Runtime.InteropServices;
19 using Tizen.Applications;
21 internal static partial class Interop
23 internal static partial class Download
27 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
28 internal delegate void StateChangedCallback(int requestId, int state, IntPtr userData);
29 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
30 internal delegate void ProgressChangedCallback(int requestId, ulong receivedSize, IntPtr userData);
32 [DllImport(Libraries.Download, EntryPoint = "download_create")]
33 internal static extern int CreateRequest(out int requestId);
34 [DllImport(Libraries.Download, EntryPoint = "download_destroy")]
35 internal static extern int DestroyRequest(int requestId);
36 [DllImport(Libraries.Download, EntryPoint = "download_set_url")]
37 internal static extern int SetUrl(int requestId, string url);
38 [DllImport(Libraries.Download, EntryPoint = "download_get_url")]
39 internal static extern int GetUrl(int requestId, out string url);
40 [DllImport(Libraries.Download, EntryPoint = "download_set_network_type")]
41 internal static extern int SetNetworkType(int requestId, int networkType);
42 [DllImport(Libraries.Download, EntryPoint = "download_get_network_type")]
43 internal static extern int GetNetworkType(int requestId, out int networkType);
44 [DllImport(Libraries.Download, EntryPoint = "download_set_destination")]
45 internal static extern int SetDestination(int requestId, string path);
46 [DllImport(Libraries.Download, EntryPoint = "download_get_destination")]
47 internal static extern int GetDestination(int requestId, out string path);
48 [DllImport(Libraries.Download, EntryPoint = "download_set_file_name")]
49 internal static extern int SetFileName(int requestId, string fileName);
50 [DllImport(Libraries.Download, EntryPoint = "download_get_file_name")]
51 internal static extern int GetFileName(int requestId, out string path);
52 [DllImport(Libraries.Download, EntryPoint = "download_set_auto_download")]
53 internal static extern int SetAutoDownload(int requestId, bool value);
54 [DllImport(Libraries.Download, EntryPoint = "download_get_auto_download")]
55 internal static extern int GetAutoDownload(int requestId, out bool value);
56 [DllImport(Libraries.Download, EntryPoint = "download_set_temp_file_path")]
57 internal static extern int SetTempFilePath(int requestId, string tempPath);
58 [DllImport(Libraries.Download, EntryPoint = "download_get_temp_path")]
59 internal static extern int GetTempFilePath(int requestId, out string tempPath);
60 [DllImport(Libraries.Download, EntryPoint = "download_add_http_header_field")]
61 internal static extern int AddHttpHeaderField(int requestId, string field, string value);
62 [DllImport(Libraries.Download, EntryPoint = "download_get_downloaded_file_path")]
63 internal static extern int GetDownloadedPath(int requestId, out string downloadedPath);
64 [DllImport(Libraries.Download, EntryPoint = "download_get_mime_type")]
65 internal static extern int GetMimeType(int requestId, out string mimeType);
66 [DllImport(Libraries.Download, EntryPoint = "download_get_state")]
67 internal static extern int GetState(int requestId, out int downloadState);
68 [DllImport(Libraries.Download, EntryPoint = "download_get_content_name")]
69 internal static extern int GetContentName(int requestId, out string contentName);
70 [DllImport(Libraries.Download, EntryPoint = "download_get_content_size")]
71 internal static extern int GetContentSize(int requestId, out ulong size);
72 [DllImport(Libraries.Download, EntryPoint = "download_get_http_status")]
73 internal static extern int GetHttpStatus(int requestId, out int httpStatus);
74 [DllImport(Libraries.Download, EntryPoint = "download_get_etag")]
75 internal static extern int GetETag(int requestId, out string etag);
76 [DllImport(Libraries.Download, EntryPoint = "download_start")]
77 internal static extern int StartDownload(int requestId);
78 [DllImport(Libraries.Download, EntryPoint = "download_pause")]
79 internal static extern int PauseDownload(int requestId);
80 [DllImport(Libraries.Download, EntryPoint = "download_cancel")]
81 internal static extern int CancelDownload(int requestId);
82 [DllImport(Libraries.Download, EntryPoint = "download_set_state_changed_cb")]
83 internal static extern int SetStateChangedCallback(int requestId, StateChangedCallback callback, IntPtr userData);
84 [DllImport(Libraries.Download, EntryPoint = "download_unset_state_changed_cb")]
85 internal static extern int UnsetStateChangedCallback(int requestId);
86 [DllImport(Libraries.Download, EntryPoint = "download_set_progress_cb")]
87 internal static extern int SetProgressCallback(int requestId, ProgressChangedCallback callback, IntPtr userData);
88 [DllImport(Libraries.Download, EntryPoint = "download_unset_progress_cb")]
89 internal static extern int UnsetProgressCallback(int requestId);
93 [DllImport(Libraries.Download, EntryPoint = "download_set_notification_title")]
94 internal static extern int SetNotificationTitle(int requestId, string title);
95 [DllImport(Libraries.Download, EntryPoint = "download_get_notification_title")]
96 internal static extern int GetNotificationTitle(int requestId, out string title);
97 [DllImport(Libraries.Download, EntryPoint = "download_set_notification_description")]
98 internal static extern int SetNotificationDescription(int requestId, string description);
99 [DllImport(Libraries.Download, EntryPoint = "download_get_notification_description")]
100 internal static extern int GetNotificationDescription(int requestId, out string description);
101 [DllImport(Libraries.Download, EntryPoint = "download_set_notification_type")]
102 internal static extern int SetNotificationType(int requestId, int type);
103 [DllImport(Libraries.Download, EntryPoint = "download_get_notification_type")]
104 internal static extern int GetNotificationType(int requestId, out int type);
105 [DllImport(Libraries.Download, EntryPoint = "download_set_notification_app_control")]
106 internal static extern int SetNotificationAppControl(int requestId, int appControlType, SafeAppControlHandle handle);
107 [DllImport(Libraries.Download, EntryPoint = "download_get_notification_app_control")]
108 internal static extern int GetNotificationAppControl(int requestId, int appControlType, out SafeAppControlHandle handle);