2 * Copyright (c) 2011 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.
17 #ifndef __TIZEN_SYSTEM_RUNTIME_INFO_H__
18 #define __TIZEN_SYSTEM_RUNTIME_INFO_H__
28 * @addtogroup CAPI_SYSTEM_RUNTIME_INFO_MODULE
33 * @brief Enumeration of error code for runtime information
36 RUNTIME_INFO_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
37 RUNTIME_INFO_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
38 RUNTIME_INFO_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
39 RUNTIME_INFO_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< An input/output error occurred when read value from system */
40 } runtime_info_error_e;
43 * @brief Enumeration of key for runtime information
46 RUNTIME_INFO_KEY_FLIGHT_MODE_ENABLED, /**<Indicates whether the device is in flight mode. */
47 RUNTIME_INFO_KEY_WIFI_STATUS, /**<Indicates the current status of Wi-Fi. */
48 RUNTIME_INFO_KEY_BLUETOOTH_ENABLED, /**<Indicates whether Bluetooth is enabled. */
49 RUNTIME_INFO_KEY_WIFI_HOTSPOT_ENABLED, /**<Indicates whether Wi-Fi hotspot is enabled. */
50 RUNTIME_INFO_KEY_BLUETOOTH_TETHERING_ENABLED, /**<Indicates whether Bluetooth tethering is enabled. */
51 RUNTIME_INFO_KEY_USB_TETHERING_ENABLED, /**<Indicates whether USB tethering is enabled. */
52 RUNTIME_INFO_KEY_LOCATION_SERVICE_ENABLED, /**<Indicates whether the location service is allowed to use location data from GPS satellites. */
53 RUNTIME_INFO_KEY_LOCATION_ADVANCED_GPS_ENABLED, /**<Indicates whether the location service is allowed to download location data for GPS operation. */
54 RUNTIME_INFO_KEY_LOCATION_NETWORK_POSITION_ENABLED, /**<Indicates whether the location service is allowed to use location data from cellular and Wi-Fi. */
55 RUNTIME_INFO_KEY_LOCATION_SENSOR_AIDING_ENABLED, /**<Indicates whether the location service is allowed to use pedestrian sensors for positioning performance. */
56 RUNTIME_INFO_KEY_PACKET_DATA_ENABLED, /**<Indicates Whether the packet data through 3G network is enabled. */
57 RUNTIME_INFO_KEY_DATA_ROAMING_ENABLED, /**<Indicates whether data roaming is enabled. */
58 RUNTIME_INFO_KEY_SILENT_MODE_ENABLED, /**<Indicates whether the device is in silent mode. */
59 RUNTIME_INFO_KEY_VIBRATION_ENABLED, /**<Indicates whether vibration is enabled. */
60 RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED,
61 RUNTIME_INFO_KEY_24HOUR_CLOCK_FORMAT_ENABLED, /**<Indicates whether 24-hour clock is enabled. */
62 RUNTIME_INFO_KEY_FIRST_DAY_OF_WEEK, /**<Indicates the first day of week. */
63 RUNTIME_INFO_KEY_LANGUAGE, /**<Indicates the current language setting. */
64 RUNTIME_INFO_KEY_REGION, /**<Indicates the current region setting. */
65 RUNTIME_INFO_KEY_AUDIO_JACK_CONNECTED, /**<Indicates whether audio jack is connected. */
66 RUNTIME_INFO_KEY_GPS_STATUS, /**<Indicates the current status of GPS. */
67 RUNTIME_INFO_KEY_BATTERY_IS_CHARGING, /**<Indicates the battery is currently charging. */
68 RUNTIME_INFO_KEY_TV_OUT_CONNECTED, /**<Indicates whether TV out is connected. */
69 RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, /**<Indicates the current status of audio jack. */
70 RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED, /**<Indicates whether sliding keyboard is opened. */
71 RUNTIME_INFO_KEY_USB_CONNECTED, /**<Indicates whether USB is connected. */
72 RUNTIME_INFO_KEY_CHARGER_CONNECTED, /**<Indicates whether charger is connected. */
73 RUNTIME_INFO_KEY_VIBRATION_LEVEL_HAPTIC_FEEDBACK, /**<Indicates the current vibration level of haptic feedback. */
74 RUNTIME_INFO_KEY_AUTO_ROTATION_ENABLED, /**<Indicates whether auto rotation is enabled. */
79 * @brief Enumeration of Wi-Fi status
82 RUNTIME_INFO_WIFI_STATUS_DISABLED, /**< GPS is disabled. */
83 RUNTIME_INFO_WIFI_STATUS_UNCONNECTED, /**< Wi-Fi is enabled and network connection is not established. */
84 RUNTIME_INFO_WIFI_STATUS_CONNECTED, /**< Network connection is established in Wi-Fi network. */
85 } runtime_info_wifi_status_e;
88 * @brief Enumeration of GPS status
91 RUNTIME_INFO_GPS_STATUS_DISABLED, /**< GPS is disabled. */
92 RUNTIME_INFO_GPS_STATUS_SEARCHING, /**< GPS is searching for satellites. */
93 RUNTIME_INFO_GPS_STATUS_CONNECTED, /**< GPS connection is established. */
94 } runtime_info_gps_status_e;
97 * @brief Enumeration of first day of week
100 RUNTIME_INFO_FIRST_DAY_OF_WEEK_SUNDAY, /**< Sunday */
101 RUNTIME_INFO_FIRST_DAY_OF_WEEK_MONDAY, /**< Monday */
102 RUNTIME_INFO_FIRST_DAY_OF_WEEK_TUESDAY, /**< Tuesday */
103 RUNTIME_INFO_FIRST_DAY_OF_WEEK_WEDNESDAY, /**< Wednesday */
104 RUNTIME_INFO_FIRST_DAY_OF_WEEK_THURSDAY, /**< Thursday */
105 RUNTIME_INFO_FIRST_DAY_OF_WEEK_FRIDAY, /**< Friday */
106 RUNTIME_INFO_FIRST_DAY_OF_WEEK_SATURDAY, /**< Saturday */
107 } runtime_info_first_day_of_week_e;
110 * @brief Enumeration of audio jack status
113 RUNTIME_INFO_AUDIO_JACK_STATUS_UNCONNECTED, /**< audio jack is not connected */
114 RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_3WIRE, /**< 3-conductor wire is connected. */
115 RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_4WIRE, /**< 4-conductor wire is connected. */
116 } runtime_info_audio_jack_status_e;
120 * @brief Called when the runtime information changes
121 * @param[in] key Type of notification
122 * @param[in] user_data The user data passed from the callback registration function
123 * @pre runtime_info_set_changed_cb() will invoke this callback function.
124 * @see runtime_info_set_changed_cb()
125 * @see runtime_info_unset_changed_cb()
127 typedef void (*runtime_info_changed_cb)(runtime_info_key_e key, void *user_data);
130 * @brief Gets the integer value of the runtime information
131 * @details This function gets current state of the given key which represents specific runtime information.
132 * @param[in] key The runtime information status key from which data should be read
133 * @param[out] value The current value of the given key
134 * @return 0 on success, otherwise a negative error value.
135 * @retval #RUNTIME_INFO_ERROR_NONE Successful
136 * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER Invalid parameter
137 * @retval #RUNTIME_INFO_ERROR_IO_ERROR An input/output error occurred when read value from system
139 int runtime_info_get_value_int(runtime_info_key_e key, int *value);
142 * @brief Gets the boolean value from the runtime information
143 * @details This function gets current state of the given key which represents specific runtime information.
144 * @param[in] key The runtime information key from which data should be read
145 * @param[out] value The current value of the given key
146 * @return 0 on success, otherwise a negative error value.
147 * @retval #RUNTIME_INFO_ERROR_NONE Successful
148 * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER Invalid parameter
149 * @retval #RUNTIME_INFO_ERROR_IO_ERROR An input/output error occurred when read value from system
151 int runtime_info_get_value_bool(runtime_info_key_e key, bool *value);
154 * @brief Gets the double value from the runtime information
155 * @details This function gets current state of the given key which represents specific runtime information.
156 * @param[in] key The runtime information key from which data should be read
157 * @param[out] value The current value of the given key
158 * @return 0 on success, otherwise a negative error value.
159 * @retval #RUNTIME_INFO_ERROR_NONE Successful
160 * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER Invalid parameter
161 * @retval #RUNTIME_INFO_ERROR_IO_ERROR An input/output error occurred when read value from system
163 int runtime_info_get_value_double(runtime_info_key_e key, double *value);
166 * @brief Gets the string value for specified runtime information
167 * @details This function gets current state of the given key which represents specific runtime information.
168 * @remarks @a value must be released with @c free() by you.
169 * @param[in] key The runtime information key from which data should be read
170 * @param[out] value The current value of the given key
171 * @return 0 on success, otherwise a negative error value.
172 * @retval #RUNTIME_INFO_ERROR_NONE Successful
173 * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER Invalid parameter
174 * @retval #RUNTIME_INFO_ERROR_IO_ERROR An input/output error occurred when read value from system
175 * @retval #RUNTIME_INFO_ERROR_OUT_OF_MEMORY Out of memory
177 int runtime_info_get_value_string(runtime_info_key_e key, char **value);
181 * @brief Registers a change event callback for given runtime information key.
183 * @param[in] key The runtime information type
184 * @param[in] callback The callback function to invoke
185 * @param[in] user_data The user data to be passed to the callback function
187 * @return 0 on success, otherwise a negative error value.
188 * @retval #RUNTIME_INFO_ERROR_NONE Successful
189 * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER Invalid parameter
190 * @post runtime_info_changed_cb() will be invoked.
192 * @see runtime_info_unset_changed_cb()
193 * @see runtime_info_changed_cb()
195 int runtime_info_set_changed_cb(runtime_info_key_e key, runtime_info_changed_cb callback, void *user_data);
199 * @brief Unregisters the callback function.
201 * @param[in] key The runtime information type
202 * @return 0 on success, otherwise a negative error value.
203 * @retval #RUNTIME_INFO_ERROR_NONE Successful
204 * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER Invalid parameter
206 * @see runtime_info_set_changed_cb()
208 int runtime_info_unset_changed_cb(runtime_info_key_e key);
218 #endif /* __TIZEN_SYSTEM_RUNTIME_INFO_H__ */