

# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: blickfeld/core_processing/data/acceleration.proto, blickfeld/core_processing/data/acceleration_buffer.proto, blickfeld/core_processing/data/frame.proto, blickfeld/core_processing/data/health.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import Dict

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

from ...base import data as __base_data__


@dataclass(eq=False, repr=False)
class Frame(betterproto.Message):
    """This section describes the contents of a point cloud frame."""

    id: int = betterproto.uint64_field(1)
    """Incremental frame ID since startup of the device."""

    timestamp: int = betterproto.uint64_field(2)
    """
    Timestamp of start of frame. Timestamp is synchronized if Time
    Synchronization is configured.
    """

    binary: "FrameBinary" = betterproto.message_field(3)
    """Binary buffer with point cloud vectors"""


@dataclass(eq=False, repr=False)
class FrameBinary(betterproto.Message):
    """
    The fields of a point cloud frame are encoded as binary arrays. Binary
    types instead of native Protobuf types are used to improve the performance.
    NOTE: All byte arrays are encoded in Little Endian.
    """

    length: int = betterproto.uint32_field(1)
    """Number of entries in arrays below."""

    cartesian: np.ndarray = betterproto.bytes_field(2, numpy_dtype="(3,)<f4")
    """
    Cartesian coordinates. 3-dimensional array in row-major format with [x, y,
    z] tuples. Type: Float32
    """

    photon_count: np.ndarray = betterproto.bytes_field(3, numpy_dtype="<u2")
    """Estimated number of photons. 1-dimensional array. Type: UInt16"""

    direction_id: np.ndarray = betterproto.bytes_field(5, numpy_dtype="<u4")
    """
    Unique direction identifiers within a frame and scan pattern. 1-dimensional
    array. Type: UInt32
    """

    timestamp: np.ndarray = betterproto.bytes_field(6, numpy_dtype="<u8")
    """Unix timestamp of points. Type: UInt64"""

    metadata: np.ndarray = betterproto.bytes_field(100, numpy_dtype="<u2")
    """
    Arbitrary metadata for annotation of the binary data fields. 1-dimensional
    array. Type: UInt16
    """


@dataclass(eq=False, repr=False)
class Acceleration(betterproto.Message):
    """A measurement of the Accelerometer"""

    x: float = betterproto.float_field(1)
    """X component of acceleration vector"""

    y: float = betterproto.float_field(2)
    """Y component of acceleration vector"""

    z: float = betterproto.float_field(3)
    """Z component of acceleration vector"""


@dataclass(eq=False, repr=False)
class AccelerationBuffer(betterproto.Message):
    """Buffer for multiple Acceleration samples"""

    timestamp: int = betterproto.uint64_field(1)
    """Timestamp of the first sample in the buffer."""

    sampling_period: int = betterproto.uint64_field(2)
    """Sampling period of the acceleration samples"""

    cartesian: bytes = betterproto.bytes_field(3)
    """
    Cartesian 3-dimensional array in row-major format with [x, y, z] tuples.
    Type: Float32
    """


@dataclass(eq=False, repr=False)
class Health(betterproto.Message):
    """Message representing health"""

    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."""

    channel_status: "HealthChannelStatus" = betterproto.message_field(3)
    """Status of internal channels"""

    server_status: "HealthServerStatus" = betterproto.message_field(4)
    """Status of gRPC server"""

    error_flags: "HealthErrorFlags" = betterproto.message_field(5)
    """Error flags which give insight in fine-grained errors"""


@dataclass(eq=False, repr=False)
class HealthChannelStatus(betterproto.Message):
    """Status for typed channels producing raw-data"""

    point_cloud: "HealthChannelStatusPointCloud" = betterproto.message_field(1)
    """Point Cloud status"""

    acceleration: "HealthChannelStatusAcceleration" = betterproto.message_field(2)
    """Acceleration status"""

    adc: "HealthChannelStatusAdc" = betterproto.message_field(3)
    """Adc status"""

    vertical_beam_deflection_control: "HealthChannelStatusBeamDeflectionControl" = (
        betterproto.message_field(4)
    )
    """Vertical Beam Deflection Control status"""

    horizontal_beam_deflection_control: "HealthChannelStatusBeamDeflectionControl" = (
        betterproto.message_field(5)
    )
    """Horizontal Beam Deflection Control status"""

    magnetic_field: "HealthChannelStatusMagneticField" = betterproto.message_field(6)
    """Magnetic Field status"""


@dataclass(eq=False, repr=False)
class HealthChannelStatusPointCloud(betterproto.Message):
    """Status of Point Cloud channel"""

    point_rate: float = betterproto.float_field(1)
    """Processed points per second"""

    scanline_rate: float = betterproto.float_field(2)
    """Scanlines per second"""

    frame_rate: float = betterproto.float_field(3)
    """Frames per second"""

    data_rate: float = betterproto.float_field(4)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """


