2 * HAL (Hardware Abstract Layer) UWB API
4 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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.
24 #include <hal/hal-common.h>
26 #include "hal-uwb-interface.h"
31 #define EXPORT __attribute__ ((visibility("default")))
34 #define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
36 static hal_backend_uwb_funcs *g_uwb_funcs = NULL;
39 int hal_uwb_get_backend(void)
46 ret = hal_common_get_backend(HAL_MODULE_UWB, (void **)&g_uwb_funcs);
48 _E("Failed to get backend\n");
56 int hal_uwb_put_backend(void)
63 ret = hal_common_put_backend(HAL_MODULE_UWB, (void *)g_uwb_funcs);
65 _E("Failed to put backend\n");
74 int hal_uwb_start(uwb_hal_event_cbs_s *event_cbs)
78 return g_uwb_funcs->start(event_cbs);
82 int hal_uwb_stop(void)
86 return g_uwb_funcs->stop();
90 int hal_uwb_test(void)
94 return g_uwb_funcs->test();
98 int hal_uwb_reset(void)
102 return g_uwb_funcs->reset();
106 int hal_uwb_factory_reset(void)
110 return g_uwb_funcs->factory_reset();
114 int hal_uwb_enable_network(void)
118 return g_uwb_funcs->enable_network();
122 int hal_uwb_disable_network(void)
126 return g_uwb_funcs->disable_network();
130 int hal_uwb_get_network_info(uwb_hal_network_s **network_info)
134 return g_uwb_funcs->get_network_info(network_info);
138 int hal_uwb_set_configurations(uint16_t node_id, const GVariant *configurations)
142 return g_uwb_funcs->set_configurations(node_id, configurations);
146 int hal_uwb_get_configurations(uint16_t node_id, GVariant **configurations)
150 return g_uwb_funcs->get_configurations(node_id, configurations);
154 int hal_uwb_set_position(uint64_t node_id, int x, int y, int z)
158 return g_uwb_funcs->set_position(node_id, x, y, z);
162 int hal_uwb_get_own_node(uwb_hal_node_s **own_node)
166 return g_uwb_funcs->get_own_node(own_node);
170 int hal_uwb_send_message(const unsigned char *message, int message_length)
174 return g_uwb_funcs->send_message(message, message_length);
178 int hal_uwb_send_message_to(uint16_t node_id, const unsigned char *message, int message_length)
182 return g_uwb_funcs->send_message_to(node_id, message, message_length);