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;
20 internal static partial class Interop
22 internal static partial class Storage
24 internal enum ErrorCode
26 None = Tizen.Internals.Errors.ErrorCode.None,
27 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
28 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
29 NotSupported = Tizen.Internals.Errors.ErrorCode.NoSuchDevice,
30 OperationFailed = -0x00020000 | 0x12,
33 // Any change here might require changes in Tizen.System.StorageArea enum
34 internal enum StorageArea
40 // Any change here might require changes in Tizen.System.StorageState enum
41 internal enum StorageState
49 // Any change here might require changes in Tizen.System.directoryType enum
50 internal enum DirectoryType
63 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
64 internal delegate void StorageStateChangedCallback(int id, StorageState state, IntPtr userData);
66 [DllImport(Libraries.Storage, EntryPoint = "storage_get_root_directory")]
67 internal static extern ErrorCode StorageGetRootDirectory(int id, out string path);
69 [DllImport(Libraries.Storage, EntryPoint = "storage_get_directory")]
70 internal static extern ErrorCode StorageGetAbsoluteDirectory(int id, DirectoryType type, out string path);
72 [DllImport(Libraries.Storage, EntryPoint = "storage_get_state")]
73 internal static extern ErrorCode StorageGetState(int id, out StorageState state);
75 [DllImport(Libraries.Storage, EntryPoint = "storage_get_type")]
76 internal static extern ErrorCode StorageGetType(int id, out StorageArea type);
78 [DllImport(Libraries.Storage, EntryPoint = "storage_set_state_changed_cb")]
79 internal static extern ErrorCode StorageSetStateChanged(int id, StorageStateChangedCallback callback, IntPtr userData);
81 [DllImport(Libraries.Storage, EntryPoint = "storage_unset_state_changed_cb")]
82 internal static extern ErrorCode StorageUnsetStateChanged(int id, StorageStateChangedCallback callback);
84 [DllImport(Libraries.Storage, EntryPoint = "storage_get_total_space")]
85 internal static extern ErrorCode StorageGetTotalSpace(int id, out ulong bytes);
87 [DllImport(Libraries.Storage, EntryPoint = "storage_get_available_space")]
88 internal static extern ErrorCode StorageGetAvailableSpace(int id, out ulong bytes);
90 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
91 internal delegate bool StorageDeviceSupportedCallback(int storageID, StorageArea type, StorageState state, string rootDirectory, IntPtr userData);
93 [DllImport(Libraries.Storage, EntryPoint = "storage_foreach_device_supported")]
94 public static extern ErrorCode StorageManagerGetForeachDeviceSupported(StorageDeviceSupportedCallback callback, IntPtr userData);