Add gtest for coverage and auto test
[platform/core/api/uwb.git] / src / uwb-private.h
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #ifndef __UWB_PRIVATE_H__
19 #define __UWB_PRIVATE_H__
20
21 #include <gio/gio.h>
22 #include <glib.h>
23 #include <uwb.h>
24 #include <uwb-log.h>
25 #include <system_info.h>
26
27 #define UWB_FEATURE "http://tizen.org/feature/network.uwb"
28
29 #define CHECK_ALREADY_INITIALIZED()                  \
30         if (uwb_ctx.manager_proxy != NULL) {                          \
31                 _WARN("Alread initialized"); \
32                 return UWB_ERROR_ALREADY_INITIALIZED; \
33         }
34
35 #define CHECK_NOT_INITIALIZED()                  \
36         if (uwb_ctx.manager_proxy == NULL) {                          \
37                 _WARN("Not initialized"); \
38                 return UWB_ERROR_NOT_INITIALIZED; \
39         }
40
41 #define CHECK_INPUT_PARAMETER(arg)                  \
42         if (arg == NULL) {                          \
43                 _WARN("INVALID_PARAMETER"); \
44                 return UWB_ERROR_INVALID_PARAMETER; \
45         }
46
47 #if 0
48 #define CHECK_FEATURE_SUPPORTED(feature_name)                                            \
49         {                                                                                \
50                 bool uwb_supported = FALSE;                                              \
51                 if (!system_info_get_platform_bool(feature_name, &uwb_supported)) {      \
52                         if (uwb_supported == FALSE) {                                    \
53                                 _WARN("UWB Manager feature is disabled"); \
54                                 return UWB_ERROR_NOT_SUPPORTED;                          \
55                         }                                                                \
56                 } else {                                                                 \
57                         _ERR("Error - Feature getting from System Info");                \
58                         return UWB_ERROR_NOT_SUPPORTED;                                  \
59                 }                                                                        \
60         }
61 #else
62 #define CHECK_FEATURE_SUPPORTED(feature_name)         \
63         {                                             \
64                 _WARN("[Feature] Should be check !"); \
65         }
66 #endif
67
68 typedef struct {
69         uint64_t node_id;
70         uint16_t pan_id;
71         bool is_remote;
72         uint64_t distance;
73         int x;
74         int y;
75         int z;
76 } uwb_node_s;
77
78 typedef struct {
79         uint16_t pan_id;
80         GSList *remote_node_list;
81         int remote_node_count;
82 } uwb_network_s;
83
84 #endif /* __UWB_PRIVATE_H__ */