uihv: move the creation of the screenshot path
[platform/core/system/swap-manager.git] / ui_viewer / ui_viewer_utils.h
1 /*
2  *  DA manager
3  *
4  * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:
7  *
8  * Lyupa Anastasia <a.lyupa@samsung.com>
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  * Contributors:
23  * - Samsung RnD Institute Russia
24  *
25  */
26
27 #ifndef _UI_VIEWER_UTILS_
28 #define _UI_VIEWER_UTILS_
29
30 #include <stdint.h>
31 #include <Eina.h>
32 #include <stdbool.h>
33
34 #include "app_protocol.h" /* from swap-probe-devel package */
35
36 #include "ui_viewer_data.h"
37
38 #define DA_LOG_MAX              4096
39 #define TMP_DIR "/run/swap/tmp/da"
40
41 #define __unused __attribute__((unused))
42
43 typedef struct
44 {
45         int type;
46         int length;
47         char data[DA_LOG_MAX];
48 } log_t;
49
50 // ========================= print log =====================================
51 #define PRINTMSG(...)   print_log_fmt(APP_MSG_MSG, __FUNCTION__, __LINE__, __VA_ARGS__)
52 #define PRINTWRN(...)   print_log_fmt(APP_MSG_WARNING, __FUNCTION__, __LINE__, __VA_ARGS__)
53 #define PRINTERR(...)   print_log_fmt(APP_MSG_ERROR, __FUNCTION__, __LINE__, __VA_ARGS__)
54
55 #define INIT_INFO                                               \
56                 info.host_ip = 0;                               \
57                 info.host_port = 0;                             \
58                 info.msg_total_size = 0;                        \
59                 info.msg_pack_size = 0;                         \
60                 info.sock = NULL;                               \
61                 info.msg_buf = (char *)""
62
63 typedef struct {
64         uint32_t host_port;
65         uint32_t host_ip;
66         struct sockaddr *sock;
67
68         uint64_t msg_total_size;
69         uint32_t msg_pack_size;
70         char *msg_buf;
71
72 } info_t;
73
74 void reset_pid_tid();
75 char * _strncpy(char *dest, const char *src, size_t n);
76 bool print_log_fmt(int msgType, const char *func_name, int line, ...);
77 bool print_log_str(int msgType, char *st);
78 bool print_log_ui_viewer_hierarchy_status(enum ErrorCode *err_code);
79 void print_log_ui_viewer_info_list(Eina_Bool rendering);
80 bool print_log_ui_viewer_hierarchy_error(void);
81 bool print_log_ui_obj_screenshot(Evas_Object *obj);
82 bool printLog(log_t* log, int msgType);
83 void raise_app_window(void);
84
85 void ui_viewer_clean_log(void);
86 void ui_viewer_log(const char *format, ...);
87
88 #endif /* _UI_VIEWER_UTILS_ */