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