// // Created by misaki on 2025/9/2. // #pragma once #include #include /** * 本模块提供各种杂项工具类,基本都来源于对底层驱动的封装 * * */ class ToolsClass { public: static ToolsClass* getInstance(); private: ToolsClass(); ~ToolsClass() = default; private: static ToolsClass* instance; static std::mutex instance_mutex; public: /** * 获取当前时间 * @return 当前时间 */ static std::string getCurrentTime(); /** * 获取esp32s3的芯片序列号 * @return 芯片序列号 */ static std::string getChipSerialNumber(); /** * 获取esp32s3的MAC地址 * @return MAC地址 */ static std::string getChipMAC(); /** * 生成SN码 * @param mac mac地址 * @param chipID 芯片ID * @return 生成的SN码 */ static std::string GenerateSN(const std::string& mac, const std::string& chipID); /** * 获取电池电压 * @return 电池电压 */ float getBatteryVolts(); /** * 获取电池电量 * @return 电池电量百分比(0 ~ 100) */ int32_t getBatteryPer(); /** * 拼接文件路径(for sd card) * @param filename 文件名 * @return 拼接后的文件路径 */ static std::string makeFullPath(const std::string& filename); /** * 获取设备版本 * @return 设备版本 */ static std::string getDeviceVersion(); static std::string device_version; // 设备版本 };