Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.h
Go to the documentation of this file.
1
4
5/*
6 * Copyright (c) 2017 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_MAIN_H_
11#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_MAIN_H_
12
13#include <stdbool.h>
14#include <stdint.h>
15
16#include <zephyr/kernel.h>
18
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
31enum {
34};
35
37enum {
40};
41
51
60
67
86
113
117 const uint8_t *uuid;
118
124 const char *uri;
125
128
145
150
155
160
174 void (*capabilities)(const struct bt_mesh_dev_capabilities *cap);
175
176#if defined CONFIG_BT_MESH_PROV_OOB_API_LEGACY
187 int (*output_number)(bt_mesh_output_action_t act, uint32_t num) __deprecated;
188#else
200 int (*output_numeric)(bt_mesh_output_action_t act, uint8_t *numeric, size_t size);
201#endif
202
212 int (*output_string)(const char *str);
213
229
236 void (*input_complete)(void);
237
250 uint32_t *uri_hash);
251
262
271
280
290 void (*complete)(uint16_t net_idx, uint16_t addr);
291
299 void (*reprovisioned)(uint16_t addr);
300
312 void (*node_added)(uint16_t net_idx, uint8_t uuid[16], uint16_t addr,
313 uint8_t num_elem);
314
323 void (*reset)(void);
324};
325
326struct bt_mesh_rpr_cli;
327struct bt_mesh_rpr_node;
328
338int bt_mesh_input_string(const char *str);
339
340#if defined CONFIG_BT_MESH_PROV_OOB_API_LEGACY
350__deprecated int bt_mesh_input_number(uint32_t num);
351#endif
352
363int bt_mesh_input_numeric(uint8_t *numeric, size_t size);
364
371int bt_mesh_prov_remote_pub_key_set(const uint8_t public_key[64]);
372
393
417
430int bt_mesh_auth_method_set_static(const uint8_t *static_val, uint8_t size);
431
447
457
467
485 const uint8_t dev_key[16]);
486
498 uint8_t attention_duration);
499
511 uint8_t attention_duration);
512
526 const struct bt_mesh_rpr_node *srv,
527 const uint8_t uuid[16], uint16_t net_idx,
528 uint16_t addr);
529
563 struct bt_mesh_rpr_node *srv,
564 uint16_t addr, bool comp_change);
565
576
580
587
589#define BT_MESH_NET_PRIMARY 0x000
590
592#define BT_MESH_FEAT_RELAY BIT(0)
594#define BT_MESH_FEAT_PROXY BIT(1)
596#define BT_MESH_FEAT_FRIEND BIT(2)
598#define BT_MESH_FEAT_LOW_POWER BIT(3)
600#define BT_MESH_FEAT_SUPPORTED (BT_MESH_FEAT_RELAY | \
601 BT_MESH_FEAT_PROXY | \
602 BT_MESH_FEAT_FRIEND | \
603 BT_MESH_FEAT_LOW_POWER)
604
616int bt_mesh_init(const struct bt_mesh_prov *prov,
617 const struct bt_mesh_comp *comp);
618
629void bt_mesh_reset(void);
630
648
657
666void bt_mesh_iv_update_test(bool enable);
667
677
689int bt_mesh_lpn_set(bool enable);
690
699
713 void (*established)(uint16_t net_idx, uint16_t friend_addr,
714 uint8_t queue_size, uint8_t recv_window);
715
724 void (*terminated)(uint16_t net_idx, uint16_t friend_addr);
725
738 void (*polled)(uint16_t net_idx, uint16_t friend_addr, bool retry);
739};
740
746#define BT_MESH_LPN_CB_DEFINE(_name) \
747 static const STRUCT_SECTION_ITERABLE(bt_mesh_lpn_cb, \
748 _CONCAT(bt_mesh_lpn_cb_, \
749 _name))
750
763 void (*established)(uint16_t net_idx, uint16_t lpn_addr,
764 uint8_t recv_delay, uint32_t polltimeout);
765
774 void (*terminated)(uint16_t net_idx, uint16_t lpn_addr);
775
787 void (*polled)(uint16_t net_idx, uint16_t lpn_addr);
788};
789
798#define BT_MESH_FRIEND_CB_DEFINE(_name) \
799 static const STRUCT_SECTION_ITERABLE(bt_mesh_friend_cb, \
800 _CONCAT(bt_mesh_friend_cb_, \
801 _name))
802#if defined(CONFIG_BT_TESTING)
803struct bt_mesh_snb {
806
808 uint64_t net_id;
809
811 uint32_t iv_idx;
812
814 uint64_t auth_val;
815};
816
817struct bt_mesh_prb {
819 uint8_t random[13];
820
823
825 uint32_t iv_idx;
826
828 uint64_t auth_tag;
829};
830
832struct bt_mesh_beacon_cb {
840 void (*snb_received)(const struct bt_mesh_snb *snb);
841
849 void (*priv_received)(const struct bt_mesh_prb *prb);
850};
851
860#define BT_MESH_BEACON_CB_DEFINE(_name) \
861 static const STRUCT_SECTION_ITERABLE(bt_mesh_beacon_cb, \
862 _CONCAT(bt_mesh_beacon_cb_, \
863 _name))
864#endif
865
875
888
905
906#ifdef __cplusplus
907}
908#endif
909
913
914#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_MAIN_H_ */
bool bt_mesh_is_provisioned(void)
Check if the local node has been provisioned.
int bt_mesh_provision_adv(const uint8_t uuid[16], uint16_t net_idx, uint16_t addr, uint8_t attention_duration)
Provision a Mesh Node using PB-ADV.
int bt_mesh_input_string(const char *str)
Provide provisioning input OOB string.
int bt_mesh_provision(const uint8_t net_key[16], uint16_t net_idx, uint8_t flags, uint32_t iv_index, uint16_t addr, const uint8_t dev_key[16])
Provision the local Mesh Node.
bt_mesh_output_action_t
Available Provisioning output authentication actions.
Definition main.h:43
int bt_mesh_provision_gatt(const uint8_t uuid[16], uint16_t net_idx, uint16_t addr, uint8_t attention_duration)
Provision a Mesh Node using PB-GATT.
int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers)
Enable specific provisioning bearers.
int bt_mesh_auth_method_set_static(const uint8_t *static_val, uint8_t size)
Use static OOB authentication.
int bt_mesh_auth_method_set_input(bt_mesh_input_action_t action, uint8_t size)
Use Input OOB authentication.
int bt_mesh_provision_remote(struct bt_mesh_rpr_cli *cli, const struct bt_mesh_rpr_node *srv, const uint8_t uuid[16], uint16_t net_idx, uint16_t addr)
Provision a Mesh Node using PB-Remote.
int bt_mesh_reprovision_remote(struct bt_mesh_rpr_cli *cli, struct bt_mesh_rpr_node *srv, uint16_t addr, bool comp_change)
Reprovision a Mesh Node using PB-Remote.
bt_mesh_prov_bearer_t
Available Provisioning bearers.
Definition main.h:62
int bt_mesh_auth_method_set_none(void)
Don't use OOB authentication.
int bt_mesh_input_numeric(uint8_t *numeric, size_t size)
Provide provisioning input OOB numeric value.
int bt_mesh_prov_disable(bt_mesh_prov_bearer_t bearers)
Disable specific provisioning bearers.
int bt_mesh_auth_method_set_output(bt_mesh_output_action_t action, uint8_t size)
Use Output OOB authentication.
int bt_mesh_prov_remote_pub_key_set(const uint8_t public_key[64])
Provide Device public key.
bt_mesh_input_action_t
Available Provisioning input authentication actions.
Definition main.h:53
bt_mesh_prov_oob_info_t
Out of Band information location.
Definition main.h:69
@ BT_MESH_DISPLAY_NUMBER
Output numeric.
Definition main.h:48
@ BT_MESH_DISPLAY_STRING
Output alphanumeric.
Definition main.h:49
@ BT_MESH_VIBRATE
Vibrate.
Definition main.h:47
@ BT_MESH_BLINK
Blink.
Definition main.h:45
@ BT_MESH_NO_OUTPUT
Definition main.h:44
@ BT_MESH_BEEP
Beep.
Definition main.h:46
@ BT_MESH_PROV_GATT
PB-GATT bearer.
Definition main.h:64
@ BT_MESH_PROV_REMOTE
PB-Remote bearer.
Definition main.h:65
@ BT_MESH_PROV_ADV
PB-ADV bearer.
Definition main.h:63
@ BT_MESH_PROV_AUTH_HMAC_SHA256_AES_CCM
Definition main.h:33
@ BT_MESH_PROV_AUTH_CMAC_AES128_AES_CCM
Definition main.h:32
@ BT_MESH_STATIC_OOB_AVAILABLE
Static OOB information available.
Definition main.h:38
@ BT_MESH_OOB_AUTH_REQUIRED
OOB authentication required.
Definition main.h:39
@ BT_MESH_ENTER_STRING
Input alphanumeric.
Definition main.h:58
@ BT_MESH_ENTER_NUMBER
Input number.
Definition main.h:57
@ BT_MESH_NO_INPUT
Definition main.h:54
@ BT_MESH_TWIST
Twist.
Definition main.h:56
@ BT_MESH_PUSH
Push.
Definition main.h:55
@ BT_MESH_PROV_OOB_CERTIFICATE
Support for certificate-based provisioning.
Definition main.h:77
@ BT_MESH_PROV_OOB_ON_PAPER
On piece of paper.
Definition main.h:82
@ BT_MESH_PROV_OOB_2D_CODE
2D machine-readable code
Definition main.h:72
@ BT_MESH_PROV_OOB_OTHER
Other.
Definition main.h:70
@ BT_MESH_PROV_OOB_IN_MANUAL
Inside manual.
Definition main.h:83
@ BT_MESH_PROV_OOB_STRING
String.
Definition main.h:76
@ BT_MESH_PROV_OOB_RECORDS
Support for provisioning records.
Definition main.h:78
@ BT_MESH_PROV_OOB_ON_DEV
On device.
Definition main.h:84
@ BT_MESH_PROV_OOB_BAR_CODE
Bar Code.
Definition main.h:73
@ BT_MESH_PROV_OOB_NUMBER
Number.
Definition main.h:75
@ BT_MESH_PROV_OOB_URI
Electronic / URI.
Definition main.h:71
@ BT_MESH_PROV_OOB_NFC
Near Field Communication (NFC).
Definition main.h:74
@ BT_MESH_PROV_OOB_ON_BOX
On box.
Definition main.h:80
@ BT_MESH_PROV_OOB_IN_BOX
Inside box.
Definition main.h:81
const uint8_t * bt_mesh_va_uuid_get(uint16_t addr, const uint8_t *uuid, uint16_t *retaddr)
Iterate stored Label UUIDs.
int bt_mesh_friend_terminate(uint16_t lpn_addr)
Terminate Friendship.
int bt_mesh_lpn_poll(void)
Send out a Friend Poll message.
void bt_mesh_iv_update_test(bool enable)
Toggle the IV Update test mode.
int bt_mesh_init(const struct bt_mesh_prov *prov, const struct bt_mesh_comp *comp)
Initialize Mesh support.
void bt_mesh_rpl_pending_store(uint16_t addr)
Store pending RPL entry(ies) in the persistent storage.
void bt_mesh_reset(void)
Reset the state of the local Mesh node.
int bt_mesh_suspend(void)
Suspend the Mesh network temporarily.
int bt_mesh_lpn_set(bool enable)
Toggle the Low Power feature of the local device.
int bt_mesh_resume(void)
Resume a suspended Mesh network.
bool bt_mesh_iv_update(void)
Toggle the IV Update state.
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
Public kernel APIs.
flags
Definition parser.h:97
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Node Composition.
Definition access.h:977
Device Capabilities.
Definition main.h:88
bt_mesh_output_action_t output_actions
Supported Output OOB Actions.
Definition main.h:102
uint8_t output_size
Maximum size of Output OOB supported.
Definition main.h:108
bt_mesh_input_action_t input_actions
Supported Input OOB Actions.
Definition main.h:105
uint8_t oob_type
Supported OOB Types.
Definition main.h:99
uint16_t algorithms
Supported algorithms and other capabilities.
Definition main.h:93
uint8_t pub_key_type
Supported public key types.
Definition main.h:96
uint8_t input_size
Maximum size in octets of Input OOB supported.
Definition main.h:111
uint8_t elem_count
Number of elements supported by the device.
Definition main.h:90
Friend Node callback functions.
Definition main.h:752
void(* terminated)(uint16_t net_idx, uint16_t lpn_addr)
Friendship terminated.
Definition main.h:774
void(* polled)(uint16_t net_idx, uint16_t lpn_addr)
Friend Poll Request.
Definition main.h:787
void(* established)(uint16_t net_idx, uint16_t lpn_addr, uint8_t recv_delay, uint32_t polltimeout)
Friendship established.
Definition main.h:763
Low Power Node callback functions.
Definition main.h:701
void(* established)(uint16_t net_idx, uint16_t friend_addr, uint8_t queue_size, uint8_t recv_window)
Friendship established.
Definition main.h:713
void(* polled)(uint16_t net_idx, uint16_t friend_addr, bool retry)
Local Poll Request.
Definition main.h:738
void(* terminated)(uint16_t net_idx, uint16_t friend_addr)
Friendship terminated.
Definition main.h:724
Provisioning properties & capabilities.
Definition main.h:115
void(* link_close)(bt_mesh_prov_bearer_t bearer)
Provisioning link has been closed.
Definition main.h:279
const uint8_t * uuid
The UUID that's used when advertising as unprovisioned.
Definition main.h:117
const uint8_t * public_key_be
Pointer to Public Key in big-endian for OOB public key type support.
Definition main.h:136
const uint8_t * private_key_be
Pointer to Private Key in big-endian for OOB public key type support.
Definition main.h:144
void(* input_complete)(void)
The other device finished their OOB input.
Definition main.h:236
int(* output_string)(const char *str)
Output of a string is requested.
Definition main.h:212
int(* input)(bt_mesh_input_action_t act, uint8_t size)
Input is requested.
Definition main.h:228
void(* link_open)(bt_mesh_prov_bearer_t bearer)
Provisioning link has been opened.
Definition main.h:270
uint8_t output_size
Maximum size of Output OOB supported.
Definition main.h:152
const char * uri
Optional URI.
Definition main.h:124
bt_mesh_prov_oob_info_t oob_info
Out of Band information field.
Definition main.h:127
void(* unprovisioned_beacon_gatt)(uint8_t uuid[16], bt_mesh_prov_oob_info_t oob_info)
PB-GATT Unprovisioned Advertising has been received.
Definition main.h:260
void(* unprovisioned_beacon)(uint8_t uuid[16], bt_mesh_prov_oob_info_t oob_info, uint32_t *uri_hash)
Unprovisioned beacon has been received.
Definition main.h:248
uint16_t output_actions
Supported Output OOB Actions.
Definition main.h:154
uint8_t static_val_len
Static OOB value length.
Definition main.h:149
const uint8_t * static_val
Static OOB value.
Definition main.h:147
void(* node_added)(uint16_t net_idx, uint8_t uuid[16], uint16_t addr, uint8_t num_elem)
A new node has been added to the provisioning database.
Definition main.h:312
uint8_t input_size
Maximum size of Input OOB supported.
Definition main.h:157
void(* reprovisioned)(uint16_t addr)
Local node has been reprovisioned.
Definition main.h:299
void(* complete)(uint16_t net_idx, uint16_t addr)
Provisioning is complete.
Definition main.h:290
int(* output_numeric)(bt_mesh_output_action_t act, uint8_t *numeric, size_t size)
Output of a numeric value is requested.
Definition main.h:200
void(* reset)(void)
Node has been reset.
Definition main.h:323
uint16_t input_actions
Supported Input OOB Actions.
Definition main.h:159
void(* capabilities)(const struct bt_mesh_dev_capabilities *cap)
Provisioning Capabilities.
Definition main.h:174
Remote Provisioning Client model instance.
Definition rpr_cli.h:64
Remote provisioning actor, as seen across the mesh.
Definition rpr.h:76
uint16_t addr
Unicast address of the node.
Definition rpr.h:78
uint16_t net_idx
Network index used when communicating with the node.
Definition rpr.h:80
Binary representation of a UUID.
Definition uuid.h:48