ProsecCoAP 🥂
 
Loading...
Searching...
No Matches
CoapPacket Class Reference

#include <ProsecCoAP.h>

Collaboration diagram for CoapPacket:

Public Member Functions

void addOption (uint8_t number, uint8_t length, uint8_t *value)
 Add an option to the packet.
 
bool getObserveValue (COAP_OBSERVE_VALUE &value)
 Fetch the observe value (either 1 or 0).
 

Public Attributes

uint8_t type = 0
 
uint8_t code = 0
 
const uint8_t * token = NULL
 
uint8_t tokenLength = 0
 
const uint8_t * payload = NULL
 
size_t payloadLength = 0
 
uint16_t messageId = 0
 
uint8_t optionCount = 0
 
CoapOption options [COAP_MAX_OPTION_NUM]
 

Member Function Documentation

◆ addOption()

void CoapPacket::addOption ( uint8_t number,
uint8_t length,
uint8_t * value )

Add an option to the packet.

The option is stored and will be later parsed when sending the packet.

Parameters
numberThe option number.
lengthThe length of the option value.
valueThe pointer to the option value.

◆ getObserveValue()

bool CoapPacket::getObserveValue ( COAP_OBSERVE_VALUE & value)

Fetch the observe value (either 1 or 0).

Returns
true if the observe option is present and value retrieved successfully, false otherwise.

Member Data Documentation

◆ code

uint8_t CoapPacket::code = 0

◆ messageId

uint16_t CoapPacket::messageId = 0

◆ optionCount

uint8_t CoapPacket::optionCount = 0

◆ options

CoapOption CoapPacket::options[COAP_MAX_OPTION_NUM]

◆ payload

const uint8_t* CoapPacket::payload = NULL

◆ payloadLength

size_t CoapPacket::payloadLength = 0

◆ token

const uint8_t* CoapPacket::token = NULL

◆ tokenLength

uint8_t CoapPacket::tokenLength = 0

◆ type

uint8_t CoapPacket::type = 0

The documentation for this class was generated from the following files: