mesh: add mesh_node to collect node state

This commit is contained in:
Matthias Ringwald 2019-07-11 15:20:50 +02:00
parent a0f170a870
commit 0e329b411b
4 changed files with 118 additions and 1 deletions

View File

@ -19,6 +19,7 @@ CORE += \
hci_transport_h4.c \
btstack_tlv_posix.c \
mesh_iv_index_seq_number.c \
mesh_node.c \
le_device_db_fs.c \
l2cap.c \
uECC.c \

View File

@ -49,6 +49,7 @@
#include "btstack_tlv.h"
#include "mesh_iv_index_seq_number.h"
#include "mesh_proxy.h"
#include "mesh_node.h"
#define MEST_TRANSACTION_TIMEOUT_MS 6000
@ -1755,12 +1756,15 @@ static void mesh_access_secure_network_beacon_handler(uint8_t packet_type, uint1
}
void mesh_access_setup_from_provisioning_data(const mesh_provisioning_data_t * provisioning_data){
// set unicast address
// set unicast address - old
mesh_network_set_primary_element_address(provisioning_data->unicast_address);
mesh_lower_transport_set_primary_element_address(provisioning_data->unicast_address);
mesh_upper_transport_set_primary_element_address(provisioning_data->unicast_address);
mesh_access_set_primary_element_address(provisioning_data->unicast_address);
primary_element_address = provisioning_data->unicast_address;
// set unicast address - new
mesh_node_primary_element_address_set(provisioning_data->unicast_address);
// set device_key
mesh_transport_set_device_key(provisioning_data->device_key);

50
test/mesh/mesh_node.c Normal file
View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2019 BlueKitchen GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 4. Any redistribution, use, or modification is done solely for
* personal benefit and not for any commercial purpose or for
* monetary gain.
*
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Please inquire about commercial licensing options at
* contact@bluekitchen-gmbh.com
*
*/
#define __BTSTACK_FILE__ "mesh_node.c"
#include "mesh_node.h"
static uint16_t primary_element_address;
void mesh_node_primary_element_address_set(uint16_t unicast_address){
primary_element_address = unicast_address;
}
uint16_t mesh_node_primary_element_address_get(void){
return primary_element_address;
}

62
test/mesh/mesh_node.h Normal file
View File

@ -0,0 +1,62 @@
/*
* Copyright (C) 2019 BlueKitchen GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 4. Any redistribution, use, or modification is done solely for
* personal benefit and not for any commercial purpose or for
* monetary gain.
*
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Please inquire about commercial licensing options at
* contact@bluekitchen-gmbh.com
*
*/
#ifndef __MESH_NODE_H
#define __MESH_NODE_H
#if defined __cplusplus
extern "C" {
#endif
#include <stdint.h>
/**
* @brief Set unicast address of primary element
* @param unicast_address
*/
void mesh_node_primary_element_address_set(uint16_t unicast_address);
/**
* @brief Get unicast address of primary element
*/
uint16_t mesh_node_primary_element_address_get(void);
#if defined __cplusplus
}
#endif
#endif //__MESH_NODE_H