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"
30 #include "bt-service-mesh-cdb.h"
36 int _bt_mesh_network_create(const char *app_key,
37 const char *sender, const char *network_name,
38 bluetooth_mesh_node_t *node, GSList *model_list);
40 int _bt_mesh_network_destroy(const char *app_cred,
41 const char *sender, bluetooth_mesh_network_t *network);
43 void _bt_check_mesh_app_termination(const char *name);
45 int _bt_mesh_network_remove_net_configuration(bluetooth_mesh_network_t *net);
47 void _bt_mesh_network_unload_net_configuration(_bt_mesh_cdb_t *cdb_cfg);
49 int _bt_mesh_network_remove_node_configuration(bluetooth_mesh_node_info_t *node);
51 int _bt_mesh_network_create_cdb(int result,
52 const char *sender, const char *app_creds,
53 uint8_t uuid[16], uint8_t token[8],
56 int _bt_mesh_network_load(const char *app_cred,
57 const char *sender, const char *token);
59 int _bt_mesh_network_unload(const char *app_cred,
60 const char *sender, bluetooth_mesh_network_t *network);
62 int _bt_mesh_network_join(const char *app_cred,
63 const char *sender, bluetooth_mesh_node_t *node,
66 int _bt_mesh_cancel_join(const char *app_cred,
67 const char *sender, bluetooth_mesh_node_info_t *node);
69 int _bt_mesh_network_load_cdb(int result, const char *sender,
70 const char *app_creds, uint8_t uuid[16],
71 uint8_t token[8], char **network);
73 int _bt_mesh_network_request_provisioning_data_request(
74 uint8_t net_uuid[], uint8_t count);
76 int _bt_mesh_network_scan(const char *app_cred, const char *sender,
77 bluetooth_mesh_network_t *network,
78 bluetooth_mesh_scan_param_t *param);
80 int _bt_mesh_network_scan_cancel(const char *app_cred,
81 const char *sender, bluetooth_mesh_network_t *network);
83 bool _bt_mesh_is_scanning(void);
85 void _bt_mesh_set_scanning_state(bool state);
87 bool _bt_mesh_is_provisioning(void);
89 void _bt_mesh_set_provisioning_state(bool state);
91 int _bt_mesh_network_set_provisioner_caps(const char *app_cred,
92 const char *sender, bluetooth_mesh_network_t *network,
93 bluetooth_mesh_provisioner_caps_t *caps);
95 int _bt_mesh_network_provision_device(const char *app_cred,
97 bluetooth_mesh_provisioning_request_t *req);
99 int _bt_mesh_authentication_reply(int auth_type,
100 const char *auth_value, gboolean reply);
102 int _bt_mesh_network_add_netkey(const char *app_cred,
103 const char *sender, bluetooth_mesh_network_t *network);
105 int _bt_mesh_network_delete_netkey(const char *app_cred,
106 const char *sender, bluetooth_mesh_network_t *network,
109 int _bt_mesh_network_update_netkey(const char *app_cred,
110 const char *sender, bluetooth_mesh_network_t *network,
113 int _bt_mesh_network_add_appkey(const char *app_cred, const char *sender,
114 bluetooth_mesh_network_t *network, uint16_t netkey_idx);
116 int _bt_mesh_network_delete_appkey(const char *app_cred, const char *sender,
117 bluetooth_mesh_network_t *network, uint16_t netkey_idx,
118 uint16_t appkey_idx);
120 int _bt_mesh_network_update_appkey(const char *app_cred, const char *sender,
121 bluetooth_mesh_network_t *network, uint16_t netkey_idx,
122 uint16_t appkey_idx);
124 int _bt_mesh_network_set_name(const char *app_cred, const char *sender,
125 bluetooth_mesh_network_t *network);
127 int _bt_mesh_network_get_netkeys(const char *app_cred, const char *sender,
128 bluetooth_mesh_network_t *network, GArray **out_param);
130 int _bt_mesh_network_get_appkeys(const char *app_cred, const char *sender,
131 bluetooth_mesh_network_t *network, uint16_t net_idx,
134 int _bt_mesh_network_handle_netkey_added(uint8_t net_uuid[],
135 uint16_t netkey_idx);
137 int _bt_mesh_network_handle_netkey_deleted(uint8_t net_uuid[],
138 uint16_t netkey_idx);
140 int _bt_mesh_network_handle_netkey_updated(uint8_t net_uuid[],
141 uint16_t netkey_idx);
143 int _bt_mesh_network_handle_appkey_added(uint8_t net_uuid[],
144 uint16_t netkey_idx, uint16_t appkey_idx);
146 int _bt_mesh_network_handle_appkey_deleted(uint8_t net_uuid[],
147 uint16_t netkey_idx, uint16_t appkey_idx);
149 int _bt_mesh_network_get_nodes(const char *app_cred, const char *sender,
150 bluetooth_mesh_network_t *network, GArray **out_param);
152 int _bt_mesh_element_get_models(const char *app_cred, const char *sender,
153 bluetooth_mesh_network_t *network, uint16_t unicast,
154 int elem_idx, GArray **out_param);
156 int _bt_mesh_network_add_remote_node(uint8_t net_uuid[], uint8_t dev_uuid[],
157 uint16_t unicast, uint8_t count);
159 bool _bt_mesh_network_save_remote_node_composition(uint8_t net_uuid[],
160 uint16_t remote_unicast,
161 uint8_t *data, uint16_t data_len);
163 bool _bt_mesh_network_add_model_subscription(uint8_t net_uuid[],
164 uint16_t remote_unicast, int ele_idx,
165 uint32_t mod_id, uint16_t group_addr);
167 bool _bt_mesh_network_delete_model_subscription(uint8_t net_uuid[],
168 uint16_t remote_unicast, int ele_idx,
169 uint32_t mod_id, uint16_t group_addr);
171 bool _bt_mesh_network_delete_all_model_subscription(uint8_t net_uuid[],
172 uint16_t remote_unicast, int ele_idx,
175 bool _bt_mesh_network_overwrite_model_subscription(uint8_t net_uuid[],
176 uint16_t remote_unicast, int ele_idx,
177 uint32_t mod_id, uint16_t group_addr);
179 bool _bt_mesh_network_save_remote_node_netkey(uint8_t net_uuid[],
180 uint16_t remote_unicast, uint16_t netkey_idx);
182 bool _bt_mesh_network_delete_remote_node_netkey(uint8_t net_uuid[],
183 uint16_t remote_unicast, uint16_t netkey_idx);
185 bool _bt_mesh_network_save_remote_node_appkey(uint8_t net_uuid[],
186 uint16_t remote_unicast, uint16_t netkey_idx,
187 uint16_t appkey_idx);
189 bool _bt_mesh_network_delete_remote_node_appkey(uint8_t net_uuid[],
190 uint16_t remote_unicast, uint16_t netkey_idx,
191 uint16_t appkey_idx);
193 bool _bt_mesh_network_save_remote_node_ttl(uint8_t net_uuid[],
194 uint16_t remote_unicast, uint8_t ttl);
196 int _bt_mesh_network_node_get_netkeys(const char *app_cred,
197 bluetooth_mesh_node_discover_t *node,
200 int _bt_mesh_network_node_get_appkeys(const char *app_cred, const char *sender,
201 bluetooth_mesh_node_discover_t *node, GArray **out_param);
203 int _bt_mesh_network_create_group(const char *app_cred, const char *sender,
204 bluetooth_mesh_network_t *net, bool is_virtual, uint16_t grp_addr,
205 bluetooth_mesh_network_group_info_t *group);
207 int _bt_mesh_network_remove_group(const char *app_cred,
208 const char *sender, bluetooth_mesh_network_t *net,
209 bluetooth_mesh_network_group_info_t *req);
211 int _bt_mesh_network_get_groups(const char *app_cred, const char *sender,
212 bluetooth_mesh_network_t *network, GArray **out_param);
214 bool _bt_mesh_network_get_label_uuid_from_sub_addr(uint8_t net_uuid[],
215 uint16_t sub_addr, uint8_t label[]);
217 bool _bt_mesh_node_get_vendor_features(uint8_t net_uuid[],
218 uint16_t unicast, bluetooth_mesh_node_features_t *feats);
222 #endif /* __cplusplus */
223 #endif /* BT_MESH_NETWORK_H_ */