Struct open_protocol::header::Header [] [src]

pub struct Header(_);

Represents the frame header.

Example

use open_protocol::header::{Header, SDK_SOF};

let header = Header::build()
    .sof(SDK_SOF)
    .length(24)
    .version(0)
    .session_id(1)
    .ack(false)
    .enc(1)
    .seq(4)
    .crc()
    .unwrap();

// Verify the header
header.verify();

// Get frame length
let frame_length = header.length();
frame_length == 24;

Methods

impl Header
[src]

Create a HeaderBuiler for building a frame header.

Starting byte. Fixed to be 0xAA.

8 bits.

The length of the frame.

10 bits.

The version of the frame header. Always zero.

6 bits.

Ths session id of this frame.

5 bits.

The type of this frame. ture means the frame is a ack frame, false means the frame is a cmd frame.

1 bit

Always set to zero.

2 bits.

Padding data used by encryption logic.

5 bits.

Encryption type. 0 means no encryption, 1 means ase encryption.

3 bits.

Always set to zero.

24 bits.

The frame sequence number.

16 bits.

CRC16 of the header of the frame.

16 bits.

Check whether the data is a valid frame header.

Trait Implementations

impl Debug for Header
[src]

Formats the value using the given formatter.

impl Clone for Header
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Header
[src]

impl IntoBytes for Header
[src]

impl FromBytes for Header
[src]