feat: honk and flash

This commit is contained in:
gak 2023-08-30 16:19:19 +10:00
parent 8b96ecf3bc
commit 0057ae3be2
No known key found for this signature in database
2 changed files with 17 additions and 1 deletions

View file

@ -39,6 +39,12 @@ pub enum VehicleCommand {
/// Set scheduled departure. /// Set scheduled departure.
SetScheduledDeparture(SetScheduledDeparture), SetScheduledDeparture(SetScheduledDeparture),
/// Honk!
HonkHorn,
/// Flash the lights.
FlashLights,
} }
#[derive(Debug, Args)] #[derive(Debug, Args)]
@ -85,6 +91,12 @@ impl VehicleArgs {
VehicleCommand::SetScheduledDeparture(departure) => { VehicleCommand::SetScheduledDeparture(departure) => {
print_json(api.set_scheduled_departure(&self.id, &departure).await); 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(()) Ok(())
} }

View file

@ -10,6 +10,10 @@ impl Api {
get!(vehicles, Vec<Vehicle>, "/vehicles"); get!(vehicles, Vec<Vehicle>, "/vehicles");
get_arg!(vehicle_data, VehicleData, "/vehicles/{}/vehicle_data", VehicleId); 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 // Charging
post_arg_empty!(charge_port_door_open, "/vehicles/{}/command/charge_port_door_open", VehicleId); 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); post_arg_empty!(charge_port_door_close, "/vehicles/{}/command/charge_port_door_close", VehicleId);