Add new UWB ranging data
[platform/hal/api/uwb.git] / include / hal-uwb-interface.h
1 /*
2  * HAL (Hardware Abstract Layer) UWB API
3  *
4  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18
19 #ifndef __HAL_UWB_INTERFACE__
20 #define __HAL_UWB_INTERFACE__
21
22 #include <hal/hal-common-interface.h>
23 #include <stdbool.h>
24 #include <stdint.h>
25 #include <glib.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef struct {
32         uint64_t node_id;
33         uint16_t pan_id;
34         bool is_remote;
35         uint64_t distance;
36         int x;
37         int y;
38         int z;
39         int range;
40         int aoa;
41         int pdoa;
42 } uwb_hal_node_s;
43
44 typedef struct {
45         uint16_t pan_id;
46         GSList *remote_node_list;
47         int remote_node_count;
48 } uwb_hal_network_s;
49
50 typedef struct {
51         void (*message_received_cb) (uint16_t node_id, unsigned char *message, int message_length);
52         void (*position_changed_cb) (uint16_t node_id, int x, int y, int z);
53 } uwb_hal_event_cbs_s;
54
55 typedef struct _hal_backend_uwb_funcs {
56         int (*start)(uwb_hal_event_cbs_s *event_cbs);
57         int (*stop)(void);
58         int (*test) (void);
59         int (*reset) (void);
60         int (*factory_reset) (void);
61         int (*enable_network) (void);
62         int (*disable_network) (void);
63         int (*get_network_info) (uwb_hal_network_s **network_info);
64         int (*set_configurations) (uint16_t node_id, const GVariant *configurations);
65         int (*get_configurations) (uint16_t node_id, GVariant **configurations);
66         int (*set_position) (uint64_t node_id, int x, int y, int z);
67         int (*get_own_node) (uwb_hal_node_s **own_node);
68         int (*send_message) (const unsigned char *message, int message_length);
69         int (*send_message_to) (uint16_t node_id, const unsigned char *message, int message_length);
70 } hal_backend_uwb_funcs;
71
72 #ifdef __cplusplus
73 }
74 #endif
75 #endif /* __HAL_UWB_INTERFACE__ */