mirror of
https://github.com/mattintech/pyBTMCP.git
synced 2026-07-11 13:11:53 +00:00
Initial release v1.0.0 - BLE Device Simulator with MCP Integration
Features: - MCP server with tools for AI-controlled device simulation - FastAPI backend with REST API and WebSocket support - Real-time device updates via WebSocket - Web UI for manual device control - ESP32 firmware for BLE device simulation - Docker containerization with MQTT broker Supported device types: - Heart Rate Monitor (BLE Heart Rate Service) - Treadmill (BLE Fitness Machine Service) - Bike Trainer (BLE Cycling Power Service) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
64
firmware/esp32_ble_sim/include/config_manager.h
Normal file
64
firmware/esp32_ble_sim/include/config_manager.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#ifndef CONFIG_MANAGER_H
|
||||
#define CONFIG_MANAGER_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Preferences.h>
|
||||
|
||||
// ============================================
|
||||
// Configuration Structure
|
||||
// ============================================
|
||||
struct DeviceConfig {
|
||||
bool configured = false;
|
||||
String wifiSsid = "";
|
||||
String wifiPassword = "";
|
||||
String mqttHost = "";
|
||||
uint16_t mqttPort = 1883;
|
||||
String deviceId = "";
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// Configuration Manager Class
|
||||
// ============================================
|
||||
class ConfigManager {
|
||||
public:
|
||||
ConfigManager();
|
||||
|
||||
// Load config from NVS
|
||||
bool load();
|
||||
|
||||
// Save config to NVS
|
||||
void save();
|
||||
|
||||
// Clear all config
|
||||
void clear();
|
||||
|
||||
// Check if configured
|
||||
bool isConfigured() const { return config.configured; }
|
||||
|
||||
// Getters
|
||||
const String& getWifiSsid() const { return config.wifiSsid; }
|
||||
const String& getWifiPassword() const { return config.wifiPassword; }
|
||||
const String& getMqttHost() const { return config.mqttHost; }
|
||||
uint16_t getMqttPort() const { return config.mqttPort; }
|
||||
const String& getDeviceId() const { return config.deviceId; }
|
||||
|
||||
// Setters
|
||||
void setWifiCredentials(const String& ssid, const String& password);
|
||||
void setMqttConfig(const String& host, uint16_t port);
|
||||
void setDeviceId(const String& id);
|
||||
|
||||
// Get unique AP name based on chip ID
|
||||
String getAPName() const;
|
||||
|
||||
// Get unique default device ID based on chip ID
|
||||
String getDefaultDeviceId() const;
|
||||
|
||||
private:
|
||||
DeviceConfig config;
|
||||
Preferences preferences;
|
||||
};
|
||||
|
||||
// Global instance
|
||||
extern ConfigManager configManager;
|
||||
|
||||
#endif // CONFIG_MANAGER_H
|
||||
Reference in New Issue
Block a user