TDME2 1.9.121
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
UDPClientMessage Class Reference

UDP client message. More...

#include <tdme/network/udpclient/UDPClientMessage.h>

Collaboration diagram for UDPClientMessage:
Collaboration graph

Public Types

enum  MessageType { MESSAGETYPE_NONE , MESSAGETYPE_CONNECT , MESSAGETYPE_MESSAGE , MESSAGETYPE_ACKNOWLEDGEMENT }
 

Public Member Functions

 ~UDPClientMessage ()
 Destructor. More...
 
const uint64_t getTime ()
 
const MessageType getMessageType ()
 
const uint32_t getClientId ()
 
const uint32_t getMessageId ()
 
const uint8_t getRetryCount ()
 
const int64_t getRetryTime ()
 
void retry ()
 Mark message to be resend with increased retry count. More...
 
stringstream * getFrame ()
 
void generate (char message[512], size_t &bytes)
 Generate datagram. More...
 

Static Public Member Functions

static UDPClientMessageparse (const char message[512], const size_t bytes)
 Parse. More...
 

Private Member Functions

 UDPClientMessage (const MessageType messageType, const uint32_t clientId, const uint32_t messageId, const uint8_t retries, stringstream *frame)
 Public constructor. More...
 

Private Attributes

friend UDPClient
 
long time
 
uint8_t retries
 
MessageType messageType
 
uint32_t clientId
 
uint32_t messageId
 
stringstream * frame
 

Detailed Description

UDP client message.

Author
Andreas Drewke

Definition at line 16 of file UDPClientMessage.h.

Member Enumeration Documentation

◆ MessageType

Enumerator
MESSAGETYPE_NONE 
MESSAGETYPE_CONNECT 
MESSAGETYPE_MESSAGE 
MESSAGETYPE_ACKNOWLEDGEMENT 

Definition at line 20 of file UDPClientMessage.h.

Constructor & Destructor Documentation

◆ ~UDPClientMessage()

Destructor.

Definition at line 68 of file UDPClientMessage.cpp.

◆ UDPClientMessage()

UDPClientMessage ( const MessageType  messageType,
const uint32_t  clientId,
const uint32_t  messageId,
const uint8_t  retries,
stringstream *  frame 
)
private

Public constructor.

Parameters
messageTypemessage type
clientIdclient id
messageIdmessage id
retriesretries
frameframe

Definition at line 58 of file UDPClientMessage.cpp.

Member Function Documentation

◆ generate()

void generate ( char  message[512],
size_t &  bytes 
)

Generate datagram.

Definition at line 104 of file UDPClientMessage.cpp.

◆ getClientId()

const uint32_t getClientId ( )
Returns
client id

Definition at line 80 of file UDPClientMessage.cpp.

◆ getFrame()

stringstream * getFrame ( )
Returns
frame

Definition at line 100 of file UDPClientMessage.cpp.

◆ getMessageId()

const uint32_t getMessageId ( )
Returns
message id

Definition at line 84 of file UDPClientMessage.cpp.

◆ getMessageType()

const UDPClientMessage::MessageType getMessageType ( )
Returns
message type

Definition at line 76 of file UDPClientMessage.cpp.

◆ getRetryCount()

const uint8_t getRetryCount ( )
Returns
retry count

Definition at line 92 of file UDPClientMessage.cpp.

◆ getRetryTime()

const int64_t getRetryTime ( )
Returns
retry time

Definition at line 88 of file UDPClientMessage.cpp.

◆ getTime()

const uint64_t getTime ( )
Returns
time

Definition at line 72 of file UDPClientMessage.cpp.

◆ parse()

UDPClientMessage * parse ( const char  message[512],
const size_t  bytes 
)
static

Parse.

Parameters
message[512]message
bytesbytes

Definition at line 26 of file UDPClientMessage.cpp.

◆ retry()

void retry ( )

Mark message to be resend with increased retry count.

Definition at line 96 of file UDPClientMessage.cpp.

Member Data Documentation

◆ clientId

uint32_t clientId
private

Definition at line 99 of file UDPClientMessage.h.

◆ frame

stringstream* frame
private

Definition at line 101 of file UDPClientMessage.h.

◆ messageId

uint32_t messageId
private

Definition at line 100 of file UDPClientMessage.h.

◆ messageType

MessageType messageType
private

Definition at line 98 of file UDPClientMessage.h.

◆ retries

uint8_t retries
private

Definition at line 97 of file UDPClientMessage.h.

◆ time

long time
private

Definition at line 96 of file UDPClientMessage.h.

◆ UDPClient

friend UDPClient
private

Definition at line 17 of file UDPClientMessage.h.


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