dji_log_parser/frame/
details.rs

1use serde::Serialize;
2#[cfg(target_arch = "wasm32")]
3use tsify_next::Tsify;
4
5use crate::layout::details::Details;
6use crate::layout::details::Platform;
7
8#[derive(Serialize, Debug, Clone)]
9#[serde(rename_all = "camelCase")]
10#[cfg_attr(target_arch = "wasm32", derive(Tsify))]
11pub struct FrameDetails {
12    /// Total flight time in seconds
13    pub total_time: f32,
14    /// Total distance flown in meters
15    pub total_distance: f32,
16    /// Maximum height reached during the flight in meters
17    pub max_height: f32,
18    /// Maximum horizontal speed reached during the flight in meters per second
19    pub max_horizontal_speed: f32,
20    /// Maximum vertical speed reached during the flight in meters per second
21    pub max_vertical_speed: f32,
22    /// Number of photos taken during the flight
23    pub photo_num: i32,
24    /// Total video recording time in seconds
25    pub video_time: i64,
26    /// Name of the aircraft
27    pub aircraft_name: String,
28    /// Serial number of the aircraft
29    pub aircraft_sn: String,
30    /// Serial number of the camera
31    pub camera_sn: String,
32    /// Serial number of the remote control
33    pub rc_sn: String,
34    /// The platform of the app used (e.g., iOS, Android)
35    pub app_platform: Platform,
36    /// Version of the app used
37    pub app_version: String,
38}
39
40impl From<Details> for FrameDetails {
41    fn from(value: Details) -> Self {
42        FrameDetails {
43            total_time: value.total_time as f32,
44            total_distance: value.total_distance,
45            max_height: value.max_height,
46            max_horizontal_speed: value.max_horizontal_speed,
47            max_vertical_speed: value.max_vertical_speed,
48            photo_num: value.capture_num,
49            video_time: value.video_time,
50            aircraft_name: value.aircraft_name.clone(),
51            aircraft_sn: value.aircraft_sn.clone(),
52            camera_sn: value.camera_sn.clone(),
53            rc_sn: value.rc_sn.clone(),
54            app_platform: value.app_platform.clone(),
55            app_version: value.app_version.clone(),
56        }
57    }
58}