

# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: blickfeld/compute_module/data/health.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import List

import blickfeld_qb2.betterproto as betterproto
import blickfeld_qb2.betterproto.lib.google.protobuf as betterproto_lib_google_protobuf

from ...base import data as __base_data__


@dataclass(eq=False, repr=False)
class Health(betterproto.Message):
    """Describes the health of the compute module"""

    state: "__base_data__.HealthState" = betterproto.enum_field(1)
    """High-level state of module"""

    state_reason: str = betterproto.string_field(2)
    """Reason for given state. Is not set if state is STATE_OK."""

    error_flags: "HealthErrorFlags" = betterproto.message_field(3)
    """Error flags"""

    cpu_performance: "HealthCpuPerformance" = betterproto.message_field(4)
    """CPU performance"""

    memory_utilization: float = betterproto.float_field(5)
    """
    Memory utilization of the compute module.   The value range is between 0
    and 1.
    """

    uptime: "HealthUptime" = betterproto.message_field(6)
    """Uptime"""


@dataclass(eq=False, repr=False)
class HealthErrorFlags(betterproto.Message):
    """Error flags"""

    high_cpu_load: bool = betterproto.bool_field(1)
    """
    The average CPU load of sensor is too high. The processing and frame rate
    will be automatically throttled.
    """

    high_temperature: bool = betterproto.bool_field(2)
    """
    The temperature of the device is too high.   The CPU frequency will be
    throttled automatically. The processing capability might be limited. Note
    that an operation outside of the specified temperature range, can cause
    permanent damage to the sensor.
    """


@dataclass(eq=False, repr=False)
class HealthCpuPerformance(betterproto.Message):
    """Performance statistics of the CPU"""

    total_load: float = betterproto.float_field(1)
    """Average CPU load of all cores.   The value range is between 0 and 1."""

    individual_loads: List[float] = betterproto.float_field(2)
    """Individual load per core.   The value range is between 0 and 1."""

    frequency: float = betterproto.float_field(3)
    """Current frequency"""

    temperature: float = betterproto.float_field(4)
    """Current temperature"""


@dataclass(eq=False, repr=False)
class HealthUptime(betterproto.Message):
    """Uptime of the device"""

    since_boot: int = betterproto.uint64_field(1)
    """Uptime since the last boot"""

    lifetime: int = betterproto.uint64_field(2)
    """
    Uptime over the whole lifetime.   NOTE: The counting started with the
    firmware v2.3.
    """
