c620853a872bb38b0640ea8b3384e38b46989908
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.Common / Interop / Interop.AppCommon.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 using System;
18 using System.Runtime.InteropServices;
19
20 using Tizen.Internals.Errors;
21 using Tizen.Applications;
22
23 internal static partial class Interop
24 {
25     internal static partial class AppCommon
26     {
27         internal enum ResourceCategory : int
28         {
29             Image = 0,
30             Layout,
31             Sound,
32             Binary
33         }
34
35         internal enum AppCommonErrorCode
36         {
37             None = Tizen.Internals.Errors.ErrorCode.None,
38             InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
39             OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
40             InvalidContext = -0x01100000 | 0x01,
41             NoSuchFile = Tizen.Internals.Errors.ErrorCode.NoSuchFile,
42             PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
43         }
44
45         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_id")]
46         internal static extern ErrorCode AppGetId(out string appId);
47
48         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_name")]
49         internal static extern ErrorCode AppGetName(out string name);
50
51         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_resource_path")]
52         internal static extern string AppGetResourcePath();
53
54         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_data_path")]
55         internal static extern string AppGetDataPath();
56
57         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_cache_path")]
58         internal static extern string AppGetCachePath();
59
60         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_shared_data_path")]
61         internal static extern string AppGetSharedDataPath();
62
63         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_shared_resource_path")]
64         internal static extern string AppGetSharedResourcePath();
65
66         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_shared_trusted_path")]
67         internal static extern string AppGetSharedTrustedPath();
68
69         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_tep_resource_path")]
70         internal static extern string AppGetTepResourcePath();
71
72         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_external_cache_path")]
73         internal static extern string AppGetExternalCachePath();
74
75         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_external_data_path")]
76         internal static extern string AppGetExternalDataPath();
77
78         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_external_shared_data_path")]
79         internal static extern string AppGetExternalSharedDataPath();
80
81         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_version")]
82         internal static extern ErrorCode AppGetVersion(out string version);
83
84         [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_low_memory_status")]
85         internal static extern ErrorCode AppEventGetLowMemoryStatus(IntPtr handle, out LowMemoryStatus status);
86
87         [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_low_battery_status")]
88         internal static extern ErrorCode AppEventGetLowBatteryStatus(IntPtr handle, out LowBatteryStatus status);
89
90         [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_language")]
91         internal static extern ErrorCode AppEventGetLanguage(IntPtr handle, out string lang);
92
93         [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_region_format")]
94         internal static extern ErrorCode AppEventGetRegionFormat(IntPtr handle, out string region);
95
96         [DllImport(Libraries.AppCommon, EntryPoint = "app_resource_manager_get")]
97         internal static extern ErrorCode AppResourceManagerGet(ResourceCategory category, string id, out string path);
98
99         [DllImport(Libraries.Application, EntryPoint = "app_resource_manager_get")]
100         internal static extern ErrorCode LegacyAppResourceManagerGet(ResourceCategory category, string id, out string path);
101
102         [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_device_orientation")]
103         internal static extern ErrorCode AppEventGetDeviceOrientation(IntPtr handle, out DeviceOrientation orientation);
104
105         [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_suspended_state")]
106         internal static extern ErrorCode AppEventGetSuspendedState(IntPtr handle, out SuspendedState state);
107
108         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_res_control_allowed_resource_path")]
109         internal static extern AppCommonErrorCode AppGetResControlAllowedResourcePath(string applicationId, out string path);
110
111         [DllImport(Libraries.AppCommon, EntryPoint = "app_get_res_control_global_resource_path")]
112         internal static extern AppCommonErrorCode AppGetResControlGlobalResourcePath(string applicationId, out string path);
113
114         [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_time_zone")]
115         internal static extern ErrorCode AppEventGetTimeZone(IntPtr handle, out string timeZone, out string timeZoneId);
116     }
117 }
118