Expand description
§Treadlers 🏃♂️
A Rust library for controlling Treadly treadmills via Bluetooth Low Energy.
This library provides a complete, safe, and easy-to-use interface for controlling Treadly treadmills through Bluetooth Low Energy. The entire communication protocol was reverse-engineered from the official Treadly Android application (version 1.1.8) after the company shut down their backend services, leaving the treadmills as “dead bricks”.
§Reverse Engineering Details
The protocol implementation in this library is based on detailed analysis of the decompiled Android application, including:
- BLE Service Discovery: Nordic UART Service (NUS) based communication
- Message Protocol: 20-byte fixed message format with command/response structure
- Authentication: Secret key extraction and authentication flow analysis
- Command Mapping: Complete mapping of all 70+ available treadmill commands
- Status Parsing: Detailed status message structure and bit field layouts
- Safety Systems: Emergency stop mechanisms and handrail safety features
See protocol.md for comprehensive documentation of the reverse-engineered protocol.
§Safety Warning
⚠️ Important: This library controls physical exercise equipment. Always ensure:
- Emergency stop functionality is properly implemented
- Physical safety measures are in place
- Users understand how to safely operate the equipment
- Proper error handling is implemented in your application
§Quick Start
use treadlers::{TreadlyDevice, SpeedUnit};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Discover and connect to a Treadly device
let mut treadmill = TreadlyDevice::connect_first().await?;
// Power on the treadmill
treadmill.power_on().await?;
// Set speed to 5 km/h
treadmill.set_speed(5.0, SpeedUnit::Kilometers).await?;
// Emergency stop if needed
treadmill.emergency_stop().await?;
Ok(())
}Re-exports§
pub use device::TreadlyDevice;pub use error::Result;pub use error::TreadlyError;pub use types::AuthenticationStatus;pub use types::ConnectionHealth;pub use types::ConnectionParams;pub use types::DeviceInfo;pub use types::DeviceMode;pub use types::DeviceStatus;pub use types::DeviceStatusCode;pub use types::EmergencyStopState;pub use types::SpeedInfo;pub use types::SpeedUnit;pub use types::TemperatureStatus;pub use types::TimeoutConfig;
Modules§
- ble
- Bluetooth Low Energy communication module
- device
- Main device control interface
- error
- Error types and handling
- protocol
- Protocol message structures and parsing
- types
- Type definitions and data structures
Constants§
- TREADLY_
MANUFACTURER_ ID - Treadly manufacturer ID for device discovery during BLE scanning
- TREADLY_
RX_ CHAR_ UUID - Treadly RX Characteristic UUID for app-to-device commands
- TREADLY_
SERVICE_ UUID - Treadly BLE Service UUID discovered through reverse engineering
- TREADLY_
TX_ CHAR_ UUID - Treadly TX Characteristic UUID for device-to-app notifications
- VERSION
- Library version