1 /*
2                                     __
3                                    / _|
4   __ _ _   _ _ __ ___  _ __ __ _  | |_ ___  ___ ___
5  / _` | | | | '__/ _ \| '__/ _` | |  _/ _ \/ __/ __|
6 | (_| | |_| | | | (_) | | | (_| | | || (_) \__ \__ \
7  \__,_|\__,_|_|  \___/|_|  \__,_| |_| \___/|___/___/
8 
9 Copyright (C) 2010 The Android Open Source Project.
10 Copyright (C) 2018-2019 Aurora Free Open Source Software.
11 
12 This file is part of the Aurora Free Open Source Software. This
13 organization promote free and open source software that you can
14 redistribute and/or modify under the terms of the GNU Lesser General
15 Public License Version 3 as published by the Free Software Foundation or
16 (at your option) any later version approved by the Aurora Free Open Source
17 Software Organization. The license is available in the package root path
18 as 'LICENSE' file. Please review the following information to ensure the
19 GNU Lesser General Public License version 3 requirements will be met:
20 https://www.gnu.org/licenses/lgpl.html .
21 
22 Alternatively, this file may be used under the terms of the GNU General
23 Public License version 3 or later as published by the Free Software
24 Foundation. Please review the following information to ensure the GNU
25 General Public License requirements will be met:
26 https://www.gnu.org/licenses/gpl-3.0.html.
27 
28 NOTE: All products, services or anything associated to trademarks and
29 service marks used or referenced on this file are the property of their
30 respective companies/owners or its subsidiaries. Other names and brands
31 may be claimed as the property of others.
32 
33 For more info about intellectual property visit: aurorafoss.org or
34 directly send an email to: contact (at) aurorafoss.org .
35 
36 This file has bindings for an existing code, part of The Android Open Source
37 Project implementation. Check it out at android.googlesource.com .
38 */
39 
40 module aurorafw.android.platform.storage_manager;
41 
42 /**
43  * @addtogroup Storage
44  * @{
45  */
46 
47 /**
48  * @file aurorafw/android/platform/storage_manager.d
49  */
50 
51 version (Android):
52 extern (C):
53 @system:
54 nothrow:
55 @nogc:
56 
57 struct AStorageManager;
58 /**
59  * {@link AStorageManager} manages application OBB storage, a pointer
60  * can be obtained with AStorageManager_new().
61  */
62 
63 /**
64  * The different states of a OBB storage passed to AStorageManager_obbCallbackFunc().
65  */
66 enum
67 {
68     /**
69      * The OBB container is now mounted and ready for use. Can be returned
70      * as the status for callbacks made during asynchronous OBB actions.
71      */
72     AOBB_STATE_MOUNTED = 1,
73 
74     /**
75      * The OBB container is now unmounted and not usable. Can be returned
76      * as the status for callbacks made during asynchronous OBB actions.
77      */
78     AOBB_STATE_UNMOUNTED = 2,
79 
80     /**
81      * There was an internal system error encountered while trying to
82      * mount the OBB. Can be returned as the status for callbacks made
83      * during asynchronous OBB actions.
84      */
85     AOBB_STATE_ERROR_INTERNAL = 20,
86 
87     /**
88      * The OBB could not be mounted by the system. Can be returned as the
89      * status for callbacks made during asynchronous OBB actions.
90      */
91     AOBB_STATE_ERROR_COULD_NOT_MOUNT = 21,
92 
93     /**
94      * The OBB could not be unmounted. This most likely indicates that a
95      * file is in use on the OBB. Can be returned as the status for
96      * callbacks made during asynchronous OBB actions.
97      */
98     AOBB_STATE_ERROR_COULD_NOT_UNMOUNT = 22,
99 
100     /**
101      * A call was made to unmount the OBB when it was not mounted. Can be
102      * returned as the status for callbacks made during asynchronous OBB
103      * actions.
104      */
105     AOBB_STATE_ERROR_NOT_MOUNTED = 23,
106 
107     /**
108      * The OBB has already been mounted. Can be returned as the status for
109      * callbacks made during asynchronous OBB actions.
110      */
111     AOBB_STATE_ERROR_ALREADY_MOUNTED = 24,
112 
113     /**
114      * The current application does not have permission to use this OBB.
115      * This could be because the OBB indicates it's owned by a different
116      * package. Can be returned as the status for callbacks made during
117      * asynchronous OBB actions.
118      */
119     AOBB_STATE_ERROR_PERMISSION_DENIED = 25
120 }
121 
122 /**
123  * Obtains a new instance of AStorageManager.
124  */
125 AStorageManager* AStorageManager_new ();
126 
127 /**
128  * Release AStorageManager instance.
129  */
130 void AStorageManager_delete (AStorageManager* mgr);
131 
132 /**
133  * Callback function for asynchronous calls made on OBB files.
134  *
135  * "state" is one of the following constants:
136  * - {@link AOBB_STATE_MOUNTED}
137  * - {@link AOBB_STATE_UNMOUNTED}
138  * - {@link AOBB_STATE_ERROR_INTERNAL}
139  * - {@link AOBB_STATE_ERROR_COULD_NOT_MOUNT}
140  * - {@link AOBB_STATE_ERROR_COULD_NOT_UNMOUNT}
141  * - {@link AOBB_STATE_ERROR_NOT_MOUNTED}
142  * - {@link AOBB_STATE_ERROR_ALREADY_MOUNTED}
143  * - {@link AOBB_STATE_ERROR_PERMISSION_DENIED}
144  */
145 alias AStorageManager_obbCallbackFunc = void function (const(char)* filename, const int state, void* data);
146 
147 /**
148  * Attempts to mount an OBB file. This is an asynchronous operation.
149  */
150 void AStorageManager_mountObb (
151     AStorageManager* mgr,
152     const(char)* filename,
153     const(char)* key,
154     AStorageManager_obbCallbackFunc cb,
155     void* data);
156 
157 /**
158  * Attempts to unmount an OBB file. This is an asynchronous operation.
159  */
160 void AStorageManager_unmountObb (
161     AStorageManager* mgr,
162     const(char)* filename,
163     const int force,
164     AStorageManager_obbCallbackFunc cb,
165     void* data);
166 
167 /**
168  * Check whether an OBB is mounted.
169  */
170 int AStorageManager_isObbMounted (AStorageManager* mgr, const(char)* filename);
171 
172 /**
173  * Get the mounted path for an OBB.
174  */
175 const(char)* AStorageManager_getMountedObbPath (AStorageManager* mgr, const(char)* filename);
176 
177 // ANDROID_STORAGE_MANAGER_H
178 
179 /** @} */