pub struct DJILog {
    pub version: u8,
    pub details: Details,
    /* private fields */
}Fields§
§version: u8Log format version
details: DetailsLog Details. Contains record summary and general informations
Implementations§
Source§impl DJILog
 
impl DJILog
Sourcepub fn from_bytes(bytes: Vec<u8>) -> Result<DJILog>
 
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();Sourcepub fn keychains_request(&self) -> Result<KeychainsRequest>
 
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.
Sourcepub fn keychains_request_with_custom_params(
    &self,
    department: Option<Department>,
    version: Option<u16>,
) -> Result<KeychainsRequest>
 
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- Departmentto 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.
Sourcepub fn fetch_keychains(
    &self,
    api_key: &str,
) -> Result<Vec<Vec<KeychainFeaturePoint>>>
 
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.
Sourcepub fn records(
    &self,
    keychains: Option<Vec<Vec<KeychainFeaturePoint>>>,
) -> Result<Vec<Record>>
 
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- KeychainFeaturePointinstances. This parameter is used for decryption when working with encrypted logs (versions >= 13). If- Noneis 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.
Sourcepub fn frames(
    &self,
    keychains: Option<Vec<Vec<KeychainFeaturePoint>>>,
) -> Result<Vec<Frame>>
 
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- KeychainFeaturePointinstances. This parameter is used for decryption when working with encrypted logs (versions >= 13). If- Noneis 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.