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

#include <cs_ControlPacketAccessor.h>

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

Public Member Functions

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_data_t getPayload ()
 Get pointer to the payload. More...
 
cs_buffer_size_t getPayloadSize ()
 Get the size of the payload. More...
 
cs_buffer_size_t getMaxPayloadSize ()
 Get the capacity of the payload. More...
 
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

control_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_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_ret_code_t ControlPacketAccessor< 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_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
void ControlPacketAccessor< PAYLOAD_SIZE >::checkInitialized ( ) const
inlineprotected

◆ getBufferSize()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_buffer_size_t ControlPacketAccessor< 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_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_buffer_size_t ControlPacketAccessor< 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_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_data_t ControlPacketAccessor< PAYLOAD_SIZE >::getPayload ( )
inline

Get pointer to the payload.

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

◆ getPayloadSize()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_buffer_size_t ControlPacketAccessor< 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.

◆ getProtocolVersion()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
uint8_t ControlPacketAccessor< PAYLOAD_SIZE >::getProtocolVersion ( ) const
inline

Get the protocol version.

◆ getSerializedBuffer()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_data_t ControlPacketAccessor< 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_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_buffer_size_t ControlPacketAccessor< 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_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_control_cmd_t ControlPacketAccessor< PAYLOAD_SIZE >::getType ( ) const
inline

Get the command type.

◆ setPayload()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
cs_ret_code_t ControlPacketAccessor< 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.

◆ setProtocolVersion()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
void ControlPacketAccessor< PAYLOAD_SIZE >::setProtocolVersion ( uint8_t  protocol)
inline

Set the protocol version.

◆ setType()

template<cs_buffer_size_t PAYLOAD_SIZE = CS_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
void ControlPacketAccessor< 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_CONTROL_PACKET_DEFAULT_PAYLOAD_SIZE>
control_packet_t<PAYLOAD_SIZE>* ControlPacketAccessor< PAYLOAD_SIZE >::_buffer
protected

Pointer to the packet to be sent.


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