4 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6 * @author: Anupam Roy <anupam.r@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef BT_SERVICE_MESH_NETWORK_H_
23 #define BT_SERVICE_MESH_NETWORK_H_
26 #include <sys/types.h>
27 #include "bluetooth-api.h"
28 #include "bluetooth-mesh-api.h"
34 int _bt_mesh_network_create(const char *app_key,
35 const char *sender, const char *network_name,
36 bluetooth_mesh_node_t *node, GSList *model_list);
38 int _bt_mesh_network_destroy(const char *app_cred,
39 const char *sender, bluetooth_mesh_network_t *network);
41 int _bt_mesh_network_remove_net_configuration(bluetooth_mesh_network_t *net);
43 int _bt_mesh_network_remove_node_configuration(bluetooth_mesh_node_info_t *node);
45 int _bt_mesh_network_create_cdb(int result,
46 const char *sender, const char *app_creds,
47 uint8_t uuid[16], uint8_t token[8],
50 int _bt_mesh_network_load(const char *app_cred,
51 const char *sender, const char *token);
53 int _bt_mesh_network_load_cdb(int result, const char *sender,
54 const char *app_creds, uint8_t uuid[16],
55 uint8_t token[8], char **network);
57 int _bt_mesh_network_request_provisioning_data_request(
58 uint8_t net_uuid[], uint8_t count);
60 int _bt_mesh_network_scan(const char *app_cred, const char *sender,
61 bluetooth_mesh_network_t *network,
62 bluetooth_mesh_scan_param_t *param);
64 int _bt_mesh_network_scan_cancel(const char *app_cred,
65 const char *sender, bluetooth_mesh_network_t *network);
67 bool _bt_mesh_is_scanning(void);
69 void _bt_mesh_set_scanning_state(bool state);
71 bool _bt_mesh_is_provisioning(void);
73 void _bt_mesh_set_provisioning_state(bool state);
75 int _bt_mesh_network_set_provisioner_caps(const char *app_cred,
76 const char *sender, bluetooth_mesh_network_t *network,
77 bluetooth_mesh_provisioner_caps_t *caps);
79 int _bt_mesh_network_provision_device(const char *app_cred,
81 bluetooth_mesh_provisioning_request_t *req);
83 int _bt_mesh_authentication_reply(int auth_type,
84 const char *auth_value, gboolean reply);
86 int _bt_mesh_network_add_netkey(const char *app_cred,
87 const char *sender, bluetooth_mesh_network_t *network);
89 int _bt_mesh_network_delete_netkey(const char *app_cred,
90 const char *sender, bluetooth_mesh_network_t *network,
93 int _bt_mesh_network_update_netkey(const char *app_cred,
94 const char *sender, bluetooth_mesh_network_t *network,
97 int _bt_mesh_network_add_appkey(const char *app_cred, const char *sender,
98 bluetooth_mesh_network_t *network, uint16_t netkey_idx);
100 int _bt_mesh_network_delete_appkey(const char *app_cred, const char *sender,
101 bluetooth_mesh_network_t *network, uint16_t netkey_idx,
102 uint16_t appkey_idx);
104 int _bt_mesh_network_update_appkey(const char *app_cred, const char *sender,
105 bluetooth_mesh_network_t *network, uint16_t netkey_idx,
106 uint16_t appkey_idx);
108 int _bt_mesh_network_set_name(const char *app_cred, const char *sender,
109 bluetooth_mesh_network_t *network);
111 int _bt_mesh_network_get_netkeys(const char *app_cred, const char *sender,
112 bluetooth_mesh_network_t *network, GArray **out_param);
114 int _bt_mesh_network_get_appkeys(const char *app_cred, const char *sender,
115 bluetooth_mesh_network_t *network, uint16_t net_idx,
118 int _bt_mesh_network_handle_netkey_added(uint8_t net_uuid[],
119 uint16_t netkey_idx);
121 int _bt_mesh_network_handle_netkey_deleted(uint8_t net_uuid[],
122 uint16_t netkey_idx);
124 int _bt_mesh_network_handle_netkey_updated(uint8_t net_uuid[],
125 uint16_t netkey_idx);
127 int _bt_mesh_network_handle_appkey_added(uint8_t net_uuid[],
128 uint16_t netkey_idx, uint16_t appkey_idx);
130 int _bt_mesh_network_handle_appkey_deleted(uint8_t net_uuid[],
131 uint16_t netkey_idx, uint16_t appkey_idx);
133 int _bt_mesh_network_get_nodes(const char *app_cred, const char *sender,
134 bluetooth_mesh_network_t *network, GArray **out_param);
136 int _bt_mesh_element_get_models(const char *app_cred, const char *sender,
137 bluetooth_mesh_network_t *network, uint16_t unicast,
138 int elem_idx, GArray **out_param);
140 int _bt_mesh_network_add_remote_node(uint8_t net_uuid[], uint8_t dev_uuid[],
141 uint16_t unicast, uint8_t count);
143 bool _bt_mesh_network_save_remote_node_composition(uint8_t net_uuid[],
144 uint16_t remote_unicast,
145 uint8_t *data, uint16_t data_len);
147 bool _bt_mesh_network_save_remote_node_netkey(uint8_t net_uuid[],
148 uint16_t remote_unicast, uint16_t netkey_idx);
150 bool _bt_mesh_network_delete_remote_node_netkey(uint8_t net_uuid[],
151 uint16_t remote_unicast, uint16_t netkey_idx);
153 bool _bt_mesh_network_save_remote_node_appkey(uint8_t net_uuid[],
154 uint16_t remote_unicast, uint16_t netkey_idx,
155 uint16_t appkey_idx);
157 bool _bt_mesh_network_delete_remote_node_appkey(uint8_t net_uuid[],
158 uint16_t remote_unicast, uint16_t netkey_idx,
159 uint16_t appkey_idx);
161 bool _bt_mesh_network_save_remote_node_ttl(uint8_t net_uuid[],
162 uint16_t remote_unicast, uint8_t ttl);
164 int _bt_mesh_network_node_get_netkeys(const char *app_cred,
165 bluetooth_mesh_node_discover_t *node,
168 int _bt_mesh_network_node_get_appkeys(const char *app_cred, const char *sender,
169 bluetooth_mesh_node_discover_t *node, GArray **out_param);
171 int _bt_mesh_network_create_group(const char *app_cred, const char *sender,
172 bluetooth_mesh_network_t *net, bool is_virtual, uint16_t grp_addr,
173 bluetooth_mesh_network_group_info_t *group);
175 int _bt_mesh_network_remove_group(const char *app_cred,
176 const char *sender, bluetooth_mesh_network_t *net,
177 bluetooth_mesh_network_group_info_t *req);
179 int _bt_mesh_network_get_groups(const char *app_cred, const char *sender,
180 bluetooth_mesh_network_t *network, GArray **out_param);
182 bool _bt_mesh_network_get_label_uuid_from_sub_addr(uint8_t net_uuid[],
183 uint16_t sub_addr, uint8_t label[]);
185 bool _bt_mesh_node_get_vendor_features(uint8_t net_uuid[],
186 uint16_t unicast, bluetooth_mesh_node_features_t *feats);
190 #endif /* __cplusplus */
191 #endif /* BT_MESH_NETWORK_H_ */