Crate dji_log_parser

source ·
Expand description

§DJILog Parser Module

This module provides functionality for parsing DJI log files.

§Encryption in Version 13 and Later

Starting with version 13, log records are AES encrypted and require a specific keychain for decryption. This keychain must be obtained from DJI using their API. An apiKey is necessary to access the DJI API.

§Obtaining an ApiKey

To acquire an apiKey, follow these steps:

  1. Visit DJI Developer Technologies and log in.
  2. Click CREATE APP, choose Open API as the App Type, and provide the necessary details like App Name, Category, and Description.
  3. After creating the app, activate it through the link sent to your email.
  4. On your developer user page, find your app’s details to retrieve the ApiKey (labeled as the SDK key).

§Usage

§Initialization

Initialize a DJILog instance from a byte slice to access version information and metadata:

let parser = DJILog::from_bytes(&bytes).unwrap();
println!("Version: {:?}", parser.version);
println!("Info: {:?}", parser.info);

§Accessing Records

Decrypt records based on the log file version.

For versions prior to 13:

let records = parser.records(DecryptMethod::None);

For version 13 and later:

let records = parser.records(DecryptMethod::ApiKey("__DJI_API_KEY__"));

§Advanced: Manual Keychain Retrieval

For scenarios like caching, offline use, or custom server communication, the library exposes the internal keychain retrieval process:

let keychain_request = parser.keychain_request().unwrap();
let keychains = keychain_request.fetch("__DJI_API_KEY__").unwrap();
let records = parser.records(DecryptMethod::Keychains(keychains));

Note: Replace __DJI_API_KEY__ with your actual apiKey.

§Binary structure of log files:

v1 -> v6

┌─────────────────┐
│     Prefix      │ detail_offset ─┐
├─────────────────┤                │
│     Records     │                │
├─────────────────┤<───────────────┘
│      Info       │ detail_length
└─────────────────┘

v7 -> v11

┌─────────────────┐
│     Prefix      │ detail_offset ─┐
├─────────────────┤                │
│     Records     │                │
│   (Encrypted)   │                |
├─────────────────┤<───────────────┘
│      Info       │ detail_length
└─────────────────┘

v12

┌─────────────────┐
│     Prefix      │ detail_offset ─┐
├─────────────────┤                │
│      Info       │ detail_length  │
├─────────────────┤                │
│     Records     │                │
│   (Encrypted)   │                │
└─────────────────┘<───────────────┘

v13 -> v14

┌─────────────────┐
│     Prefix      │ detail_offset ─┐
├─────────────────┤                │
│ Auxiliary Info  |  detail_length |
│   (Encrypted)   |                |
├─────────────────┤                │
│    Auxiliary    |                |
│     Version     |                │
├─────────────────┤<───────────────┘
│     Records     │
│(Encrypted + AES)|
└─────────────────┘

Re-exports§

  • pub use layout::info::Info;

Modules§

Structs§

Enums§