@dataclass(eq=False, repr=False)
class HealthChannelStatusAcceleration(betterproto.Message):
    """Status of Acceleration channel"""

    buffer_rate: float = betterproto.float_field(1)
    """Processed buffers per second"""

    data_rate: float = betterproto.float_field(2)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """


@dataclass(eq=False, repr=False)
class HealthChannelStatusAdc(betterproto.Message):
    """Status of Adc channel"""

    buffer_rate: float = betterproto.float_field(1)
    """Processed buffers per second"""

    data_rate: float = betterproto.float_field(2)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """


@dataclass(eq=False, repr=False)
class HealthChannelStatusBeamDeflectionControl(betterproto.Message):
    """Status of BeamDeflectionControl channel"""

    buffer_rate: float = betterproto.float_field(1)
    """Produced buffers per second"""

    data_rate: float = betterproto.float_field(2)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """


@dataclass(eq=False, repr=False)
class HealthChannelStatusMagneticField(betterproto.Message):
    """Status of Magnetic-Field channel"""

    buffer_rate: float = betterproto.float_field(1)
    """Produced buffers per second"""

    data_rate: float = betterproto.float_field(2)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """


@dataclass(eq=False, repr=False)
class HealthServerStatus(betterproto.Message):
    """Status for Server / Client activities"""

    point_cloud: "HealthServerStatusPointCloud" = betterproto.message_field(1)
    """Point Cloud service"""

    acceleration: "HealthServerStatusAcceleration" = betterproto.message_field(2)
    """Acceleration service"""

    adc: "HealthServerStatusAdc" = betterproto.message_field(3)
    """Adc service"""

    beam_deflection_control: "HealthServerStatusBeamDeflectionControl" = (
        betterproto.message_field(4)
    )
    """Beam Deflection Control service"""

    health: "HealthServerStatusHealth" = betterproto.message_field(5)
    """Health service"""

    magnetic_field: "HealthServerStatusMagneticField" = betterproto.message_field(6)
    """Magnetic Field service"""


@dataclass(eq=False, repr=False)
class HealthServerStatusPointCloud(betterproto.Message):
    """Status for Point Cloud service"""

    number_of_clients: int = betterproto.uint32_field(1)
    """
    Number of currently open client connections   [NOTE] This is a snapshot and
    does not distinguish between long running streams or single request /
    response methods.   [NOTE] This field is deprecated, use the field
    `clients` instead.
    """

    data_rate: float = betterproto.float_field(2)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """

    clients: Dict[str, "HealthServerStatusPointCloudClient"] = betterproto.map_field(
        3, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )
    """List of currently connected client IPs and their information"""


@dataclass(eq=False, repr=False)
class HealthServerStatusPointCloudClient(betterproto.Message):
    """Connected client information"""

    number_of_streams: int = betterproto.uint32_field(1)
    """Number of open streams belonging to the client."""

    lost_frames: int = betterproto.uint64_field(2)
    """
    Number of frames which have been lost due to slow reading from the client
    side.
    """


@dataclass(eq=False, repr=False)
class HealthServerStatusAcceleration(betterproto.Message):
    """Status for Acceleration service"""

    number_of_clients: int = betterproto.uint32_field(1)
    """
    Number of currently open client connections   [NOTE] This is a snapshot and
    does not distinguish between long running streams or single request /
    response methods.
    """

    data_rate: float = betterproto.float_field(2)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """


