123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690 |
- #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_MAIN_H_
- #define ZEPHYR_INCLUDE_BLUETOOTH_MESH_MAIN_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef enum {
- BT_MESH_NO_OUTPUT = 0,
- BT_MESH_BLINK = BIT(0),
- BT_MESH_BEEP = BIT(1),
- BT_MESH_VIBRATE = BIT(2),
- BT_MESH_DISPLAY_NUMBER = BIT(3),
- BT_MESH_DISPLAY_STRING = BIT(4),
- } bt_mesh_output_action_t;
- typedef enum {
- BT_MESH_NO_INPUT = 0,
- BT_MESH_PUSH = BIT(0),
- BT_MESH_TWIST = BIT(1),
- BT_MESH_ENTER_NUMBER = BIT(2),
- BT_MESH_ENTER_STRING = BIT(3),
- } bt_mesh_input_action_t;
- typedef enum {
- BT_MESH_PROV_ADV = BIT(0),
- BT_MESH_PROV_GATT = BIT(1),
- } bt_mesh_prov_bearer_t;
- typedef enum {
- BT_MESH_PROV_OOB_OTHER = BIT(0),
- BT_MESH_PROV_OOB_URI = BIT(1),
- BT_MESH_PROV_OOB_2D_CODE = BIT(2),
- BT_MESH_PROV_OOB_BAR_CODE = BIT(3),
- BT_MESH_PROV_OOB_NFC = BIT(4),
- BT_MESH_PROV_OOB_NUMBER = BIT(5),
- BT_MESH_PROV_OOB_STRING = BIT(6),
-
- BT_MESH_PROV_OOB_ON_BOX = BIT(11),
- BT_MESH_PROV_OOB_IN_BOX = BIT(12),
- BT_MESH_PROV_OOB_ON_PAPER = BIT(13),
- BT_MESH_PROV_OOB_IN_MANUAL = BIT(14),
- BT_MESH_PROV_OOB_ON_DEV = BIT(15),
- } bt_mesh_prov_oob_info_t;
- struct bt_mesh_dev_capabilities {
-
- uint8_t elem_count;
-
- uint16_t algorithms;
-
- uint8_t pub_key_type;
-
- uint8_t static_oob;
-
- bt_mesh_output_action_t output_actions;
-
- bt_mesh_input_action_t input_actions;
-
- uint8_t output_size;
-
- uint8_t input_size;
- };
- struct bt_mesh_prov {
-
- const uint8_t *uuid;
-
- const char *uri;
-
- bt_mesh_prov_oob_info_t oob_info;
-
- const uint8_t *public_key_be;
-
- const uint8_t *private_key_be;
-
- const uint8_t *static_val;
-
- uint8_t static_val_len;
-
- uint8_t output_size;
-
- uint16_t output_actions;
-
- uint8_t input_size;
-
- uint16_t input_actions;
-
- void (*capabilities)(const struct bt_mesh_dev_capabilities *cap);
-
- int (*output_number)(bt_mesh_output_action_t act, uint32_t num);
-
- int (*output_string)(const char *str);
-
- int (*input)(bt_mesh_input_action_t act, uint8_t size);
-
- void (*input_complete)(void);
-
- void (*unprovisioned_beacon)(uint8_t uuid[16],
- bt_mesh_prov_oob_info_t oob_info,
- uint32_t *uri_hash);
-
- void (*link_open)(bt_mesh_prov_bearer_t bearer);
-
- void (*link_close)(bt_mesh_prov_bearer_t bearer);
-
- void (*complete)(uint16_t net_idx, uint16_t addr);
-
- void (*node_added)(uint16_t net_idx, uint8_t uuid[16], uint16_t addr,
- uint8_t num_elem);
-
- void (*reset)(void);
- };
- int bt_mesh_input_string(const char *str);
- int bt_mesh_input_number(uint32_t num);
- int bt_mesh_prov_remote_pub_key_set(const uint8_t public_key[64]);
- int bt_mesh_auth_method_set_input(bt_mesh_input_action_t action, uint8_t size);
- int bt_mesh_auth_method_set_output(bt_mesh_output_action_t action, uint8_t size);
- int bt_mesh_auth_method_set_static(const uint8_t *static_val, uint8_t size);
- int bt_mesh_auth_method_set_none(void);
- int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers);
- int bt_mesh_prov_disable(bt_mesh_prov_bearer_t bearers);
- 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]);
- int bt_mesh_provision_adv(const uint8_t uuid[16], uint16_t net_idx, uint16_t addr,
- uint8_t attention_duration);
- bool bt_mesh_is_provisioned(void);
- #define BT_MESH_NET_PRIMARY 0x000
- #define BT_MESH_FEAT_RELAY BIT(0)
- #define BT_MESH_FEAT_PROXY BIT(1)
- #define BT_MESH_FEAT_FRIEND BIT(2)
- #define BT_MESH_FEAT_LOW_POWER BIT(3)
- #define BT_MESH_FEAT_SUPPORTED (BT_MESH_FEAT_RELAY | \
- BT_MESH_FEAT_PROXY | \
- BT_MESH_FEAT_FRIEND | \
- BT_MESH_FEAT_LOW_POWER)
- int bt_mesh_init(const struct bt_mesh_prov *prov,
- const struct bt_mesh_comp *comp);
- void bt_mesh_reset(void);
- int bt_mesh_suspend(void);
- int bt_mesh_resume(void);
- void bt_mesh_iv_update_test(bool enable);
- bool bt_mesh_iv_update(void);
- int bt_mesh_lpn_set(bool enable);
- int bt_mesh_lpn_poll(void);
- struct bt_mesh_lpn_cb {
-
- void (*established)(uint16_t net_idx, uint16_t friend_addr,
- uint8_t queue_size, uint8_t recv_window);
-
- void (*terminated)(uint16_t net_idx, uint16_t friend_addr);
-
- void (*polled)(uint16_t net_idx, uint16_t friend_addr, bool retry);
- };
- #define BT_MESH_LPN_CB_DEFINE(_name) \
- static const STRUCT_SECTION_ITERABLE(bt_mesh_lpn_cb, \
- _CONCAT(bt_mesh_lpn_cb_, \
- _name))
- struct bt_mesh_friend_cb {
-
- void (*established)(uint16_t net_idx, uint16_t lpn_addr,
- uint8_t recv_delay, uint32_t polltimeout);
-
- void (*terminated)(uint16_t net_idx, uint16_t lpn_addr);
-
- void (*polled)(uint16_t net_idx, uint16_t lpn_addr);
- };
- #define BT_MESH_FRIEND_CB_DEFINE(_name) \
- static const STRUCT_SECTION_ITERABLE(bt_mesh_friend_cb, \
- _CONCAT(bt_mesh_friend_cb_, \
- _name))
- int bt_mesh_friend_terminate(uint16_t lpn_addr);
- void bt_mesh_rpl_pending_store(uint16_t addr);
- #ifdef __cplusplus
- }
- #endif
- #endif
|