YAPB
Loading...
Searching...
No Matches
Push Operations

Functions

YAPB_Result_t YAPB_push_i8 (YAPB_Packet_t *pkt, const int8_t *val)
 Push a signed 8-bit integer.
YAPB_Result_t YAPB_push_i16 (YAPB_Packet_t *pkt, const int16_t *val)
 Push a signed 16-bit integer.
YAPB_Result_t YAPB_push_i32 (YAPB_Packet_t *pkt, const int32_t *val)
 Push a signed 32-bit integer.
YAPB_Result_t YAPB_push_i64 (YAPB_Packet_t *pkt, const int64_t *val)
 Push a signed 64-bit integer.
YAPB_Result_t YAPB_push_float (YAPB_Packet_t *pkt, const float *val)
 Push a single-precision float.
YAPB_Result_t YAPB_push_double (YAPB_Packet_t *pkt, const double *val)
 Push a double-precision float.
YAPB_Result_t YAPB_push_blob (YAPB_Packet_t *pkt, const uint8_t *data, uint16_t len)
 Push a raw byte blob.
YAPB_Result_t YAPB_push_nested (YAPB_Packet_t *pkt, const YAPB_Packet_t *nested)
 Push a finalized nested packet.

Detailed Description

Functions to append typed elements to a packet in write mode.

All push functions check for sufficient buffer space and set a sticky error on failure. Values are stored in network byte order.

Function Documentation

◆ YAPB_push_blob()

YAPB_Result_t YAPB_push_blob ( YAPB_Packet_t * pkt,
const uint8_t * data,
uint16_t len )

Push a raw byte blob.

Parameters
pktPacket in write mode.
dataPointer to blob data (may be NULL if len is 0).
lenLength of the blob (max 65535).
Returns
YAPB_OK on success, error code otherwise.

◆ YAPB_push_double()

YAPB_Result_t YAPB_push_double ( YAPB_Packet_t * pkt,
const double * val )

Push a double-precision float.

Parameters
pktPacket in write mode.
valPointer to the value.
Returns
YAPB_OK on success, error code otherwise.

◆ YAPB_push_float()

YAPB_Result_t YAPB_push_float ( YAPB_Packet_t * pkt,
const float * val )

Push a single-precision float.

Parameters
pktPacket in write mode.
valPointer to the value.
Returns
YAPB_OK on success, error code otherwise.

◆ YAPB_push_i16()

YAPB_Result_t YAPB_push_i16 ( YAPB_Packet_t * pkt,
const int16_t * val )

Push a signed 16-bit integer.

Parameters
pktPacket in write mode.
valPointer to the value.
Returns
YAPB_OK on success, error code otherwise.

◆ YAPB_push_i32()

YAPB_Result_t YAPB_push_i32 ( YAPB_Packet_t * pkt,
const int32_t * val )

Push a signed 32-bit integer.

Parameters
pktPacket in write mode.
valPointer to the value.
Returns
YAPB_OK on success, error code otherwise.

◆ YAPB_push_i64()

YAPB_Result_t YAPB_push_i64 ( YAPB_Packet_t * pkt,
const int64_t * val )

Push a signed 64-bit integer.

Parameters
pktPacket in write mode.
valPointer to the value.
Returns
YAPB_OK on success, error code otherwise.

◆ YAPB_push_i8()

YAPB_Result_t YAPB_push_i8 ( YAPB_Packet_t * pkt,
const int8_t * val )

Push a signed 8-bit integer.

Parameters
pktPacket in write mode.
valPointer to the value.
Returns
YAPB_OK on success, error code otherwise.

◆ YAPB_push_nested()

YAPB_Result_t YAPB_push_nested ( YAPB_Packet_t * pkt,
const YAPB_Packet_t * nested )

Push a finalized nested packet.

The nested packet (including its header) is copied into the parent.

Parameters
pktPacket in write mode.
nestedFinalized packet to embed.
Returns
YAPB_OK on success, error code otherwise.