xref: /btstack/src/mesh/mesh_configuration_client.h (revision e38651d8f487f14ed0a12cde21a476e72f00d5ed)
1cc2a5f42SMilanka Ringwald /*
2cc2a5f42SMilanka Ringwald  * Copyright (C) 2019 BlueKitchen GmbH
3cc2a5f42SMilanka Ringwald  *
4cc2a5f42SMilanka Ringwald  * Redistribution and use in source and binary forms, with or without
5cc2a5f42SMilanka Ringwald  * modification, are permitted provided that the following conditions
6cc2a5f42SMilanka Ringwald  * are met:
7cc2a5f42SMilanka Ringwald  *
8cc2a5f42SMilanka Ringwald  * 1. Redistributions of source code must retain the above copyright
9cc2a5f42SMilanka Ringwald  *    notice, this list of conditions and the following disclaimer.
10cc2a5f42SMilanka Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11cc2a5f42SMilanka Ringwald  *    notice, this list of conditions and the following disclaimer in the
12cc2a5f42SMilanka Ringwald  *    documentation and/or other materials provided with the distribution.
13cc2a5f42SMilanka Ringwald  * 3. Neither the name of the copyright holders nor the names of
14cc2a5f42SMilanka Ringwald  *    contributors may be used to endorse or promote products derived
15cc2a5f42SMilanka Ringwald  *    from this software without specific prior written permission.
16cc2a5f42SMilanka Ringwald  * 4. Any redistribution, use, or modification is done solely for
17cc2a5f42SMilanka Ringwald  *    personal benefit and not for any commercial purpose or for
18cc2a5f42SMilanka Ringwald  *    monetary gain.
19cc2a5f42SMilanka Ringwald  *
20cc2a5f42SMilanka Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21cc2a5f42SMilanka Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22cc2a5f42SMilanka Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23cc2a5f42SMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24cc2a5f42SMilanka Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25cc2a5f42SMilanka Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26cc2a5f42SMilanka Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27cc2a5f42SMilanka Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28cc2a5f42SMilanka Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29cc2a5f42SMilanka Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30cc2a5f42SMilanka Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31cc2a5f42SMilanka Ringwald  * SUCH DAMAGE.
32cc2a5f42SMilanka Ringwald  *
33cc2a5f42SMilanka Ringwald  * Please inquire about commercial licensing options at
34cc2a5f42SMilanka Ringwald  * [email protected]
35cc2a5f42SMilanka Ringwald  *
36cc2a5f42SMilanka Ringwald  */
37cc2a5f42SMilanka Ringwald 
38cc2a5f42SMilanka Ringwald #ifndef __MESH_CONFIGURATION_CLIENT_H
39cc2a5f42SMilanka Ringwald #define __MESH_CONFIGURATION_CLIENT_H
40cc2a5f42SMilanka Ringwald 
41cc2a5f42SMilanka Ringwald #include <stdint.h>
42cc2a5f42SMilanka Ringwald 
43cc2a5f42SMilanka Ringwald #include "mesh/mesh_access.h"
44cc2a5f42SMilanka Ringwald 
45cc2a5f42SMilanka Ringwald #ifdef __cplusplus
46cc2a5f42SMilanka Ringwald extern "C"
47cc2a5f42SMilanka Ringwald {
48cc2a5f42SMilanka Ringwald #endif
49cc2a5f42SMilanka Ringwald 
50cc2a5f42SMilanka Ringwald /**
51cc2a5f42SMilanka Ringwald  * @brief Register packet handler
52cc2a5f42SMilanka Ringwald  * @param configuration_client_model
53cc2a5f42SMilanka Ringwald  * @param events_packet_handler
54cc2a5f42SMilanka Ringwald  */
55aaf0c1d1SMilanka Ringwald void mesh_configuration_client_register_packet_handler(mesh_model_t *configuration_client_model, btstack_packet_handler_t events_packet_handler);
56aaf0c1d1SMilanka Ringwald 
57aaf0c1d1SMilanka Ringwald /**
585448198cSMilanka Ringwald  * @brief Get the current Secure Network Beacon state of a node.
59aaf0c1d1SMilanka Ringwald  * @param mesh_model
60aaf0c1d1SMilanka Ringwald  * @param dest
61aaf0c1d1SMilanka Ringwald  * @param netkey_index
62aaf0c1d1SMilanka Ringwald  * @param appkey_index
635448198cSMilanka Ringwald  * @return status       ERROR_CODE_SUCCESS if successful, otherwise BTSTACK_MEMORY_ALLOC_FAILED or ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE
64aaf0c1d1SMilanka Ringwald  */
653013af6aSMilanka Ringwald uint8_t mesh_configuration_client_send_beacon_get(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index);
66cc2a5f42SMilanka Ringwald 
675448198cSMilanka Ringwald /**
685448198cSMilanka Ringwald  * @brief Get the current Secure Network Beacon state of a node.
695448198cSMilanka Ringwald  * @param mesh_model
705448198cSMilanka Ringwald  * @param dest
715448198cSMilanka Ringwald  * @param netkey_index
725448198cSMilanka Ringwald  * @param appkey_index
735448198cSMilanka Ringwald  * @param Beacon        0x01 The node is broadcasting a Secure Network beacon, 0x00 broadcastinis  off
745448198cSMilanka Ringwald  * @return status       ERROR_CODE_SUCCESS if successful, otherwise BTSTACK_MEMORY_ALLOC_FAILED or ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE
755448198cSMilanka Ringwald  */
763013af6aSMilanka Ringwald uint8_t mesh_configuration_client_send_beacon_set(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index, uint8_t beacon);
773013af6aSMilanka Ringwald 
783013af6aSMilanka Ringwald /**
793013af6aSMilanka Ringwald  * @brief Read one page of the Composition Data.
803013af6aSMilanka Ringwald  * @param mesh_model
813013af6aSMilanka Ringwald  * @param dest
823013af6aSMilanka Ringwald  * @param netkey_index
833013af6aSMilanka Ringwald  * @param appkey_index
843013af6aSMilanka Ringwald  * @param page          Page number of the Composition Data
853013af6aSMilanka Ringwald  * @return status       ERROR_CODE_SUCCESS if successful, otherwise BTSTACK_MEMORY_ALLOC_FAILED or ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE
863013af6aSMilanka Ringwald  */
873013af6aSMilanka Ringwald uint8_t mesh_configuration_client_send_composition_data_get(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index, uint8_t page);
88cc2a5f42SMilanka Ringwald 
89344d6549SMilanka Ringwald /**
90344d6549SMilanka Ringwald  * @brief Get the current Default TTL state of a node
91344d6549SMilanka Ringwald  * @param mesh_model
92344d6549SMilanka Ringwald  * @param dest
93344d6549SMilanka Ringwald  * @param netkey_index
94344d6549SMilanka Ringwald  * @param appkey_index
95344d6549SMilanka Ringwald  * @return status       ERROR_CODE_SUCCESS if successful, otherwise BTSTACK_MEMORY_ALLOC_FAILED or ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE
96344d6549SMilanka Ringwald  */
97344d6549SMilanka Ringwald uint8_t mesh_configuration_client_send_default_ttl_get(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index);
98344d6549SMilanka Ringwald 
99344d6549SMilanka Ringwald /**
100344d6549SMilanka Ringwald  * @brief Set Default TTL state of a node
101344d6549SMilanka Ringwald  * @param mesh_model
102344d6549SMilanka Ringwald  * @param dest
103344d6549SMilanka Ringwald  * @param netkey_index
104344d6549SMilanka Ringwald  * @param appkey_index
105344d6549SMilanka Ringwald  * @param ttl           allowed values: 0x00, 0x02–0x7F
106344d6549SMilanka Ringwald  * @return status       ERROR_CODE_SUCCESS if successful, otherwise BTSTACK_MEMORY_ALLOC_FAILED or ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE
107344d6549SMilanka Ringwald  */
108344d6549SMilanka Ringwald uint8_t mesh_configuration_client_send_default_ttl_set(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index, uint8_t ttl);
109344d6549SMilanka Ringwald 
110*e38651d8SMilanka Ringwald /**
111*e38651d8SMilanka Ringwald  * @brief Get the current Default GATT proxy state of a node
112*e38651d8SMilanka Ringwald  * @param mesh_model
113*e38651d8SMilanka Ringwald  * @param dest
114*e38651d8SMilanka Ringwald  * @param netkey_index
115*e38651d8SMilanka Ringwald  * @param appkey_index
116*e38651d8SMilanka Ringwald  * @return status       ERROR_CODE_SUCCESS if successful, otherwise BTSTACK_MEMORY_ALLOC_FAILED or ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE
117*e38651d8SMilanka Ringwald  */
118*e38651d8SMilanka Ringwald uint8_t mesh_configuration_client_send_default_gatt_proxy_state_get(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index);
119*e38651d8SMilanka Ringwald 
120*e38651d8SMilanka Ringwald /**
121*e38651d8SMilanka Ringwald  * @brief Set Default GATT proxy state of a node
122*e38651d8SMilanka Ringwald  * @param mesh_model
123*e38651d8SMilanka Ringwald  * @param dest
124*e38651d8SMilanka Ringwald  * @param netkey_index
125*e38651d8SMilanka Ringwald  * @param appkey_index
126*e38651d8SMilanka Ringwald  * @param gatt_proxy_state        0 - the proxy feature is supported and disabled, 1 - supported and enabled, 2 - not supported
127*e38651d8SMilanka Ringwald  * @return status       ERROR_CODE_SUCCESS if successful, otherwise BTSTACK_MEMORY_ALLOC_FAILED or ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE
128*e38651d8SMilanka Ringwald  */
129*e38651d8SMilanka Ringwald uint8_t mesh_configuration_client_send_default_gatt_proxy_state_set(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index, uint8_t gatt_proxy_state);
130*e38651d8SMilanka Ringwald 
131cc2a5f42SMilanka Ringwald #ifdef __cplusplus
132cc2a5f42SMilanka Ringwald } /* end of extern "C" */
133cc2a5f42SMilanka Ringwald #endif
134cc2a5f42SMilanka Ringwald 
135cc2a5f42SMilanka Ringwald #endif
136