mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-15 23:42:52 +00:00
mesh: collect init code in mesh_init
This commit is contained in:
parent
5bc1bfd55c
commit
e9ea9d588d
@ -139,6 +139,7 @@
|
||||
#include "mesh/mesh_upper_transport.h"
|
||||
#include "mesh/pb_adv.h"
|
||||
#include "mesh/pb_gatt.h"
|
||||
#include "mesh.h"
|
||||
#include "mesh_access.h"
|
||||
#include "mesh_configuration_server.h"
|
||||
#include "mesh_foundation.h"
|
||||
|
2
test/mesh/.gitignore
vendored
2
test/mesh/.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
mesh
|
||||
mesh_pts
|
||||
mesh_message_test
|
||||
mesh_provisioning_device
|
||||
mesh_provisioning_device.h
|
||||
|
@ -617,11 +617,15 @@ int btstack_main(void)
|
||||
// setup le device db
|
||||
le_device_db_init();
|
||||
|
||||
// setup ATT server
|
||||
att_server_init(profile_data, NULL, NULL);
|
||||
|
||||
//
|
||||
sm_init();
|
||||
|
||||
|
||||
// mesh
|
||||
adv_bearer_init();
|
||||
mesh_init();
|
||||
|
||||
// setup connectable advertisments
|
||||
bd_addr_t null_addr;
|
||||
@ -631,42 +635,9 @@ int btstack_main(void)
|
||||
uint16_t adv_int_max = 0x0030;
|
||||
adv_bearer_advertisements_set_params(adv_int_min, adv_int_max, adv_type, 0, null_addr, 0x07, 0x00);
|
||||
|
||||
// setup ATT server
|
||||
att_server_init(profile_data, NULL, NULL);
|
||||
|
||||
// Setup GATT bearer
|
||||
gatt_bearer_init();
|
||||
|
||||
#ifdef ENABLE_MESH_ADV_BEARER
|
||||
// Setup Unprovisioned Device Beacon
|
||||
beacon_init();
|
||||
// Register for Unprovisioned Device Beacons provisioner
|
||||
beacon_register_for_unprovisioned_device_beacons(&mesh_unprovisioned_beacon_handler);
|
||||
#endif
|
||||
|
||||
// Parse PTS Device UUID
|
||||
uint8_t pts_device_uuid[16];
|
||||
btstack_parse_hex(pts_device_uuid_string, 16, pts_device_uuid);
|
||||
mesh_node_set_device_uuid(pts_device_uuid);
|
||||
btstack_print_hex(pts_device_uuid, 16, 0);
|
||||
|
||||
// Provisioning in device role
|
||||
provisioning_device_init();
|
||||
provisioning_device_register_packet_handler(&mesh_provisioning_message_handler);
|
||||
|
||||
// Network layer
|
||||
mesh_network_init();
|
||||
|
||||
// Transport layers (lower + upper))
|
||||
mesh_lower_transport_init();
|
||||
mesh_upper_transport_init();
|
||||
|
||||
// Access layer
|
||||
mesh_access_init();
|
||||
|
||||
// Node Configuration
|
||||
mesh_node_init();
|
||||
|
||||
// Setup default models on primary element
|
||||
mesh_node_setup_default_models();
|
||||
|
||||
@ -687,6 +658,24 @@ int btstack_main(void)
|
||||
// Enable PROXY
|
||||
mesh_foundation_gatt_proxy_set(1);
|
||||
|
||||
#if defined(ENABLE_MESH_ADV_BEARER)
|
||||
// setup scanning when supporting ADV Bearer
|
||||
gap_set_scan_parameters(0, 0x300, 0x300);
|
||||
gap_start_scan();
|
||||
#endif
|
||||
|
||||
// PTS add-on
|
||||
|
||||
#ifdef ENABLE_MESH_ADV_BEARER
|
||||
// Register for Unprovisioned Device Beacons provisioner
|
||||
beacon_register_for_unprovisioned_device_beacons(&mesh_unprovisioned_beacon_handler);
|
||||
#endif
|
||||
|
||||
// Set PTS Device UUID
|
||||
uint8_t pts_device_uuid[16];
|
||||
btstack_parse_hex(pts_device_uuid_string, 16, pts_device_uuid);
|
||||
mesh_node_set_device_uuid(pts_device_uuid);
|
||||
btstack_print_hex(pts_device_uuid, 16, 0);
|
||||
|
||||
// PTS Virtual Address Label UUID - without Config Model, PTS uses our device uuid
|
||||
uint8_t label_uuid[16];
|
||||
@ -694,12 +683,6 @@ int btstack_main(void)
|
||||
mesh_virtual_address_t * virtual_addresss = mesh_virtual_address_register(label_uuid, 0x9779);
|
||||
pts_proxy_dst = virtual_addresss->pseudo_dst;
|
||||
|
||||
#if defined(ENABLE_MESH_ADV_BEARER)
|
||||
// setup scanning when supporting ADV Bearer
|
||||
gap_set_scan_parameters(0, 0x300, 0x300);
|
||||
gap_start_scan();
|
||||
#endif
|
||||
|
||||
// turn on!
|
||||
hci_power_control(HCI_POWER_ON);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user