treadlers

Crates.iotreadlers
lib.rstreadlers
version0.1.0
created_at2025-07-16 16:25:24.066224+00
updated_at2025-07-16 16:25:24.066224+00
descriptionA Rust library for controlling Treadly treadmills via Bluetooth Low Energy
homepage
repositoryhttps://github.com/binflip/treadlers
max_upload_size
id1755782
size213,547
(BinFlip)

documentation

README

Treadlers ๐Ÿƒโ€โ™‚๏ธ

A Rust library for controlling Treadly treadmills via Bluetooth Low Energy.

Overview

Treadlers provides a complete, safe, and easy-to-use interface for controlling Treadly treadmills through Bluetooth Low Energy.

Why this library exists: Treadly shut down as a company, leaving their treadmills as "dead bricks" when their backend services went offline. This library was created by reverse-engineering the official Treadly Android application (version 1.1.8) to restore functionality and enable custom control applications and integrations.

The entire communication protocol was analyzed and documented, including BLE service discovery, message formats, authentication flows, and safety systems.

Features

  • ๐Ÿ”— Full BLE Protocol Support - Complete implementation of Treadly's communication protocol
  • โšก Async/Await - Built on Tokio for efficient async operations
  • ๐Ÿ›ก๏ธ Safety First - Emergency stop functionality and comprehensive error handling
  • ๐ŸŽฏ Type Safe - Strongly typed API preventing invalid operations
  • ๐Ÿ“Š Status Monitoring - Real-time device status and telemetry
  • ๐Ÿ” Authentication - Support for device authentication when required
  • ๐Ÿงช Well Tested - Comprehensive test suite

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?;
    
    // Monitor status
    let status = treadmill.get_status().await?;
    println!("Current speed: {:.1} km/h", status.speed.current);
    
    // Emergency stop if needed
    treadmill.emergency_stop().await?;
    
    Ok(())
}

Installation

Add this to your Cargo.toml:

[dependencies]
treadlers = "0.1"
tokio = { version = "1.0", features = ["full"] }

Documentation

Safety Warning

โš ๏ธ Important Safety Notice: 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

Platform Support

  • Linux โœ… Full support via BlueZ
  • macOS โœ… Full support via Core Bluetooth
  • Windows โœ… Full support via WinRT Bluetooth LE APIs

Examples

See the examples directory for complete working examples:

  • basic_control.rs - Basic treadmill control
  • status_monitor.rs - Real-time status monitoring
  • emergency_stop.rs - Emergency stop handling

Development

# Clone the repository
git clone https://github.com/yourusername/treadlers
cd treadlers

# Run tests
cargo test

# Run examples
cargo run --example basic_control

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

Licensed under the Apache License, Version 2.0 (LICENSE).

Disclaimer

This library is not affiliated with or endorsed by Treadly. Use at your own risk. The protocol was reverse-engineered for educational and personal use purposes after the company ceased operations, leaving devices non-functional without their backend services.

Commit count: 0

cargo fmt