Mistake on this page? Email us
M2MBlockMessage Class Reference

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...
 

Constructor & Destructor Documentation

M2MBlockMessage::M2MBlockMessage ( )

Constructor.

virtual M2MBlockMessage::~M2MBlockMessage ( )
virtual

Destructor.

Member Function Documentation

uint8_t* M2MBlockMessage::block_data ( ) const

Returns the payload of the message.

Returns
The message payload.
uint32_t M2MBlockMessage::block_data_len ( ) const

Returns the length of the payload.

Returns
The payload length.
uint16_t M2MBlockMessage::block_number ( ) const

Returns the number of an incoming block.

Returns
Block number, starting from 0.
Error M2MBlockMessage::error_code ( ) const

Returns an error code.

Returns
Error code.
bool M2MBlockMessage::is_block_message ( ) const

Check if the message is a block message.

Parameters
coap_headerThe message to check.
Returns
True if block message, else false.
bool M2MBlockMessage::is_last_block ( ) const

Check if last block.

Returns
True if last block, else false.
void M2MBlockMessage::set_message_info ( sn_coap_hdr_s *  coap_header)

Store the data from a CoAP message.

Parameters
coap_headerThe 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.

Parameters
*payloadPayload to be stored.
payload_lenLength of the payload.
offsetOffset where to copy the data.
uint32_t M2MBlockMessage::total_message_size ( ) const

Returns the total size of the message.

Returns
The total size in bytes.

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