Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linter errors #52

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions components/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ fms-proto = { path = "fms-proto" }
influx-client = { path = "influx-client", default-features = false }
influxrs = { version = "2.0" }
log = { version = "0.4" }
protobuf = { version = "3.3" }
protobuf-codegen = { version = "3.3" }
protobuf = { version = "3.5.1" }
protobuf-codegen = { version = "3.5.1" }
protoc-bin-vendored = { version = "3.0" }
# prost has no features
prost = { version = "0.12" }
Expand Down
6 changes: 2 additions & 4 deletions components/fms-forwarder/src/mqtt_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ pub fn add_command_line_args(command: Command) -> Command {
pub struct MqttConnection {
pub mqtt_client: AsyncClient,
pub uri: String,
pub client_id: String,
}

impl MqttConnection {
Expand Down Expand Up @@ -223,15 +222,15 @@ impl MqttConnection {
let mqtt_uri = args.get_one::<String>(PARAM_MQTT_URI).unwrap().to_owned();
let client_id = args
.get_one::<String>(PARAM_MQTT_CLIENT_ID)
.unwrap_or(&"".to_string())
.unwrap_or(&String::default())
.to_owned();
info!("connecting to MQTT endpoint at {}", mqtt_uri);
match CreateOptionsBuilder::new()
.server_uri(&mqtt_uri)
.max_buffered_messages(50)
.send_while_disconnected(true)
.delete_oldest_messages(true)
.client_id(&client_id)
.client_id(client_id)
.create_client()
{
Err(e) => {
Expand All @@ -247,7 +246,6 @@ impl MqttConnection {
Ok(MqttConnection {
mqtt_client: client,
uri: mqtt_uri,
client_id,
})
}
}
Expand Down
7 changes: 0 additions & 7 deletions components/fms-server/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub mod vehicle;

/// This description is placed here due to limitations of describing references in OpenAPI Property __driverId__: The driver id of driver. (independant whether it is driver or Co-driver) This is only set if the TriggerType = DRIVER_LOGIN, DRIVER_LOGOUT, DRIVER_1_WORKING_STATE_CHANGED or DRIVER_2_WORKING_STATE_CHANGED For DRIVER_LOGIN it is the id of the driver that logged in For DRIVER_LOGOUT it is the id of the driver that logged out For DRIVER_1_WORKING_STATE_CHANGED it is the id of driver 1 For DRIVER_2_WORKING_STATE_CHANGED it is the id of driver 2 Property __tellTaleInfo__: The tell tale(s) that triggered this message. This is only set if the TriggerType = TELL_TALE
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct TriggerObject {
/// Trigger types for Context=RFMS: TIMER - Data was sent due to a timer trigger. (Timer value set outside rFMS scope) IGNITION_ON - Data was sent due to an ignition on IGNITION_OFF - Data was sent due to an ignition off PTO_ENABLED - Data was sent due to that a PTO was enabled, will be sent for each PTO that gets enabled PTO_DISABLED - Data was sent due to that a PTO was disabled, will be sent for each PTO that gets disabled. DRIVER_LOGIN - Data was sent due to a successful driver login. DRIVER_LOGOUT - Data was sent due to a driver logout TELL_TALE - Data was sent due to that at least one tell tale changed state ENGINE_ON - Data was sent due to an engine on. For electric motor crank is on ENGINE_OFF - Data was sent due to an engine off. For electric motor crank is off DRIVER_1_WORKING_STATE_CHANGED - Data was sent due to that driver 1 changed working state DRIVER_2_WORKING_STATE_CHANGED - Data was sent due to that driver 2 changed working state DISTANCE_TRAVELLED - Data was sent due to that a set distance was travelled. (Distance set outside rFMS scope) FUEL_TYPE_CHANGE - Data was sent due to that the type of fuel currently being utilized by the vehicle changed PARKING_BRAKE_SWITCH_CHANGE - Data was sent due to that the parking brake state has changed BATTERY_PACK_CHARGING_STATUS_CHANGE - Data was sent due to a change in the battery pack charging status. BATTERY_PACK_CHARGING_CONNECTION_STATUS_CHANGE - Data was sent due to a change in the battery pack charging connection status. TRAILER_CONNECTED - One or several trailers were connected TRAILER_DISCONNECTED - One or several trailers were disconnected
#[serde(rename = "triggerType")]
Expand Down Expand Up @@ -79,7 +78,6 @@ impl TriggerObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct DriverIdObject {
#[serde(rename = "tachoDriverIdentification")]
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -91,7 +89,6 @@ pub struct DriverIdObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct TellTaleObject {
// Note: inline enums are not fully supported by openapi-generator
#[serde(rename = "tellTale")]
Expand All @@ -110,7 +107,6 @@ pub struct TellTaleObject {

/// Additional information can be provided if the trigger type is BATTERY_PACK_CHARGING_STATUS_CHANGE.
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct TriggerObjectChargingStatusInfo {
/// CHARGING_STARTED - Charging has started CHARGING_COMPLETED - Charging is completed CHARGING_INTERRUPTED - Charging has been interrupted (no error) ERROR - An error occurred when charging ESTIMATED_COMPLETION_TIME_CHANGED - The estimated time for completed charging has changed. (Threshold is outside scope of rFMS) TIMER - A predefined time has passed since last charge status update. (Frequency is outside the scope of rFMS) CHARGING_LEVEL - The charging level has reached a predefined level. (Charging levels are outside the scope of rFMS)
// Note: inline enums are not fully supported by openapi-generator
Expand All @@ -126,7 +122,6 @@ pub struct TriggerObjectChargingStatusInfo {

/// Additional information can be provided if the trigger type is BATTERY_PACK_CHARGING_CONNECTION_STATUS_CHANGE.
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct TriggerObjectChargingConnectionStatusInfo {
/// CONNECTING - Vehicle is being connected to a charger CONNECTED - Vehicle is connected to a charger DISCONNECTING - Vehicle is being disconnected from the charger DISCONNECTED - Vehicle is not connected to a charger ERROR - An error occurred
// Note: inline enums are not fully supported by openapi-generator
Expand All @@ -141,7 +136,6 @@ pub struct TriggerObjectChargingConnectionStatusInfo {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct DriverIdObjectTachoDriverIdentification {
/// The unique identification of a driver in a Member State. This fields is formatted according the definition for driverIdentification in COMMISSION REGULATION (EC) No 1360/2002 Annex 1b
#[serde(rename = "driverIdentification")]
Expand Down Expand Up @@ -169,7 +163,6 @@ pub struct DriverIdObjectTachoDriverIdentification {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct DriverIdObjectOemDriverIdentification {
/// Contains an optional id type (e.g. pin, USB, encrypted EU id...)
#[serde(rename = "idType")]
Expand Down
4 changes: 0 additions & 4 deletions components/fms-server/src/models/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use crate::models;
//use serde::Serialize;

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehiclePositionObject {
/// vehicle identification number. See ISO 3779 (17 characters)
#[serde(rename = "vin")]
Expand Down Expand Up @@ -56,7 +55,6 @@ pub struct VehiclePositionObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct GnssPositionObject {
/// Latitude (WGS84 based)
#[serde(rename = "latitude")]
Expand Down Expand Up @@ -87,7 +85,6 @@ pub struct GnssPositionObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehiclePositionResponseObject {
#[serde(rename = "vehiclePositionResponse")]
pub vehicle_position_response: VehiclePositionResponseObjectVehiclePositionResponse,
Expand All @@ -107,7 +104,6 @@ pub struct VehiclePositionResponseObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehiclePositionResponseObjectVehiclePositionResponse {
#[serde(rename = "vehiclePositions")]
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
17 changes: 0 additions & 17 deletions components/fms-server/src/models/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use crate::models;

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehicleStatusResponseObject {
#[serde(rename = "vehicleStatusResponse")]
pub vehicle_status_response: VehicleStatusResponseObjectVehicleStatusResponse,
Expand All @@ -40,15 +39,13 @@ pub struct VehicleStatusResponseObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehicleStatusResponseObjectVehicleStatusResponse {
#[serde(rename = "vehicleStatuses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vehicle_statuses: Option<Vec<VehicleStatusObject>>,
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehicleStatusObject {
/// vehicle identification number. See ISO 3779 (17 characters)
#[serde(rename = "vin")]
Expand Down Expand Up @@ -129,7 +126,6 @@ pub struct VehicleStatusObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehicleStatusObjectDoorStatusInner {
// Note: inline enums are not fully supported by openapi-generator
#[serde(rename = "DoorEnabledStatus")]
Expand All @@ -152,7 +148,6 @@ pub struct VehicleStatusObjectDoorStatusInner {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct AccumulatedDataObject {
/// The time the vehicle speed has been over zero.
#[serde(rename = "durationWheelbasedSpeedOverZero")]
Expand Down Expand Up @@ -341,7 +336,6 @@ pub struct AccumulatedDataObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct LabelObject {
#[serde(rename = "label")]
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -369,7 +363,6 @@ pub struct LabelObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct FromToClassObject {
#[serde(rename = "from")]
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -401,7 +394,6 @@ pub struct FromToClassObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct FromToClassObjectCombustion {
#[serde(rename = "from")]
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -429,7 +421,6 @@ pub struct FromToClassObjectCombustion {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct FromToClassObjectElectrical {
#[serde(rename = "from")]
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -453,7 +444,6 @@ pub struct FromToClassObjectElectrical {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct SnapshotDataObject {
#[serde(rename = "gnssPosition")]
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -577,7 +567,6 @@ pub struct SnapshotDataObject {
#[derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize,
)]
#[cfg_attr(feature = "conversion", derive(frunk_enum_derive::LabelledGenericEnum))]
pub enum DriverWorkingStateProperty {
#[serde(rename = "REST")]
Rest,
Expand All @@ -595,7 +584,6 @@ pub enum DriverWorkingStateProperty {

/// Estimated distance to empty (tanks and/or battery packs) in meters
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct SnapshotDataObjectEstimatedDistanceToEmpty {
/// Estimated distance to empty, summarizing fuel, gas and battery in meters
#[serde(rename = "total")]
Expand All @@ -619,7 +607,6 @@ pub struct SnapshotDataObjectEstimatedDistanceToEmpty {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct SnapshotDataObjectVehicleAxlesInner {
/// Axle position from 1 to 15, 1 being in the front of the truck
#[serde(rename = "vehicleAxlePosition")]
Expand All @@ -633,7 +620,6 @@ pub struct SnapshotDataObjectVehicleAxlesInner {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct SnapshotDataObjectTrailersInner {
/// Trailer number from 1 to 5, 1 being closest to the truck, according to ISO 11992-2.
#[serde(rename = "trailerNo")]
Expand Down Expand Up @@ -673,7 +659,6 @@ pub struct SnapshotDataObjectTrailersInner {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct SnapshotDataObjectTrailersInnerTrailerAxlesInner {
/// Axle position from 1 to 15, 1 being in the front closest to the truck, according to ISO 11992-2.
#[serde(rename = "trailerAxlePosition")]
Expand All @@ -687,7 +672,6 @@ pub struct SnapshotDataObjectTrailersInnerTrailerAxlesInner {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct UptimeDataObject {
/// List of tell tales with the actual status for each tell tale.
#[serde(rename = "tellTaleInfo")]
Expand Down Expand Up @@ -755,7 +739,6 @@ pub struct UptimeDataObject {

/// The alternator status of the up to 4 alternators. Used mainly for buses.
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct UptimeDataObjectAlternatorInfo {
// Note: inline enums are not fully supported by openapi-generator
#[serde(rename = "alternatorStatus")]
Expand Down
5 changes: 0 additions & 5 deletions components/fms-server/src/models/vehicle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub enum VehiclesGetResponse {

/// Optional responses for error codes, detailing the error if needed
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct ErrorObject {
/// An identifier for this error
#[serde(rename = "error")]
Expand All @@ -60,7 +59,6 @@ pub struct ErrorObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehicleResponseObject {
#[serde(rename = "vehicleResponse")]
pub vehicle_response: VehicleResponseObjectVehicleResponse,
Expand All @@ -76,15 +74,13 @@ pub struct VehicleResponseObject {
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehicleResponseObjectVehicleResponse {
#[serde(rename = "vehicles")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vehicles: Option<Vec<VehicleObject>>,
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehicleObject {
/// vehicle identification number. See ISO 3779 (17 characters)
#[serde(rename = "vin")]
Expand Down Expand Up @@ -187,7 +183,6 @@ pub struct VehicleObject {

/// Indicates when the vehicle was produced.
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct VehicleObjectProductionDate {
/// Day of the month where first day of the month is 1
#[serde(rename = "day")]
Expand Down