2021-10-26 04:24:54 -04:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2019-01-07 02:16:47 -05:00
|
|
|
|
|
|
|
/** @file
|
|
|
|
* @brief Bluetooth Mesh Model Common APIs.
|
|
|
|
*/
|
|
|
|
|
2020-01-19 05:57:13 -05:00
|
|
|
#ifndef _BLE_MESH_COMMON_H_
|
|
|
|
#define _BLE_MESH_COMMON_H_
|
2019-01-07 02:16:47 -05:00
|
|
|
|
2020-01-19 05:57:13 -05:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2020-07-01 22:53:07 -04:00
|
|
|
#include "esp_attr.h"
|
2020-01-19 05:57:13 -05:00
|
|
|
#include "esp_heap_caps.h"
|
2019-01-07 02:16:47 -05:00
|
|
|
|
2023-08-25 02:28:44 -04:00
|
|
|
#include "mesh/byteorder.h"
|
|
|
|
#include "mesh/ffs.h"
|
|
|
|
#include "mesh/trace.h"
|
|
|
|
#include "mesh/mutex.h"
|
|
|
|
#include "mesh/access.h"
|
2019-01-07 02:16:47 -05:00
|
|
|
|
2020-04-09 23:31:44 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-01-19 21:25:43 -05:00
|
|
|
void *bt_mesh_malloc(size_t size);
|
2020-07-01 22:53:07 -04:00
|
|
|
|
2022-01-19 21:25:43 -05:00
|
|
|
void *bt_mesh_calloc(size_t size);
|
2020-07-01 22:53:07 -04:00
|
|
|
|
2022-01-19 21:25:43 -05:00
|
|
|
void bt_mesh_free(void *ptr);
|
2020-01-19 05:57:13 -05:00
|
|
|
|
2019-01-07 02:16:47 -05:00
|
|
|
/**
|
|
|
|
* @brief This function allocates memory to store outgoing message.
|
|
|
|
*
|
|
|
|
* @param[in] size: Length of memory allocated to store message value
|
|
|
|
*
|
|
|
|
* @return NULL-fail, pointer of a net_buf_simple structure-success
|
|
|
|
*/
|
2020-12-07 04:03:11 -05:00
|
|
|
struct net_buf_simple *bt_mesh_alloc_buf(uint16_t size);
|
2019-01-07 02:16:47 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This function releases the memory allocated for the outgoing message.
|
|
|
|
*
|
|
|
|
* @param[in] buf: Pointer to the net_buf_simple structure to be freed
|
|
|
|
*
|
|
|
|
* @return none
|
|
|
|
*/
|
|
|
|
void bt_mesh_free_buf(struct net_buf_simple *buf);
|
|
|
|
|
2020-12-07 04:59:31 -05:00
|
|
|
int bt_mesh_rand(void *buf, size_t len);
|
|
|
|
|
2023-11-09 21:54:17 -05:00
|
|
|
uint32_t bt_mesh_get_rand(void);
|
|
|
|
|
2020-04-09 23:31:44 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-11-10 02:40:01 -05:00
|
|
|
#endif /* _BLE_MESH_COMMON_H_ */
|