Wirepas SDK
pack.h File Reference

Detailed Description

Bytes to native integers packing and unpacking

Definition in file pack.h.

Go to the source code of this file.

Functions

uint32_t Pack_unpackLe (const uint8_t *bytes, size_t num_bytes)
 Convert 1 to 4 little endian bytes to a native unsigned integer. More...
 
void Pack_packLe (void *bytes, uint32_t value, size_t num_bytes)
 Convert native unsigned integer to 1 to 4 little endian bytes. More...
 

Function Documentation

◆ Pack_packLe()

void Pack_packLe ( void *  bytes,
uint32_t  value,
size_t  num_bytes 
)

Convert native unsigned integer to 1 to 4 little endian bytes.

Parameters
bytesPointer to bytes to pack
valueValue to pack
num_bytesNumber of bytes to pack, up to 4

◆ Pack_unpackLe()

uint32_t Pack_unpackLe ( const uint8_t *  bytes,
size_t  num_bytes 
)

Convert 1 to 4 little endian bytes to a native unsigned integer.

Parameters
bytesPointer to bytes to unpack
num_bytesNumber of bytes to unpack, up to 4
Returns
Unpacked little endian value