Class CrashDump

Inheritance Relationships

Derived Types

Class Documentation

class CrashDump

Base class for platform-specific crash dumps.

Crash dumps are serialized as tar files with the following structure:

  • crash_dump.tar.gz

    • metadata.json (basic crash information - depthai specific)

    • extra.json (user-defined extra crashdump information)

    • platform specific files…

Subclassed by dai::CrashDumpRVC2, dai::CrashDumpRVC4

Public Functions

virtual ~CrashDump()
virtual Platform getPlatform() const = 0

Identify the platform that this crashdump corresponds to.

Returns:

Platform enum value

virtual std::string getCrashDumpVersion() const = 0

Get the version of the crash dump format.

Returns:

Version string

nlohmann::json &operator[](const std::string &key)

Mutable access to extra data by key.

Parameters:

key – The key to access

Returns:

Reference to the JSON value

const nlohmann::json &operator[](const std::string &key) const

Constant access to extra data by key, throws if key doesn’t exist.

Parameters:

key – The key to access

Returns:

Const reference to the JSON value

virtual void toTar(const std::filesystem::path &tarPath) const = 0

Serialize the crash dump to a tar file.

Parameters:

tarPath – Path to the output tar file

virtual void fromTar(const std::filesystem::path &tarPath) = 0

Deserialize the crash dump from a tar file.

Parameters:

tarPath – Path to the input tar file

std::vector<uint8_t> toBytes() const

Serialize the crash dump to a byte array (bytes in filesystem after calling toTar)

Returns:

Byte array

Public Members

std::string depthaiVersion
std::string depthaiVersionMajor
std::string depthaiVersionMinor
std::string depthaiVersionPatch
std::string depthaiVersionPreReleaseType
std::string depthaiVersionPreReleaseVersion
std::string depthaiVersionBuildInfo
std::string depthaiCommitHash
std::string depthaiCommitDatetime
std::string depthaiBuildDatetime
std::string depthaiDeviceVersion
std::string depthaiBootloaderVersion
std::string depthaiDeviceRVC3Version
std::string depthaiDeviceRVC4Version
std::string osPlatform
std::string crashdumpTimestamp
std::string deviceId
nlohmann::json extra = nlohmann::json::object()

Public Static Functions

static std::unique_ptr<CrashDump> fromBytes(const std::vector<uint8_t> &bytes)

Deserialize the crash dump from a byte array (bytes in filesystem after calling toBytes)

Parameters:

bytes – Byte array

Returns:

Unique pointer to the appropriate CrashDump subclass

static std::unique_ptr<CrashDump> load(const std::filesystem::path &tarPath)

Factory method to create a CrashDump from a tar file.

Parameters:

tarPath – Path to the tar file

Returns:

Unique pointer to the CrashDump instance

Protected Functions

void writeMetadata(nlohmann::json &json) const
void readMetadata(const nlohmann::json &json)