Struct rubble::link::advertising::Header[][src]

pub struct Header(u16);
Expand description

16-bit Advertising Channel PDU header preceding the Payload.

The header looks like this:

LSB                                                                     MSB
+------------+------------+---------+---------+--------------+------------+
|  PDU Type  |     -      |  TxAdd  |  RxAdd  |    Length    |     -      |
|  (4 bits)  |  (2 bits)  | (1 bit) | (1 bit) |   (6 bits)   |  (2 bits)  |
+------------+------------+---------+---------+--------------+------------+

The TxAdd and RxAdd field are only used for some payloads, for all others, they should be set to 0.

Length may be in range 6 to 37 (inclusive). With the 2-Byte header this is exactly the max. on-air packet size.

Tuple Fields

0: u16

Implementations

Creates a new Advertising Channel PDU header specifying the Payload type ty.

Returns the raw representation of the header.

The returned u16 must be transmitted LSb first as the first 2 octets of the PDU.

Sets all bits in the header that are set in mask.

Clears all bits in the header that are set in mask.

Returns the PDU type specified in the header.

Returns the state of the TxAdd field.

Sets the TxAdd field’s value.

Returns the state of the RxAdd field.

Sets the RxAdd field’s value.

Returns the length of the payload in octets as specified in the Length field.

According to the spec, the length must be in range 6…37, but this isn’t checked by this function.

Sets the payload length of this PDU.

The length must be in range 6…37, otherwise this function panics.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Decode a Self from a byte slice, advancing bytes to point past the data that was read. Read more

Converts self to bytes and writes them into writer, advancing writer to point past the encoded value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.