PointPacket

Struct PointPacket 

Source
pub struct PointPacket {
    pub seq: u32,
    pub retransmitted: bool,
    pub group: u8,
    pub last: bool,
    pub run_id: u8,
    pub first_index: u32,
    pub channels: ChannelMask,
    pub t0: u64,
    pub has_time: bool,
    /* private fields */
}
Expand description

一个点包:一组(group)连续若干个 CONV 时刻的采样点。

每个点包含该组通道掩码中每一路的一个 14 bit 码值(16 bit 有符号存放); 该组开启时间字时,每个点还带有时刻、来源编号和无效标志。

Fields§

§seq: u32

包序号(两组共用,ACK / NACK 按它进行)。

§retransmitted: bool

是否为重传副本。

§group: u8

组号 0 或 1。

§last: bool

是否为该组本次运行的最后一包(可以不含点)。

§run_id: u8

运行编号(每次 START 加 1,8 bit)。

§first_index: u32

本次运行中该组在本包之前已输出的点数。

§channels: ChannelMask

本包包含的通道(每个点按序号从小到大排列)。

§t0: u64

本包第一个点的时刻,单位 T/64(T = 采样周期),自采样时间基准启动起计,52 bit。

§has_time: bool

每个点是否带时间字。

Implementations§

Source§

impl PointPacket

Source

pub fn decode(b: &[u8]) -> Result<PointPacket>

解析一个 POINTS 数据报。

Source

pub fn len(&self) -> usize

点数。

Source

pub fn is_empty(&self) -> bool

是否不含点(空的结束包)。

Source

pub fn points(&self) -> impl Iterator<Item = Point<'_>>

逐点遍历。

Source

pub fn column(&self, column: usize) -> impl Iterator<Item = i16> + '_

第 column 个通道(按 PointPacket::channels 的顺序)在本包所有点上的值。

Trait Implementations§

Source§

impl Clone for PointPacket

Source§

fn clone(&self) -> PointPacket

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PointPacket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.