Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.h
Go to the documentation of this file.
1
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
26#ifdef __cplusplus
27extern "C" {
28#endif
29
31enum {
34};
35
37enum {
40};
41
43typedef enum {
51
53typedef enum {
60
62typedef enum {
67
69typedef enum {
79 /* 9 - 10 are reserved */
86
91
94
97
100
103
106
109
112};
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
187
197 int (*output_string)(const char *str);
198
214
221 void (*input_complete)(void);
222
235 uint32_t *uri_hash);
236
247
256
265
275 void (*complete)(uint16_t net_idx, uint16_t addr);
276
284 void (*reprovisioned)(uint16_t addr);
285
297 void (*node_added)(uint16_t net_idx, uint8_t uuid[16], uint16_t addr,
298 uint8_t num_elem);
299
308 void (*reset)(void);
309};
310
311struct bt_mesh_rpr_cli;
312struct bt_mesh_rpr_node;
313
323int bt_mesh_input_string(const char *str);
324
335
342int bt_mesh_prov_remote_pub_key_set(const uint8_t public_key[64]);
343
364
388
401int bt_mesh_auth_method_set_static(const uint8_t *static_val, uint8_t size);
402
418
428
438
456 const uint8_t dev_key[16]);
457
469 uint8_t attention_duration);
470
482 uint8_t attention_duration);
483
497 const struct bt_mesh_rpr_node *srv,
498 const uint8_t uuid[16], uint16_t net_idx,
499 uint16_t addr);
500
534 struct bt_mesh_rpr_node *srv,
535 uint16_t addr, bool comp_change);
536
547
560#define BT_MESH_NET_PRIMARY 0x000
561
563#define BT_MESH_FEAT_RELAY BIT(0)
565#define BT_MESH_FEAT_PROXY BIT(1)
567#define BT_MESH_FEAT_FRIEND BIT(2)
569#define BT_MESH_FEAT_LOW_POWER BIT(3)
571#define BT_MESH_FEAT_SUPPORTED (BT_MESH_FEAT_RELAY | \
572 BT_MESH_FEAT_PROXY | \
573 BT_MESH_FEAT_FRIEND | \
574 BT_MESH_FEAT_LOW_POWER)
575
587int bt_mesh_init(const struct bt_mesh_prov *prov,
588 const struct bt_mesh_comp *comp);
589
600void bt_mesh_reset(void);
601
613
622
631void bt_mesh_iv_update_test(bool enable);
632
642
654int bt_mesh_lpn_set(bool enable);
655
664
678 void (*established)(uint16_t net_idx, uint16_t friend_addr,
679 uint8_t queue_size, uint8_t recv_window);
680
689 void (*terminated)(uint16_t net_idx, uint16_t friend_addr);
690
703 void (*polled)(uint16_t net_idx, uint16_t friend_addr, bool retry);
704};
705
711#define BT_MESH_LPN_CB_DEFINE(_name) \
712 static const STRUCT_SECTION_ITERABLE(bt_mesh_lpn_cb, \
713 _CONCAT(bt_mesh_lpn_cb_, \
714 _name))
715
728 void (*established)(uint16_t net_idx, uint16_t lpn_addr,
729 uint8_t recv_delay, uint32_t polltimeout);
730
739 void (*terminated)(uint16_t net_idx, uint16_t lpn_addr);
740
752 void (*polled)(uint16_t net_idx, uint16_t lpn_addr);
753};
754
763#define BT_MESH_FRIEND_CB_DEFINE(_name) \
764 static const STRUCT_SECTION_ITERABLE(bt_mesh_friend_cb, \
765 _CONCAT(bt_mesh_friend_cb_, \
766 _name))
767#if defined(CONFIG_BT_TESTING)
768struct bt_mesh_snb {
771
773 uint64_t net_id;
774
776 uint32_t iv_idx;
777
779 uint64_t auth_val;
780};
781
782struct bt_mesh_prb {
784 uint8_t random[13];
785
788
790 uint32_t iv_idx;
791
793 uint64_t auth_tag;
794};
795
797struct bt_mesh_beacon_cb {
805 void (*snb_received)(const struct bt_mesh_snb *snb);
806
814 void (*priv_received)(const struct bt_mesh_prb *prb);
815};
816
825#define BT_MESH_BEACON_CB_DEFINE(_name) \
826 static const STRUCT_SECTION_ITERABLE(bt_mesh_beacon_cb, \
827 _CONCAT(bt_mesh_beacon_cb_, \
828 _name))
829#endif
830
840
853
869const uint8_t *bt_mesh_va_uuid_get(uint16_t addr, const uint8_t *uuid, uint16_t *retaddr);
870
871#ifdef __cplusplus
872}
873#endif
874
879#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_prov_disable(bt_mesh_prov_bearer_t bearers)
Disable specific provisioning bearers.
int bt_mesh_input_number(uint32_t num)
Provide provisioning input OOB number.
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_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_PROV_AUTH_HMAC_SHA256_AES_CCM
Definition: main.h:33
@ BT_MESH_PROV_AUTH_CMAC_AES128_AES_CCM
Definition: main.h:32
@ 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_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:96
__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:1151
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:717
void(* terminated)(uint16_t net_idx, uint16_t lpn_addr)
Friendship terminated.
Definition: main.h:739
void(* polled)(uint16_t net_idx, uint16_t lpn_addr)
Friend Poll Request.
Definition: main.h:752
void(* established)(uint16_t net_idx, uint16_t lpn_addr, uint8_t recv_delay, uint32_t polltimeout)
Friendship established.
Definition: main.h:728
Low Power Node callback functions.
Definition: main.h:666
void(* established)(uint16_t net_idx, uint16_t friend_addr, uint8_t queue_size, uint8_t recv_window)
Friendship established.
Definition: main.h:678
void(* polled)(uint16_t net_idx, uint16_t friend_addr, bool retry)
Local Poll Request.
Definition: main.h:703
void(* terminated)(uint16_t net_idx, uint16_t friend_addr)
Friendship terminated.
Definition: main.h:689
Provisioning properties & capabilities.
Definition: main.h:115
void(* link_close)(bt_mesh_prov_bearer_t bearer)
Provisioning link has been closed.
Definition: main.h:264
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:221
int(* output_string)(const char *str)
Output of a string is requested.
Definition: main.h:197
int(* input)(bt_mesh_input_action_t act, uint8_t size)
Input is requested.
Definition: main.h:213
void(* link_open)(bt_mesh_prov_bearer_t bearer)
Provisioning link has been opened.
Definition: main.h:255
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:245
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:233
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:297
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:284
void(* complete)(uint16_t net_idx, uint16_t addr)
Provisioning is complete.
Definition: main.h:275
void(* reset)(void)
Node has been reset.
Definition: main.h:308
int(* output_number)(bt_mesh_output_action_t act, uint32_t num)
Output of a number is requested.
Definition: main.h:186
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