From 0057ae3be20db59087dd6ec7294bbccc9444923c Mon Sep 17 00:00:00 2001 From: gak Date: Wed, 30 Aug 2023 16:19:19 +1000 Subject: [PATCH] feat: honk and flash --- src/cli/vehicle.rs | 12 ++++++++++++ src/vehicles.rs | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/cli/vehicle.rs b/src/cli/vehicle.rs index ec4023e..f28c166 100644 --- a/src/cli/vehicle.rs +++ b/src/cli/vehicle.rs @@ -39,6 +39,12 @@ pub enum VehicleCommand { /// Set scheduled departure. SetScheduledDeparture(SetScheduledDeparture), + + /// Honk! + HonkHorn, + + /// Flash the lights. + FlashLights, } #[derive(Debug, Args)] @@ -85,6 +91,12 @@ impl VehicleArgs { VehicleCommand::SetScheduledDeparture(departure) => { print_json(api.set_scheduled_departure(&self.id, &departure).await); } + VehicleCommand::HonkHorn => { + print_json(api.honk_horn(&self.id).await); + } + VehicleCommand::FlashLights => { + print_json(api.flash_lights(&self.id).await); + } } Ok(()) } diff --git a/src/vehicles.rs b/src/vehicles.rs index e7eb16f..630cf73 100644 --- a/src/vehicles.rs +++ b/src/vehicles.rs @@ -9,7 +9,11 @@ use serde::{Deserialize, Serialize}; impl Api { get!(vehicles, Vec, "/vehicles"); get_arg!(vehicle_data, VehicleData, "/vehicles/{}/vehicle_data", VehicleId); - + + // Alerts + post_arg_empty!(honk_horn, "/vehicles/{}/command/honk_horn", VehicleId); + post_arg_empty!(flash_lights, "/vehicles/{}/command/flash_lights", VehicleId); + // Charging post_arg_empty!(charge_port_door_open, "/vehicles/{}/command/charge_port_door_open", VehicleId); post_arg_empty!(charge_port_door_close, "/vehicles/{}/command/charge_port_door_close", VehicleId);