@dataclass(eq=False, repr=False)
class HealthServerStatusAdc(betterproto.Message):
    """Status for Adc service"""

    number_of_clients: int = betterproto.uint32_field(1)
    """
    Number of currently open client connections   [NOTE] This is a snapshot and
    does not distinguish between long running streams or single request /
    response methods.
    """

    data_rate: float = betterproto.float_field(2)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """


@dataclass(eq=False, repr=False)
class HealthServerStatusBeamDeflectionControl(betterproto.Message):
    """Status for BeamDeflectionControl service"""

    number_of_clients: int = betterproto.uint32_field(1)
    """
    Number of currently open client connections   [NOTE] This is a snapshot and
    does not distinguish between long running streams or single request /
    response methods.
    """

    data_rate: float = betterproto.float_field(2)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """


@dataclass(eq=False, repr=False)
class HealthServerStatusHealth(betterproto.Message):
    """Status for Health service"""

    number_of_clients: int = betterproto.uint32_field(1)
    """
    Number of currently open client connections   [NOTE] This is a snapshot and
    does not distinguish between long running streams or single request /
    response methods.
    """

    data_rate: float = betterproto.float_field(2)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """


@dataclass(eq=False, repr=False)
class HealthServerStatusMagneticField(betterproto.Message):
    """Status for Magnetic Field service"""

    number_of_clients: int = betterproto.uint32_field(1)
    """
    Number of currently open client connections   [NOTE] This is a snapshot and
    does not distinguish between long running streams or single request /
    response methods.
    """

    data_rate: float = betterproto.float_field(2)
    """
    Average data rate   [NOTE] This value is averaged over 10 seconds, peak or
    current values might be different.
    """


@dataclass(eq=False, repr=False)
class HealthErrorFlags(betterproto.Message):
    """Error flags of internal data handling mechanisms"""

    packet_counter_mismatch_packager: bool = betterproto.bool_field(1)
    """TLP counter mismatch for Packager DMA"""

    packet_counter_mismatch_debug: bool = betterproto.bool_field(2)
    """TLP counter mismatch for Debug DMA"""

    exhausted_scanline_buffers: bool = betterproto.bool_field(3)
    """Dropping data because scanline buffers are exhausted"""

    exhausted_acceleration_buffers: bool = betterproto.bool_field(4)
    """Dropping data because acceleration buffers are exhausted"""

    exhausted_adc_buffers: bool = betterproto.bool_field(5)
    """Dropping data because adc buffers are exhausted"""

    exhausted_vertical_beam_deflection_control_buffers: bool = betterproto.bool_field(6)
    """
    Dropping data because vertical beam deflection control buffers are
    exhausted
    """

    exhausted_horizontal_beam_deflection_control_buffers: bool = betterproto.bool_field(
        7
    )
    """
    Dropping data because horizontal beam deflection control buffers are
    exhausted
    """

    exhausted_magnetic_field_buffers: bool = betterproto.bool_field(8)
    """Dropping data because magnetic field buffers are exhausted"""

    client_loosing_frames: bool = betterproto.bool_field(9)
    """
    One or multiple clients are loosing frames because they are reading too
    slow
    """

    point_cloud_stream_not_active: bool = betterproto.bool_field(10)
    """The point cloud stream is not active"""

    point_rate_too_low: bool = betterproto.bool_field(11)
    """
    The number of points in the point cloud is too low. One of the reasons is
    that the device is covered. The point rate limit that is used to trigger
    this flag can be configured with Health.SetConfig API method.
    """

    point_cloud_alignment_changed: bool = betterproto.bool_field(12)
    """
    The point cloud alignment deviates from the reference alignment. This might
    have an impact on the point cloud processing as e.g. the ground alignment
    got incorrect. If this is expected, the alignment can be reconfigured with
    the Health.SetConfig API method.
    """
