#include <m2mblockmessage.h>
Public Types | |
enum | Error { ErrorNone = 0, EntityTooLarge } |
An enum defining different kinds of errors that can occur during the block-wise operation. | |
Public Member Functions | |
M2MBlockMessage () | |
virtual | ~M2MBlockMessage () |
void | set_message_info (sn_coap_hdr_s *coap_header) |
Store the data from a CoAP message. More... | |
void | set_payload (const uint8_t *payload, const uint16_t payload_len, const uint16_t offset) |
Store the payload data from a CoAP message. More... | |
void | clear_values () |
Clear values. | |
bool | is_block_message () const |
Check if the message is a block message. More... | |
uint16_t | block_number () const |
Returns the number of an incoming block. More... | |
uint32_t | total_message_size () const |
Returns the total size of the message. More... | |
bool | is_last_block () const |
Check if last block. More... | |
uint8_t * | block_data () const |
Returns the payload of the message. More... | |
uint32_t | block_data_len () const |
Returns the length of the payload. More... | |
Error | error_code () const |
Returns an error code. More... | |
This class contains the data of an incoming block message.
M2MBlockMessage::M2MBlockMessage | ( | ) |
Constructor.
|
virtual |
Destructor.
uint8_t* M2MBlockMessage::block_data | ( | ) | const |
Returns the payload of the message.
uint32_t M2MBlockMessage::block_data_len | ( | ) | const |
Returns the length of the payload.
uint16_t M2MBlockMessage::block_number | ( | ) | const |
Returns the number of an incoming block.
Error M2MBlockMessage::error_code | ( | ) | const |
Returns an error code.
bool M2MBlockMessage::is_block_message | ( | ) | const |
Check if the message is a block message.
coap_header | The message to check. |
bool M2MBlockMessage::is_last_block | ( | ) | const |
Check if last block.
void M2MBlockMessage::set_message_info | ( | sn_coap_hdr_s * | coap_header | ) |
Store the data from a CoAP message.
coap_header | The message to parse. |
void M2MBlockMessage::set_payload | ( | const uint8_t * | payload, |
const uint16_t | payload_len, | ||
const uint16_t | offset | ||
) |
Store the payload data from a CoAP message.
*payload | Payload to be stored. |
payload_len | Length of the payload. |
offset | Offset where to copy the data. |
uint32_t M2MBlockMessage::total_message_size | ( | ) | const |
Returns the total size of the message.