ble_mesh: stack: Move bt_mesh_rand to mesh_common.c

This commit is contained in:
lly
2020-12-07 17:59:31 +08:00
parent 19c3f38b36
commit fb531815b0
6 changed files with 19 additions and 38 deletions

View File

@@ -15,6 +15,8 @@
#include <string.h>
#include <errno.h>
#include "esp_system.h"
#include "mesh_main.h"
#include "client_common.h"
#include "mesh_common.h"
@@ -96,3 +98,17 @@ uint8_t bt_mesh_get_device_role(struct bt_mesh_model *model, bool srv_send)
return client->msg_role;
}
int bt_mesh_rand(void *buf, size_t len)
{
if (buf == NULL || len == 0) {
BT_ERR("%s, Invalid parameter", __func__);
return -EINVAL;
}
esp_fill_random(buf, len);
BT_DBG("Random %s", bt_hex(buf, len));
return 0;
}