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:
59
firmware/esp32_ble_sim/include/ble_services.h
Normal file
59
firmware/esp32_ble_sim/include/ble_services.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef BLE_SERVICES_H
|
||||
#define BLE_SERVICES_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// ============================================
|
||||
// BLE Service UUIDs (Bluetooth SIG standard)
|
||||
// ============================================
|
||||
|
||||
// Heart Rate Service
|
||||
#define HEART_RATE_SERVICE_UUID "180D"
|
||||
#define HEART_RATE_MEASUREMENT_UUID "2A37"
|
||||
#define BODY_SENSOR_LOCATION_UUID "2A38"
|
||||
|
||||
// Fitness Machine Service
|
||||
#define FITNESS_MACHINE_SERVICE_UUID "1826"
|
||||
#define TREADMILL_DATA_UUID "2ACD"
|
||||
#define FITNESS_MACHINE_FEATURE_UUID "2ACC"
|
||||
|
||||
// ============================================
|
||||
// Function Prototypes
|
||||
// ============================================
|
||||
|
||||
/**
|
||||
* Initialize NimBLE stack (call once at startup)
|
||||
*/
|
||||
void initBLE();
|
||||
|
||||
/**
|
||||
* Stop BLE advertising and deinit
|
||||
*/
|
||||
void stopBLE();
|
||||
|
||||
/**
|
||||
* Setup BLE as Heart Rate Monitor
|
||||
* Creates Heart Rate Service with measurement characteristic
|
||||
*/
|
||||
void setupBLE_HeartRate();
|
||||
|
||||
/**
|
||||
* Setup BLE as Treadmill (Fitness Machine)
|
||||
* Creates Fitness Machine Service with treadmill data
|
||||
*/
|
||||
void setupBLE_Treadmill();
|
||||
|
||||
/**
|
||||
* Send heart rate notification
|
||||
* @param bpm Heart rate in beats per minute
|
||||
*/
|
||||
void notifyHeartRate(uint8_t bpm);
|
||||
|
||||
/**
|
||||
* Send treadmill data notification
|
||||
* @param speed Speed in 0.01 km/h units
|
||||
* @param incline Incline in 0.1% units
|
||||
*/
|
||||
void notifyTreadmill(uint16_t speed, int16_t incline);
|
||||
|
||||
#endif // BLE_SERVICES_H
|
||||
Reference in New Issue
Block a user