44 #include "nrf_mesh_sdk.h" 45 #include "nrf_delay.h" 46 #include "simple_hal.h" 50 #include "nrf_mesh_events.h" 54 #include "access_config.h" 55 #include "device_state_manager.h" 56 #include "nrf_mesh_node_config.h" 58 #include "simple_on_off_server.h" 60 #include "light_switch_example_common.h" 66 #define LED_PIN_NUMBER (BSP_LED_0) 67 #define LED_PIN_MASK (1u << LED_PIN_NUMBER) 73 static simple_on_off_server_t m_server;
76 static bool get_cb(
const simple_on_off_server_t * p_server);
77 static bool set_cb(
const simple_on_off_server_t * p_server,
bool value);
83 static void configuration_setup(
void * p_unused)
85 __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,
"Initializing and adding models\n");
86 m_server.get_cb = get_cb;
87 m_server.set_cb = set_cb;
90 hal_led_mask_set(LEDS_MASK,
true);
93 static void provisioning_complete(
void * p_unused)
95 __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,
"Successfully provisioned\n");
96 hal_led_mask_set(LEDS_MASK,
false);
97 hal_led_blink_ms(LED_PIN_MASK, 200, 4);
104 static bool get_cb(
const simple_on_off_server_t * p_server)
106 return hal_led_pin_get(LED_PIN_NUMBER);
109 static bool set_cb(
const simple_on_off_server_t * p_server,
bool value)
111 __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,
"Got SET command to %u\n", value);
112 hal_led_pin_set(LED_PIN_NUMBER, value);
119 __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,
"----- BLE Mesh Light Switch Server Demo -----\n");
132 config_params.
lf_clk_cfg = NRF_CLOCK_LFCLKSRC_XTAL_20_PPM;
133 #elif SD_BLE_API_VERSION >= 5 134 config_params.
lf_clk_cfg.source = NRF_CLOCK_LF_SRC_XTAL;
135 config_params.
lf_clk_cfg.accuracy = NRF_CLOCK_LF_ACCURACY_20_PPM;
137 config_params.
lf_clk_cfg.source = NRF_CLOCK_LF_SRC_XTAL;
138 config_params.
lf_clk_cfg.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM;
145 (void)sd_app_evt_wait();
nrf_mesh_prov_oob_caps_t prov_caps
Device capabilities for OOB authentication.
uint32_t access_model_subscription_list_alloc(access_model_handle_t handle)
Allocates a subscription list for a model.
#define NRF_MESH_KEY_SIZE
Size (in octets) of an encryption key.
Node configuration parameters.
#define NRF_MESH_PROV_OOB_CAPS_DEFAULT(NUM_ELEMENTS)
Sets the default authentication capabilities.
nrf_clock_lf_cfg_t lf_clk_cfg
Low frequency clock configuration.
uint8_t irq_priority
Application IRQ priority.
nrf_mesh_node_config_complete_cb_t complete_callback
Pointer to a function used to signal the completion of the node configuration procedure.
#define NRF_MESH_IRQ_PRIORITY_LOWEST
Lowest available IRQ priority on current architecture.
#define LOG_CALLBACK_DEFAULT
The default callback function to use.
uint32_t simple_on_off_server_init(simple_on_off_server_t *p_server, uint16_t element_index)
Initializes the Simple OnOff server.
nrf_mesh_node_config_setup_cb_t setup_callback
Pointer to a function used to allow initialization of application-specific models.
const uint8_t * p_static_data
Data used for OOB authentication when the static authentication method is used.
uint32_t nrf_mesh_node_config(const nrf_mesh_node_config_params_t *p_params)
Configures the mesh node.
#define ACCESS_ELEMENT_COUNT
The number of elements in the application.