| Crates.io | kondis |
| lib.rs | kondis |
| version | 0.3.2 |
| created_at | 2025-08-29 11:53:58.230733+00 |
| updated_at | 2025-08-29 17:31:26.154602+00 |
| description | a simple library to communicate with exercise equipment |
| homepage | |
| repository | https://github.com/chinatsu/kondis |
| max_upload_size | |
| id | 1815751 |
| size | 57,401 |
kondis [n, slang] physical condition
a simple library to communicate with exercise equipment
cargo add kondis
also, needs tokio and wants anyhow.
use kondis::equipment_type_to_equipment;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let (shutdown_tx, mut shutdown_rx) = channel();
tokio::spawn(async move {
tokio::signal::ctrl_c().await.unwrap();
shutdown_tx.send(()).unwrap();
});
let mut equipment = equipment_type_to_equipment(
EquipmentType::NonBluetoothDevice,
32,
&mut shutdown_rx,
)
.await
.unwrap();
if !equipment.connect().await? {
return Ok(());
}
loop {
if let Some(data) = equipment.read().await? {
let state = format!(
"{:03} rpm :: {:03} W :: {:.2} km/h",
data.cadence, data.power, data.speed
);
println!("{state}");
}
}
equipment.disconnect().await?;
}