4 * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 #ifndef __INDICATOR_UTIL_H__
23 #define __INDICATOR_UTIL_H__
26 #include <system_settings.h>
27 #include <runtime_info.h>
30 INDICATOR_ERROR_NONE = 0,
31 INDICATOR_ERROR_FAIL = -1,
32 INDICATOR_ERROR_DB_FAILED = -2,
33 INDICATOR_ERROR_OUT_OF_MEMORY = -3,
34 INDICATOR_ERROR_INVALID_PARAMETER = -4,
35 INDICATOR_ERROR_NO_DATA = -5,
38 typedef struct _Indicator_Data_Animation Indicator_Data_Animation;
40 struct _Indicator_Data_Animation
46 extern char *util_set_label_text_color(const char *txt);
47 extern const char *util_get_icon_dir(void);
48 extern void util_signal_emit(void* data, const char *emission, const char *source);
49 extern void util_part_text_emit(void* data, const char *part, const char *text);
50 extern void util_signal_emit_by_win(void* data, const char *emission, const char *source);
51 extern void util_part_text_emit_by_win(void* data, const char *part, const char *text);
52 extern void util_battery_percentage_part_content_set(void* data, const char *part, const char *img_path);
53 extern void util_launch_search(void* data);
54 extern int util_check_system_status(void);
55 extern char* util_get_timezone_str(void);
56 extern Eina_Bool util_win_prop_angle_get(Ecore_X_Window win, int *curr);
57 extern int util_is_orf(void);
58 extern int util_check_noti_ani(const char* path);
59 extern void util_start_noti_ani(void* data);
60 extern void util_stop_noti_ani(void* data);
61 extern void util_send_status_message_start(void* data,double duration);
62 extern void util_char_replace(char *text, char s, char t);
63 extern int util_dynamic_state_get(void);
65 extern Ecore_File_Monitor* util_file_monitor_add(const char* file_path, Ecore_File_Monitor_Cb callback_func, void *ad);
66 extern void util_file_monitor_remove(Ecore_File_Monitor* pFileMonitor);
67 extern char *util_safe_str(const char *str, const char *strSearch);
69 #ifdef _SUPPORT_SCREEN_READER
70 extern Evas_Object *util_access_object_register(Evas_Object *object, Evas_Object *layout);
71 extern void util_access_object_unregister(Evas_Object *object);
72 extern void util_access_object_info_set(Evas_Object *object, int info_type, char *info_text);
73 extern void util_icon_access_register(icon_s *icon);
74 extern void util_icon_access_unregister(icon_s *icon);
75 #endif /* _SUPPORT_SCREEN_READER */
77 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
80 * @brief Application sub-directories type.
86 APP_DIR_SHARED_RESOURCE,
87 APP_DIR_SHARED_TRUSTED,
88 APP_DIR_EXTERNAL_DATA,
89 APP_DIR_EXTERNAL_CACHE,
93 * @brief Returns absolute path to resource file located in applications directory.
95 * @param subdir type of subdirectory
96 * @param relative path of resource in application's subdir.
97 * eg. for DATA_DIR subdir and relative "database.db" => "/home/owner/apps/org.tizen.homescreen-efl/data/database.db"
98 * @return absolute path string.
100 const char *util_get_file_path(enum app_subdir dir, const char *relative);
103 * @brief Convinience macros
105 #define util_get_data_file_path(x) util_get_file_path(APP_DIR_DATA, (x))
106 #define util_get_cache_file_path(x) util_get_file_path(APP_DIR_CACHE, (x))
107 #define util_get_res_file_path(x) util_get_file_path(APP_DIR_RESOURCE, (x))
108 #define util_get_shared_res_file_path(x) util_get_file_path(APP_DIR_SHARED_RESOURCE, (x))
109 #define util_get_trusted_file_path(x) util_get_file_path(APP_DIR_SHARED_TRUSTED, (x))
110 #define util_get_external_data_file_path(x) util_get_file_path(APP_DIR_EXTERNAL_DATA, (x))
111 #define util_get_external_cache_file_path(x) util_get_file_path(APP_DIR_EXTERNAL_CACHE, (x))
114 * @brief Initializes WiFi using wifi_initialize API
115 * @remarks If WiFi is already initialized, #WIFI_ERROR_NONE will be returned.
116 * @return 0 on success, other value on failure
118 int util_wifi_initialize(void);
121 * @brief Deinitializes WiFi using wifi_deinitialize API
122 * @remarks Only last call of that function is effective to avoid unwanted deinitialization.
123 * @return 0 on success, other value on failure
125 int util_wifi_deinitialize(void);
128 * @brief Allows to set multiple callbacks using wifi_set_connection_state_changed_cb API
131 * @param data user_data passed to callback function.
132 * @return 0 on success, other value on failure
134 int util_wifi_set_connection_state_changed_cb(wifi_connection_state_changed_cb, void *data);
137 * @brief Unregisters callback set with util_wifi_set_connection_state_changed_cb.
141 void util_wifi_unset_connection_state_changed_cb(wifi_connection_state_changed_cb);
144 * @brief Allows to set multiple callbacks using wifi_set_device_state_changed_cb API
147 * @param data user_data passed to callback function.
148 * @return 0 on success, other value on failure
150 int util_wifi_set_device_state_changed_cb(wifi_device_state_changed_cb cb, void *data);
153 * @brief Unregisters callback set with util_wifi_set_device_state_changed_cb.
157 void util_wifi_unset_device_state_changed_cb(wifi_device_state_changed_cb cb);
161 * @brief Allows to register multiple callbacks using system_settings_changed_cb API.
163 * @param key key to monitor.
164 * @param cb callback.
165 * @param data user_data passed to callback function.
167 * @return 0 on success, other value on failure.
169 int util_system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb cb, void *data);
172 * @brief Unregisters callback set with util_system_settings_set_changed_cb.
174 * @param key key to stop monitor.
177 void util_system_settings_unset_changed_cb(system_settings_key_e key, system_settings_changed_cb cb);
180 * @brief Allows to register multiple callbacks using runtime_info_set_changed_cb API.
182 * @param key key to monitor.
183 * @param cb callback.
184 * @param data user data passed to callback function.
186 * @return 0 on success, other value on failure.
188 int util_runtime_info_set_changed_cb(runtime_info_key_e key, runtime_info_changed_cb cb, void *data);
191 * @brief Unregisters callback set with util_runtime_info_set_changed_cb.
193 * @param key key to stop monitor.
194 * @param cb callback.
196 void util_runtime_info_unset_changed_cb(runtime_info_key_e key, runtime_info_changed_cb cb);
198 #endif /* __INDICATOR_UTIL_H__ */