Merge "GetErrorMessage() to print the error log" into tizen_2.1
[platform/framework/native/appfw.git] / inc / FSysSystemInfo.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file        FSysSystemInfo.h
20  * @brief       This is the header file for the %SystemInfo class.
21  *
22  * This header file contains the declarations of the %SystemInfo class.
23  */
24
25 #ifndef _FSYS_SYSTEM_INFO_H_
26 #define _FSYS_SYSTEM_INFO_H_
27
28 #include <FBaseString.h>
29 #include <FBaseUuId.h>
30 #include <FBaseColIList.h>
31
32 namespace Tizen { namespace System
33 {
34
35 /**
36  * @enum        SystemInfoValueType
37  *
38  * Defines the data type for the %SystemInfo class.
39  *
40  * @since       2.0
41  */
42 enum SystemInfoValueType
43 {
44         VALUE_TYPE_STRING,      // This enum value is deprecated. Instead of using this enum value, use SYSTEM_INFO_VALUE_TYPE_STRING.
45         VALUE_TYPE_INTEGER,     // This enum value is deprecated. Instead of using this enum value, use SYSTEM_INFO_VALUE_TYPE_INTEGER.
46         VALUE_TYPE_DOUBLE,      // This enum value is deprecated. Instead of using this enum value, use SYSTEM_INFO_VALUE_TYPE_DOUBLE.
47         VALUE_TYPE_UUID,        // This enum value is deprecated. Instead of using this enum value, use SYSTEM_INFO_VALUE_TYPE_UUID.
48         SYSTEM_INFO_VALUE_TYPE_STRING = VALUE_TYPE_STRING,      /**< The Tizen::Base::String type */
49         SYSTEM_INFO_VALUE_TYPE_INTEGER = VALUE_TYPE_INTEGER,    /**< The Tizen::Base::Integer type */
50         SYSTEM_INFO_VALUE_TYPE_DOUBLE = VALUE_TYPE_DOUBLE,      /**< The Tizen::Base::Double type */
51         SYSTEM_INFO_VALUE_TYPE_UUID = VALUE_TYPE_UUID,          /**< The Tizen::Base::UuId type */
52 };
53
54 /**
55  * @class       SystemInfo
56  * @brief       This class provides methods for getting system information.
57  *
58  * @since       2.0
59  *
60  * @final       This class is not intended for extension.
61  *
62  * The %SystemInfo class provides system information, such as the API and platform versions, supported device features,
63  * and screen dimensions.
64  * To get the information, you must provide the <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">SystemInfo key</a>.
65  *
66  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">System Information</a>.
67  *
68  * The following example demonstrates how to use the %SystemInfo class.
69  *
70  * @code
71  * #include <FBase.h>
72  * #include <FSystem.h>
73  *
74  * using namespace Tizen::Base;
75  * using namespace Tizen::System;
76  *
77  * result
78  * MyClass::GetSystemInfomation(void)
79  * {
80  *       result r = E_SUCCESS;
81  *
82  *       String key(L"http://tizen.org/system/duid");
83  *       String deviceUniqueId;
84  *
85  *       r = SystemInfo::GetValue(key, deviceUniqueId);
86  *       TryCatch(r == E_SUCCESS, , "MySystemInfo: To get a value is failed");
87  *
88  *       return E_SUCCESS;
89  *
90  *      CATCH:
91  *       return r;
92  * }
93  * @endcode
94  *
95  */
96 class _OSP_EXPORT_ SystemInfo
97         : public Tizen::Base::Object
98 {
99
100 public:
101         /**
102          * Gets the specific Tizen::Base::String type system information based on the specified designators (key).
103          *
104          * @since       2.0
105          *
106          * @return      An error code
107          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">key name</a> of the system information @n
108          * @if OSPCOMPAT
109          *                      The following key values are updated: @n
110          *                      - Since Tizen, refer <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">here</a>.
111          *                      - @b Deprecated All the key values provided prior to %Tizen 2.0 are deprecated. For more detailed information, refer 
112          *                       <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo_deprecated.htm">here</a>.
113          * @endif
114          * @param[out]  value                   The system information of type Tizen::Base::String
115          * @exception   E_SUCCESS               The method is successful.
116          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
117          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
118          */
119         static result GetValue(const Tizen::Base::String& key, Tizen::Base::String& value);
120
121         /**
122          * Gets the specific integer type system information based on the specified designators (key).
123          *
124          * @since       2.0
125          *
126          * @return      An error code
127          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">key name</a> of the system information @n
128          * @if OSPCOMPAT
129          *                      The following key values are updated: @n
130          *                      - Since Tizen, refer <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">here</a>.
131          *                      - @b Deprecated All the key values provided prior to %Tizen 2.0 are deprecated. For more detailed information, refer 
132          *                       <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo_deprecated.htm">here</a>.
133          * @endif
134          * @param[out]  value                   The integer type system information
135          * @exception   E_SUCCESS               The method is successful.
136          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
137          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
138          */
139         static result GetValue(const Tizen::Base::String& key, int& value);
140
141         /**
142          * Gets the specific double type system information based on the specified designators (key).
143          *
144          * @since       2.0
145          *
146          * @return      An error code
147          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">key name</a> of the system information
148          * @param[out]  value                   The @c double type system information
149          * @exception   E_SUCCESS               The method is successful.
150          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
151          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
152          */
153         static result GetValue(const Tizen::Base::String& key, double& value);
154
155         /**
156          * Gets the specific UuId type system information based on the specified designators (key).
157          *
158          * @since       2.0
159          *
160          * @return      An error code
161          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">key name</a> of the system information
162          * @param[out]  value                   The UuId type system information
163          * @exception   E_SUCCESS               The method is successful.
164          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
165          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
166          */
167         static result GetValue(const Tizen::Base::String& key, Tizen::Base::UuId& value);
168
169         /**
170          * Gets the specific system information based on the specified key and data type of the information.
171          *
172          * @since       2.0
173          *
174          * @return      A system information list
175          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">key name</a> of the system information @n
176          * @if OSPCOMPAT
177          *              The following key values are updated @n
178          *                      - @b Deprecated All the key values provided prior to %Tizen 2.0 are deprecated. For more detailed information, refer 
179          *                       <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo_deprecated.htm">here</a>.
180          * @endif
181          * @param[in]   type                    The data type of the information
182          * @exception   E_SUCCESS               The method is successful.
183          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
184          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
185          * @remarks     The specific error code can be accessed using the GetLastResult() method.
186          */
187         static Tizen::Base::Collection::IList* GetValuesN(const Tizen::Base::String& key, SystemInfoValueType type);
188
189         /**
190          * Gets the specific boolean type system information based on the specified designators (key).
191          *
192          * @since       2.0
193          *
194          * @return      An error code
195          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">key name</a> of the system information @n
196          * @if OSPCOMPAT
197          *                      The following key values are updated: @n
198          *                      - Since Tizen, refer <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo.htm">here</a>.
199          *                      - @b Deprecated All the key values provided prior to %Tizen 2.0 are deprecated. For more detailed information, refer 
200          *                       <a href="../org.tizen.native.appprogramming/html/guide/system/sysinfo_deprecated.htm">here</a>.
201          * @endif
202          * @param[out]  value                   The @c bool type system information
203          * @exception   E_SUCCESS               The method is successful.
204          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
205          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
206          */
207         static result GetValue(const Tizen::Base::String& key, bool& value);
208
209         /**
210          * Gets the platform version in the "[Major].[Minor].[Patch Version]" format.
211          *
212          * @since 2.0
213          *
214          * @privlevel   public
215          * @privilege   %http://tizen.org/privilege/system
216          *
217          * @return      An error code
218          * @param[out]  platformVersion         The platform version
219          * @exception   E_SUCCESS               The method is successful.
220          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
221          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
222          */
223         static result GetPlatformVersion(Tizen::Base::String& platformVersion);
224
225         /**
226          * Gets the Native API version in the "[Major].[Minor]" format.
227          *
228          * @since 2.0
229          *
230          * @privlevel   public
231          * @privilege   %http://tizen.org/privilege/system
232          *
233          * @return      An error code
234          * @param[out]  nativeApiVersion        The Native API version
235          * @exception   E_SUCCESS               The method is successful.
236          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
237          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
238          */
239         static result GetNativeApiVersion(Tizen::Base::String& nativeApiVersion);
240
241         /**
242          * Gets the WEB API version in the "[Major].[Minor]" format.
243          *
244          * @since 2.0
245          *
246          * @privlevel   public
247          * @privilege   %http://tizen.org/privilege/system
248          *
249          * @return      An error code
250          * @param[out]  webApiVersion           The %Tizen API version
251          * @exception   E_SUCCESS               The method is successful.
252          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
253          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
254          */
255         static result GetWebApiVersion(Tizen::Base::String& webApiVersion);
256
257         /**
258          * Gets the platform build information.
259          *
260          * @since 2.1
261          *
262          * @privlevel   public
263          * @privilege   %http://tizen.org/privilege/system
264          *
265          * @return      An error code
266          * @param[out]  buildInfo               The %Tizen build information
267          * @exception   E_SUCCESS               The method is successful.
268          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
269          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
270          */
271         static result GetBuildInfo(Tizen::Base::String& buildInfo);
272
273         /**
274          * Gets the International Mobile Equipment Identity (IMEI) of the device.
275          *
276          * @since       2.0
277          *
278          * @privlevel   partner
279          * @privilege   %http://tizen.org/privilege/systemmanager
280          *
281          * @return      An error code
282          * @param[out]  imei                    The IMEI of the device
283          * @exception   E_SUCCESS               The method is successful.
284          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
285          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
286          */
287         static result GetImei(Tizen::Base::String& imei);
288
289 private:
290         /**
291          * This is the default constructor for this class. This default constructor is intentionally declared as private so that only the platform can create an instance.
292          */
293         SystemInfo(void);
294
295         /**
296          * This is the destructor for this class. This destructor overrides Tizen::Base::Object::~Object().
297          */
298         virtual ~SystemInfo(void);
299
300         /**
301          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
302          */
303         SystemInfo(const SystemInfo& value);
304
305         /**
306          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
307          */
308         SystemInfo& operator =(const SystemInfo& value);
309
310 private:
311         friend class _SystemInfoImpl;
312         class _SystemInfoImpl* __pSystemInfoImpl;
313 }; // SystemInfo
314
315 } } // Tizen::System
316
317 #endif //_FSYS_SYSTEM_INFO_H_