2025-10-20 12:00:32 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include "os/os.h"
|
|
|
|
|
#include "sys_log.h"
|
2025-10-23 18:39:07 +08:00
|
|
|
#include "mbedtls/aes.h"
|
|
|
|
|
#include <esp_err.h>
|
|
|
|
|
#include "esp_system.h"
|
|
|
|
|
#include "esp_mac.h"
|
|
|
|
|
#include "../data_port/ble_spp/ble_spp_server.h"
|
|
|
|
|
|
|
|
|
|
#define PRIVATE_KEY "1234567890abcdef"
|
2025-10-20 12:00:32 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 超时判断
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
int time_out(uint32_t* time_start, uint32_t timeout_ms);
|
|
|
|
|
/**
|
|
|
|
|
* @brief 打印时间间隔
|
|
|
|
|
*/
|
|
|
|
|
void printf_chill_time(uint8_t chill_time, uint16_t type);
|
|
|
|
|
/**
|
|
|
|
|
* @brief 字符串转十进制
|
|
|
|
|
*/
|
2025-10-23 18:39:07 +08:00
|
|
|
uint32_t parse_hex_or_dec(const char *s);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief AEStest
|
|
|
|
|
*/
|
|
|
|
|
void aes_test(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief AES加密
|
|
|
|
|
*/
|
|
|
|
|
void sertrf_aes_ctr_encrypt(uint8_t *data, uint32_t len,uint8_t* output);
|
|
|
|
|
/**
|
|
|
|
|
* @brief AES解密
|
|
|
|
|
*/
|
|
|
|
|
void sertrf_aes_ctr_decrypt(uint8_t *data, uint32_t len,uint8_t* output);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @breif 获取ESP MAC地址
|
|
|
|
|
*/
|
|
|
|
|
esp_err_t esp_efuse_mac_get_default_id(uint8_t *mac);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取BLE MAC地址
|
|
|
|
|
*/
|
|
|
|
|
esp_err_t esp_efuse_ble_mac_get_default(uint8_t *mac);
|