2021-10-26 16:24:54 +08:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2019-01-07 15:16:47 +08:00
|
|
|
|
|
|
|
/** @file
|
|
|
|
* @brief Bluetooth Mesh Model Common APIs.
|
|
|
|
*/
|
|
|
|
|
2020-01-19 18:57:13 +08:00
|
|
|
#ifndef _BLE_MESH_COMMON_H_
|
|
|
|
#define _BLE_MESH_COMMON_H_
|
2019-01-07 15:16:47 +08:00
|
|
|
|
2020-01-19 18:57:13 +08:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2020-07-02 10:53:07 +08:00
|
|
|
#include "esp_attr.h"
|
2020-01-19 18:57:13 +08:00
|
|
|
#include "esp_heap_caps.h"
|
2019-01-07 15:16:47 +08:00
|
|
|
|
2023-08-25 14:28:44 +08:00
|
|
|
#include "mesh/byteorder.h"
|
|
|
|
#include "mesh/ffs.h"
|
|
|
|
#include "mesh/trace.h"
|
|
|
|
#include "mesh/mutex.h"
|
|
|
|
#include "mesh/access.h"
|
2019-01-07 15:16:47 +08:00
|
|
|
|
2020-04-10 11:31:44 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-01-20 09:25:43 +07:00
|
|
|
void *bt_mesh_malloc(size_t size);
|
2020-07-02 10:53:07 +08:00
|
|
|
|
2022-01-20 09:25:43 +07:00
|
|
|
void *bt_mesh_calloc(size_t size);
|
2020-07-02 10:53:07 +08:00
|
|
|
|
2022-01-20 09:25:43 +07:00
|
|
|
void bt_mesh_free(void *ptr);
|
2020-01-19 18:57:13 +08:00
|
|
|
|
2019-01-07 15:16:47 +08: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 17:03:11 +08:00
|
|
|
struct net_buf_simple *bt_mesh_alloc_buf(uint16_t size);
|
2019-01-07 15:16:47 +08: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 17:59:31 +08:00
|
|
|
int bt_mesh_rand(void *buf, size_t len);
|
|
|
|
|
2023-12-06 11:06:38 +08:00
|
|
|
uint32_t bt_mesh_get_rand(void);
|
|
|
|
|
2020-04-10 11:31:44 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-11-10 18:40:01 +11:00
|
|
|
#endif /* _BLE_MESH_COMMON_H_ */
|