DJILog

Struct DJILog 

Source
pub struct DJILog {
    pub version: u8,
    pub details: Details,
    /* private fields */
}

Fields§

§version: u8

Log format version

§details: Details

Log Details. Contains record summary and general informations

Implementations§

Source§

impl DJILog

Source

pub fn from_bytes(bytes: Vec<u8>) -> Result<DJILog>

Constructs a DJILog from an array of bytes.

This function parses the Prefix and Info blocks of the log file, and handles different versions of the log format.

§Arguments
  • bytes - An array of bytes representing the DJI log file.
§Returns

This function returns Result<DJILog>. On success, it returns the DJILog instance.

§Examples
use djilog_parser::DJILog;

let log_bytes = include_bytes!("path/to/log/file");
let log = DJILog::from_bytes(log_bytes).unwrap();
Source

pub fn keychains_request(&self) -> Result<KeychainsRequest>

Creates a KeychainsRequest object by parsing KeyStorage records.

This function is used to build a request body for manually retrieving the keychain from the DJI API. Keychains are required to decode records for logs with a version greater than or equal to 13. For earlier versions, this function returns a default KeychainsRequest.

§Returns

Returns a Result<KeychainsRequest>. On success, it provides a KeychainsRequest instance, which contains the necessary information to fetch keychains from the DJI API.

Source

pub fn keychains_request_with_custom_params( &self, department: Option<Department>, version: Option<u16>, ) -> Result<KeychainsRequest>

Creates a KeychainsRequest object by parsing KeyStorage records with manually specified params.

This function is used to build a request body for manually retrieving the keychain from the DJI API. Keychains are required to decode records for logs with a version greater than or equal to 13. For earlier versions, this function returns a default KeychainsRequest.

§Arguments
  • department - An optional Department to manually set in the request. If None, the department will be determined from the log file.
  • version - An optional version number to manually set in the request. If None, the version will be determined from the log file.
§Returns

Returns a Result<KeychainsRequest>. On success, it provides a KeychainsRequest instance, which contains the necessary information to fetch keychains from the DJI API.

Source

pub fn fetch_keychains( &self, api_key: &str, ) -> Result<Vec<Vec<KeychainFeaturePoint>>>

Fetches keychains using the provided API key.

This function first creates a KeychainRequest using the keychain_request() method, then uses that request to fetch the actual keychains from the DJI API. Keychains are required to decode records for logs with a version greater than or equal to 13.

§Arguments
  • api_key - A string slice that holds the API key for authentication with the DJI API.
§Returns

Returns a Result<Vec<Vec<KeychainFeaturePoint>>>. On success, it provides a vector of vectors, where each inner vector represents a keychain.

Source

pub fn records( &self, keychains: Option<Vec<Vec<KeychainFeaturePoint>>>, ) -> Result<Vec<Record>>

Retrieves the parsed raw records from the DJI log.

This function decodes the raw records from the log file

§Arguments
  • keychains - An optional vector of vectors containing KeychainFeaturePoint instances. This parameter is used for decryption when working with encrypted logs (versions >= 13). If None is provided, the function will attempt to process the log without decryption.
§Returns

Returns a Result<Vec<Record>>. On success, it provides a vector of Record instances representing the parsed log records.

Source

pub fn frames( &self, keychains: Option<Vec<Vec<KeychainFeaturePoint>>>, ) -> Result<Vec<Frame>>

Retrieves the normalized frames from the DJI log.

This function processes the raw records from the log file and converts them into standardized frames. Frames are a more user-friendly representation of the log data, normalized across all log versions for easier use and analysis.

The function first decodes the raw records based on the specified decryption method, then converts these records into frames. This normalization process makes it easier to work with log data from different DJI log versions.

§Arguments
  • keychains - An optional vector of vectors containing KeychainFeaturePoint instances. This parameter is used for decryption when working with encrypted logs (versions >= 13). If None is provided, the function will attempt to process the log without decryption.
§Returns

Returns a Result<Vec<Frame>>. On success, it provides a vector of Frame instances representing the normalized log data.

§Note

This method consumes and processes the raw records to create frames. It’s generally preferred over using raw records directly, as frames provide a consistent format across different log versions, simplifying data analysis and interpretation.

Trait Implementations§

Source§

impl Debug for DJILog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for DJILog

§

impl RefUnwindSafe for DJILog

§

impl Send for DJILog

§

impl Sync for DJILog

§

impl Unpin for DJILog

§

impl UnwindSafe for DJILog

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,