2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FApp_AppInfo.h
20 * @brief This is the header file of the _AppInfo class.
23 #ifndef _FAPP_INTERNAL_APP_INFO_H_
24 #define _FAPP_INTERNAL_APP_INFO_H_
26 #include <FBaseObject.h>
27 #include <FOspConfig.h>
28 #include <FAppTypes.h>
30 #include <FBaseInternalTypes.h>
32 #include "FApp_Types.h"
34 namespace Tizen { namespace Base { class String; } }
36 namespace Tizen { namespace App
42 class _OSP_EXPORT_ _AppInfo
46 * Retrieves class instance.
48 * @return A pointer to the %_AppInfo instance, @n
49 * else @c null if it fails
51 _OSP_LOCAL_ static _AppInfo* GetAppInfo(void);
54 * Gets the Api version of current application.
56 * @return The Api version
58 static Tizen::Base::_ApiVersion GetApiVersion(void);
61 * Checkes whether the compatibility mode is on or not.
63 * @return @true if the compatibility mode is on else false
65 static bool IsOspCompat(void);
68 * Sets the Api version of current application.
70 * @return An error code
71 * @param[in] apiVersion Api version
72 * @exception E_SUCCESS The method is successful.
73 * @exception E_SYSTEM A system error has occurred.
75 static result SetApiVersion(Tizen::Base::_ApiVersion apiVersion);
78 * Gets the current process Id.
80 * @return The process Id
82 static int GetProcessId(void);
85 * Gets the directory file descriptor of application's root directory where the application is installed.
87 * @return The file descriptor of the application's root directory
88 * @remarks This file descriptor is read only.
90 static int GetAppRootDirFd(void);
93 * Gets the application's Id.
95 * @return The application Id
97 static AppId GetApplicationId(void);
100 * Gets the application's Id.
102 * @return The application Id
104 static AppId GetPackageId(void);
107 * Gets the application executable name.
110 static Tizen::Base::String GetAppExecutableName(void);
113 * Checkes whether the application is submode or not.
115 * @return @true if the compatibility mode is on else false
117 static bool IsSubMode(void);
120 // This method is for internal use only.
121 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
123 // Gets the path of application's root directory where the application is installed.
125 // @return The path of the application's root directory
127 static Tizen::Base::String GetAppRootPath(void);
130 * Gets the application's name.
132 * @return The application name
134 static Tizen::Base::String GetAppName(void);
137 * Gets the application's version.
139 * @return The application version
141 static Tizen::Base::String GetAppVersion(void);
144 * Gets the current state of the application.
146 * @return The current state of the application
148 static AppState GetAppState(void);
151 * Sets the current state of the application.
153 * @param appState The current state of the application
155 static void SetAppState(AppState appState);
158 * Gets the current type of the application.
160 * @return The current type of the application
162 static int GetAppType(void);
165 * Sets the current type of the application.
167 * @param appType The current type of the application
169 static void SetAppType(_AppType appType);
172 * Gets the argument count.
176 _OSP_LOCAL_ static int GetArgc(void);
183 _OSP_LOCAL_ static char** GetArgv(void);
186 * Gets the application handler type.
188 * @return appHandlerType
190 _OSP_LOCAL_ static int GetAppHandlerType(void);
193 * Sets the application handler type.
195 * @param appHandlerType
197 _OSP_LOCAL_ static void SetAppHandlerType(int appHandlerType);
200 * Gets the parent window handle.
202 * @return window handle
204 static unsigned int GetParentWindowHandle(void);
207 * Sets the parent window handle.
209 static void SetParentWindowHandle(unsigned int handle);
212 * Update package info
214 static void UpdatePackageInfo(bool update);
216 _OSP_LOCAL_ result Construct(const char* appId, const char* exeName, int argc, char* pArgv[]);
218 _OSP_LOCAL_ result Construct(const char* appId, const char* appRoot, _AppType type = _APP_TYPE_UI_APP);
221 _OSP_LOCAL_ _AppInfo(void);
223 _OSP_LOCAL_ ~_AppInfo(void);
225 _AppInfo(const _AppInfo& value);
227 _AppInfo& operator =(const _AppInfo& source);
229 _OSP_LOCAL_ static Tizen::Base::_ApiVersion GetApiVersionFromStr(const char* pVer);
231 _OSP_LOCAL_ result UpdateAppInfoFromPackageInfo(const PackageId& packageId);
237 int __appHandlerType;
238 int __parentWindowHandle;
239 Tizen::Base::_ApiVersion __apiVersion;
241 PackageId __packageId;
242 Tizen::Base::String __appExecutableName;
243 Tizen::Base::String __appRootPath;
244 Tizen::Base::String* __pAppName;
245 Tizen::Base::String* __pAppVersion;
248 bool __isPackageInfoInitialized;
255 #endif //_FAPP_INTERNAL_APP_INFO_H_