feat: honk and flash
This commit is contained in:
parent
8b96ecf3bc
commit
0057ae3be2
|
@ -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(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,11 @@ use serde::{Deserialize, Serialize};
|
||||||
impl Api {
|
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);
|
||||||
|
|
Loading…
Reference in a new issue