nRF5 SDK for Mesh v5.0.0
config_client.h
1 /* Copyright (c) 2010 - 2020, Nordic Semiconductor ASA
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form, except as embedded into a Nordic
11  * Semiconductor ASA integrated circuit in a product or a software update for
12  * such product, must reproduce the above copyright notice, this list of
13  * conditions and the following disclaimer in the documentation and/or other
14  * materials provided with the distribution.
15  *
16  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
17  * contributors may be used to endorse or promote products derived from this
18  * software without specific prior written permission.
19  *
20  * 4. This software, with or without modification, must only be used with a
21  * Nordic Semiconductor ASA integrated circuit.
22  *
23  * 5. Any software provided in binary form under this license must not be reverse
24  * engineered, decompiled, modified and/or disassembled.
25  *
26  * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
27  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28  * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
29  * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
30  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
32  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
35  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef CONFIG_CLIENT_H__
39 #define CONFIG_CLIENT_H__
40 
41 #include <stdint.h>
42 #include "config_messages.h"
43 #include "config_opcodes.h"
44 
45 #include "access.h"
46 #include "device_state_manager.h"
47 
57 #ifndef CONFIG_CLIENT_ACKED_TRANSACTION_TIMEOUT
58 #define CONFIG_CLIENT_ACKED_TRANSACTION_TIMEOUT (SEC_TO_US(60))
59 #endif
60 
62 typedef struct
63 {
65  uint16_t element_address;
72  uint16_t appkey_index;
82  uint8_t publish_ttl;
92 
94 typedef enum
95 {
96  CONFIG_CLIENT_EVENT_TYPE_TIMEOUT,
97  CONFIG_CLIENT_EVENT_TYPE_CANCELLED,
98  CONFIG_CLIENT_EVENT_TYPE_MSG
100 
102 typedef union
103 {
104  config_msg_appkey_status_t appkey_status;
105  config_msg_net_beacon_status_t net_beacon_status;
106  config_msg_publication_status_t publication_status;
107  config_msg_subscription_status_t subscription_status;
108  config_msg_netkey_status_t netkey_status;
109  config_msg_proxy_status_t proxy_status;
110  config_msg_key_refresh_phase_status_t key_refresh_phase_status;
111  config_msg_friend_status_t friend_status;
112  config_msg_heartbeat_publication_status_t heartbeat_publication_status;
113  config_msg_heartbeat_subscription_status_t heartbeat_subscription_status;
114  config_msg_default_ttl_status_t default_ttl_status;
115  config_msg_app_status_t app_status;
116  config_msg_identity_status_t identity_status;
117  config_msg_composition_data_status_t composition_data_status;
118  config_msg_relay_status_t relay_status;
119  config_msg_appkey_list_t appkey_list;
120  config_msg_sig_model_app_list_t sig_model_app_list;
121  config_msg_vendor_model_app_list_t vendor_model_app_list;
122  config_msg_sig_model_subscription_list_t sig_model_subscription_list;
123  config_msg_vendor_model_subscription_list_t vendor_model_subscription_list;
124 } config_msg_t;
125 
127 typedef struct
128 {
134 
141 typedef void (*config_client_event_cb_t)(config_client_event_type_t event_type, const config_client_event_t * p_event, uint16_t length);
142 
143 
156 
171 uint32_t config_client_server_set(dsm_handle_t server_devkey_handle, dsm_handle_t server_address_handle);
172 
185 uint32_t config_client_server_bind(dsm_handle_t server_devkey_handle);
186 
203 uint32_t config_client_composition_data_get(uint8_t page_number);
204 
219 uint32_t config_client_appkey_add(uint16_t netkey_index, uint16_t appkey_index, const uint8_t * p_appkey);
220 
234 uint32_t config_client_appkey_delete(uint16_t netkey_index, uint16_t appkey_index);
235 
248 uint32_t config_client_appkey_get(uint16_t netkey_index);
249 
264 uint32_t config_client_appkey_update(uint16_t netkey_index, uint16_t appkey_index, const uint8_t * p_appkey);
265 
279 uint32_t config_client_netkey_add(uint16_t netkey_index, const uint8_t * p_netkey);
280 
293 uint32_t config_client_netkey_delete(uint16_t netkey_index);
294 
305 uint32_t config_client_netkey_get(void);
306 
320 uint32_t config_client_netkey_update(uint16_t netkey_index, const uint8_t * p_netkey);
321 
335 uint32_t config_client_model_publication_get(uint16_t element_address, access_model_id_t model_id);
336 
349 uint32_t config_client_model_publication_set(const config_publication_state_t * p_publication_state);
350 
365 uint32_t config_client_model_subscription_add(uint16_t element_address, nrf_mesh_address_t address, access_model_id_t model_id);
366 
381 uint32_t config_client_model_subscription_delete(uint16_t element_address, nrf_mesh_address_t address, access_model_id_t model_id);
382 
396 uint32_t config_client_model_subscription_delete_all(uint16_t element_address, access_model_id_t model_id);
397 
412 uint32_t config_client_model_subscription_get(uint16_t element_address, access_model_id_t model_id);
413 
430 uint32_t config_client_model_subscription_overwrite(uint16_t element_address, nrf_mesh_address_t address, access_model_id_t model_id);
431 
446 uint32_t config_client_model_app_bind(uint16_t element_address, uint16_t appkey_index, access_model_id_t model_id);
447 
462 uint32_t config_client_model_app_get(uint16_t element_address, access_model_id_t model_id);
463 
478 uint32_t config_client_model_app_unbind(uint16_t element_address, uint16_t appkey_index, access_model_id_t model_id);
479 
490 uint32_t config_client_default_ttl_get(void);
491 
504 uint32_t config_client_default_ttl_set(uint8_t ttl);
505 
516 uint32_t config_client_relay_get(void);
517 
534 uint32_t config_client_relay_set(config_relay_state_t relay_state, uint8_t retransmit_count, uint8_t retransmit_interval_steps);
535 
547 
563 uint32_t config_client_network_transmit_set(uint8_t transmit_count, uint8_t transmit_interval_steps);
564 
575 uint32_t config_client_net_beacon_get(void);
576 
590 
603 uint32_t config_client_node_reset(void);
604 
617 uint32_t config_client_key_refresh_phase_get(uint16_t netkey_index);
618 
632 uint32_t config_client_key_refresh_phase_set(uint16_t netkey_index, nrf_mesh_key_refresh_phase_t phase);
633 
644 uint32_t config_client_friend_get(void);
645 
659 
670 uint32_t config_client_gatt_proxy_get(void);
671 
685 
698 uint32_t config_client_node_identity_get(uint16_t netkey_index);
699 
713 uint32_t config_client_node_identity_set(uint16_t netkey_index, config_identity_state_t state);
714 
726 
740 
752 
766 
779 uint32_t config_client_low_power_node_polltimeout_get(uint16_t lpn_address);
780 
785 
788 #endif /* CONFIG_CLIENT_H__ */
789 
uint32_t config_client_appkey_add(uint16_t netkey_index, uint16_t appkey_index, const uint8_t *p_appkey)
Sends an application key add request.
Message format for the AppKey Status message.
uint32_t config_client_model_publication_get(uint16_t element_address, access_model_id_t model_id)
Sends a publication get request.
Message format for the Model App Status message.
uint8_t retransmit_interval
Retransmit interval (in multiples of 50 ms).
Definition: config_client.h:88
Message format for the Friend Status message.
config_gatt_proxy_state_t
Possible values for the GATT Proxy state.
config_net_beacon_state_t
Possible values for the network beacon state.
uint32_t config_client_init(config_client_event_cb_t event_cb)
Initializes the configuration client.
nrf_mesh_address_t publish_address
Publish address.
Definition: config_client.h:70
uint32_t config_client_model_subscription_delete_all(uint16_t element_address, access_model_id_t model_id)
Sends a subscription delete all request.
config_friend_state_t
Possible values for the Friend state.
uint32_t config_client_model_app_bind(uint16_t element_address, uint16_t appkey_index, access_model_id_t model_id)
Sends a application bind request.
uint32_t config_client_net_beacon_get(void)
Sends a secure network beacon state get request.
uint32_t config_client_server_set(dsm_handle_t server_devkey_handle, dsm_handle_t server_address_handle)
Sets the configuration server to configure.
uint32_t config_client_model_subscription_add(uint16_t element_address, nrf_mesh_address_t address, access_model_id_t model_id)
Sends a subscription add request.
Message format for the Model Subscription Status message.
uint32_t config_client_netkey_update(uint16_t netkey_index, const uint8_t *p_netkey)
Sends a network key update request.
uint16_t dsm_handle_t
DSM handle type, used for the handles returned for the each set of data added.
uint16_t element_address
Element address of the model to set the publication state.
Definition: config_client.h:65
uint32_t config_client_node_identity_get(uint16_t netkey_index)
Gets the current Node Identity state of a node.
Union of possible status message responses.
uint32_t config_client_relay_set(config_relay_state_t relay_state, uint8_t retransmit_count, uint8_t retransmit_interval_steps)
Sends a relay state set request.
uint32_t config_client_model_subscription_delete(uint16_t element_address, nrf_mesh_address_t address, access_model_id_t model_id)
Sends a subscription delete request.
uint32_t config_client_netkey_delete(uint16_t netkey_index)
Sends a network key delete request.
uint32_t config_client_heartbeat_publication_set(const config_msg_heartbeat_publication_set_t *p_publication)
Sets the heartbeat publication state value of a node.
Message format for the Relay Status message.
uint32_t config_client_default_ttl_get(void)
Sends a default TTL get request.
config_identity_state_t
Possible values for the identity state.
Message format for the Heartbeat Subscription Status message.
Message format for the Node Identity Status message.
uint32_t config_client_relay_get(void)
Sends a relay state get request.
uint32_t config_client_gatt_proxy_get(void)
Gets the current GATT Proxy state of a node.
Configuration client event structure.
config_opcode_t
Configuration model opcodes.
Message format for the GATT Proxy Status message.
uint32_t config_client_network_transmit_get(void)
Sends a network transmit get request.
uint32_t config_client_node_identity_set(uint16_t netkey_index, config_identity_state_t state)
Sets the current Node Identity state of a node.
uint32_t config_client_model_subscription_get(uint16_t element_address, access_model_id_t model_id)
Sends a subscription get request.
uint32_t config_client_key_refresh_phase_set(uint16_t netkey_index, nrf_mesh_key_refresh_phase_t phase)
Sets the current key refresh phase of a node.
Publication state parameter structure.
Definition: config_client.h:62
Message format for the Vendor Model App List message.
void config_client_pending_msg_cancel(void)
Cancel any ongoing reliable message transfer.
access_model_id_t model_id
Model identifier.
Definition: config_client.h:90
uint32_t config_client_appkey_delete(uint16_t netkey_index, uint16_t appkey_index)
Sends an application key delete request.
uint32_t config_client_appkey_update(uint16_t netkey_index, uint16_t appkey_index, const uint8_t *p_appkey)
Sends an application key update request.
uint32_t config_client_heartbeat_publication_get(void)
Gets the heartbeat publication state value of a node.
uint32_t config_client_heartbeat_subscription_get(void)
Gets the heartbeat subscription state value of a node.
uint32_t config_client_server_bind(dsm_handle_t server_devkey_handle)
Binds the configuration client to a server.
const config_msg_t * p_msg
Pointer to message structure.
uint32_t config_client_gatt_proxy_set(config_gatt_proxy_state_t state)
Sets the GATT Proxy state of a node.
uint32_t config_client_net_beacon_set(config_net_beacon_state_t state)
Sends a secure network beacon state set request.
uint32_t config_client_friend_get(void)
Gets the current Friend state of a node.
Message format for the Key Refresh Phase Status message.
uint32_t config_client_netkey_add(uint16_t netkey_index, const uint8_t *p_netkey)
Sends a network key add request.
uint32_t config_client_model_app_get(uint16_t element_address, access_model_id_t model_id)
Sends an application get request.
uint16_t appkey_index
Application key index.
Definition: config_client.h:72
config_relay_state_t
Values for the relay state.
uint32_t config_client_model_subscription_overwrite(uint16_t element_address, nrf_mesh_address_t address, access_model_id_t model_id)
Sends a subscription overwrite request.
Message format for the Config Beacon Status message.
uint32_t config_client_heartbeat_subscription_set(const config_msg_heartbeat_subscription_set_t *p_subscription)
Sets the heartbeat subscription state value of a node.
Message format for the Heartbeat Publication Status message.
Message format for the SIG Model App List message.
nrf_mesh_key_refresh_phase_t
Key refresh phase.
Definition: nrf_mesh.h:225
uint32_t config_client_default_ttl_set(uint8_t ttl)
Sends a default TTL set request.
uint32_t config_client_netkey_get(void)
Sends a network key(s) get request.
uint32_t config_client_model_publication_set(const config_publication_state_t *p_publication_state)
Sends a model publication set request.
Message format for the Model Publication Status message.
uint32_t config_client_network_transmit_set(uint8_t transmit_count, uint8_t transmit_interval_steps)
Sends a network transmit set request.
Message format for the Composition Data Status message.
config_client_event_type_t
Configuration client event types.
Definition: config_client.h:94
Bluetooth Mesh address.
Definition: nrf_mesh.h:374
Message format for the Heartbeat Publication Set message.
uint32_t config_client_key_refresh_phase_get(uint16_t netkey_index)
Gets the current key refresh phase of a node.
void(* config_client_event_cb_t)(config_client_event_type_t event_type, const config_client_event_t *p_event, uint16_t length)
Configuration client event callback type.
Model publish period structure.
Definition: access.h:299
Message format for the Heartbeat Subscription Set message.
Access layer model ID.
Definition: access.h:151
uint8_t publish_ttl
Publish TTL value.
Definition: config_client.h:82
uint32_t config_client_composition_data_get(uint8_t page_number)
Sends a composition data GET request.
uint32_t config_client_appkey_get(uint16_t netkey_index)
Sends an application key(s) get request.
Message format for the Vendor Model Subscription List message.
uint32_t config_client_friend_set(config_friend_state_t state)
Sets the Friend state of a node.
config_opcode_t opcode
Opcode of the status reply.
bool frendship_credential_flag
Set true to use friendship credentials for publishing.
Definition: config_client.h:77
Message format for the AppKey List message.
uint8_t retransmit_count
Retransmit count.
Definition: config_client.h:86
Message format for the Default TTL Status message.
Message format for the Network Key Status message.
uint32_t config_client_model_app_unbind(uint16_t element_address, uint16_t appkey_index, access_model_id_t model_id)
Sends a application unbind request.
access_publish_period_t publish_period
Publish period.
Definition: config_client.h:84
Message format for the SIG Model Subscription List message.
uint32_t config_client_node_reset(void)
Sends a node reset request.
uint32_t config_client_low_power_node_polltimeout_get(uint16_t lpn_address)
Gets the current value of the PollTimeout timer of the Low Power node.

Documentation feedback | Developer Zone | Subscribe | Updated