Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
ResultPacketAccessor< PAYLOAD_SIZE > Class Template Reference

#include <cs_ResultPacketAccessor.h>

Inheritance diagram for ResultPacketAccessor< PAYLOAD_SIZE >:
Collaboration diagram for ResultPacketAccessor< PAYLOAD_SIZE >:

Public Member Functions

bool isInitialized () const
 Only set or get fields when this instance is initialized. More...
 
uint8_t getProtocolVersion () const
 Get the protocol version. More...
 
void setProtocolVersion (uint8_t protocol)
 Set the protocol version. More...
 
cs_control_cmd_t getType () const
 Get the command type. More...
 
void setType (cs_control_cmd_t type)
 Set the command type. More...
 
cs_ret_code_t getResult () const
 Get the result code. More...
 
void setResult (cs_ret_code_t result)
 Set the result code. More...
 
cs_data_t getPayload ()
 Get the payload. More...
 
cs_buffer_size_t getPayloadSize ()
 Get the size of the payload. More...
 
buffer_ptr_t getPayloadBuffer ()
 Get the payload buffer. More...
 
cs_buffer_size_t getMaxPayloadSize ()
 Get the capacity of the payload. More...
 
cs_ret_code_t setPayloadSize (cs_buffer_size_t size)
 
cs_ret_code_t setPayload (buffer_ptr_t payload, cs_buffer_size_t size)
 Copy payload into the packet. More...
 
cs_ret_code_t assign (buffer_ptr_t buffer, cs_buffer_size_t size)
 Assign the buffer used to hold the data. More...
 
cs_buffer_size_t getSerializedSize () const
 Get the size of the serialized data in the buffer. More...
 
cs_buffer_size_t getBufferSize () const
 Get the capacity of the buffer. More...
 
cs_data_t getSerializedBuffer ()
 Get the pointer to the buffer. More...
 

Protected Member Functions

void checkInitialized () const
 

Protected Attributes

result_packet_t< PAYLOAD_SIZE > * _buffer
 Pointer to the packet to be sent. More...
 

Additional Inherited Members

- Private Member Functions inherited from BufferAccessor
virtual ~BufferAccessor ()
 Default destructor. More...
 
virtual cs_ret_code_t assign (buffer_ptr_t buffer, cs_buffer_size_t size)=0
 Assign the buffer used to hold the data. More...
 
virtual cs_buffer_size_t getBufferSize () const =0
 Get the capacity of the buffer. More...
 
virtual cs_buffer_size_t getSerializedSize () const =0
 Get the size of the serialized data in the buffer. More...
 
virtual cs_buffer_size_t getRemainingCapacity () const
 
virtual cs_data_t getSerializedBuffer ()=0
 Get the pointer to the buffer. More...
 

Member Function Documentation

◆ assign()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_ret_code_t ResultPacketAccessor< PAYLOAD_SIZE >::assign ( buffer_ptr_t  buffer,
cs_buffer_size_t  size 
)
inlinevirtual

Assign the buffer used to hold the data.

Parameters
[in]bufferThe buffer to be used.
[in]sizeSize of buffer in bytes.
Returns
ERR_SUCCESS on success.

Implements BufferAccessor.

◆ checkInitialized()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
void ResultPacketAccessor< PAYLOAD_SIZE >::checkInitialized ( ) const
inlineprotected

◆ getBufferSize()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_buffer_size_t ResultPacketAccessor< PAYLOAD_SIZE >::getBufferSize ( ) const
inlinevirtual

Get the capacity of the buffer.

Returns
Maximum size of the buffer in bytes.

Implements BufferAccessor.

◆ getMaxPayloadSize()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_buffer_size_t ResultPacketAccessor< PAYLOAD_SIZE >::getMaxPayloadSize ( )
inline

Get the capacity of the payload.

Returns
Max size of the payload in bytes.

◆ getPayload()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_data_t ResultPacketAccessor< PAYLOAD_SIZE >::getPayload ( )
inline

Get the payload.

Returns
Data struct with pointer to payload and size of the payload in bytes.

◆ getPayloadBuffer()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
buffer_ptr_t ResultPacketAccessor< PAYLOAD_SIZE >::getPayloadBuffer ( )
inline

Get the payload buffer.

Returns
pointer to the payload buffer.

◆ getPayloadSize()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_buffer_size_t ResultPacketAccessor< PAYLOAD_SIZE >::getPayloadSize ( )
inline

Get the size of the payload.

Will never be larger than what fits in the buffer.

Returns
Size of the payload in bytes.

◆ getProtocolVersion()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
uint8_t ResultPacketAccessor< PAYLOAD_SIZE >::getProtocolVersion ( ) const
inline

Get the protocol version.

◆ getResult()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_ret_code_t ResultPacketAccessor< PAYLOAD_SIZE >::getResult ( ) const
inline

Get the result code.

◆ getSerializedBuffer()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_data_t ResultPacketAccessor< PAYLOAD_SIZE >::getSerializedBuffer ( )
inlinevirtual

Get the pointer to the buffer.

Returns
Struct with pointer to buffer and size of the serialized data in bytes.

Implements BufferAccessor.

◆ getSerializedSize()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_buffer_size_t ResultPacketAccessor< PAYLOAD_SIZE >::getSerializedSize ( ) const
inlinevirtual

Get the size of the serialized data in the buffer.

Returns
Size of the serialized data in bytes.

Implements BufferAccessor.

◆ getType()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_control_cmd_t ResultPacketAccessor< PAYLOAD_SIZE >::getType ( ) const
inline

Get the command type.

◆ isInitialized()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
bool ResultPacketAccessor< PAYLOAD_SIZE >::isInitialized ( ) const
inline

Only set or get fields when this instance is initialized.

◆ setPayload()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_ret_code_t ResultPacketAccessor< PAYLOAD_SIZE >::setPayload ( buffer_ptr_t  payload,
cs_buffer_size_t  size 
)
inline

Copy payload into the packet.

Parameters
[in]payloadPointer to the payload.
[in]sizeSize of the payload.
Returns
error code.

◆ setPayloadSize()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_ret_code_t ResultPacketAccessor< PAYLOAD_SIZE >::setPayloadSize ( cs_buffer_size_t  size)
inline

◆ setProtocolVersion()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
void ResultPacketAccessor< PAYLOAD_SIZE >::setProtocolVersion ( uint8_t  protocol)
inline

Set the protocol version.

◆ setResult()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
void ResultPacketAccessor< PAYLOAD_SIZE >::setResult ( cs_ret_code_t  result)
inline

Set the result code.

◆ setType()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
void ResultPacketAccessor< PAYLOAD_SIZE >::setType ( cs_control_cmd_t  type)
inline

Set the command type.

Member Data Documentation

◆ _buffer

template<cs_buffer_size_t PAYLOAD_SIZE = CS_RESULT_PACKET_DEFAULT_PAYLOAD_SIZE>
result_packet_t<PAYLOAD_SIZE>* ResultPacketAccessor< PAYLOAD_SIZE >::_buffer
protected

Pointer to the packet to be sent.


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