AURobotServers
4
|
#include <userverqueue.h>
Public Member Functions | |
int | addMessage (int client, const char *msg, int size, bool raw) |
const char * | list (const char *preStr, char *buff, const int buffCnt, int maxOldElements) |
void | print (const char *preStr) |
UServerInMsg * | skipToNextMessage (bool checkForDublicates) |
UServerInQueue () | |
virtual | ~UServerInQueue () |
Public Member Functions inherited from UMsgQueue | |
bool | addMessage (unsigned char msg[], int size) |
bool | clear () |
bool | create (int iElements, int iElementSize) |
void | freeQueue () |
int | getElements () |
int | getElementSize () |
int | getNextOut () |
unsigned char * | getOutMessageRef () |
int | getUsedMsgCnt () |
bool | isEmpty () |
bool | isFull () |
bool | isValid () |
unsigned char * | skipToNextMessage (bool checkForDublicates) |
UMsgQueue () | |
~UMsgQueue () | |
Public Member Functions inherited from ULock | |
bool | lock () |
void | lockInit () |
void | post () |
bool | tryLock () |
bool | tryWait () |
ULock () | |
void | unlock () |
bool | wait () |
~ULock () | |
Additional Inherited Members | |
Protected Member Functions inherited from UMsgQueue | |
unsigned char * | getMsg (int i) |
Protected Attributes inherited from UMsgQueue | |
int | elements |
int | elementSize |
int | justIn |
int | nextOut |
unsigned char ** | pMsg |
bool | valid |
Message queue for messages from clients
UServerInQueue::UServerInQueue | ( | ) |
Constructor
References MAX_SOCKET_RECEIVE_QUEUE.
|
virtual |
Destructor
int UServerInQueue::addMessage | ( | int | client, |
const char * | msg, | ||
int | size, | ||
bool | raw | ||
) |
Add message
client | is index to posting client |
msg | is the message to pose |
size | is length of message - will be terminated here |
raw | is false, then assumed to be an XML tag (with or without brackets) |
References MAX_MESSAGE_LENGTH_TO_CAM, UServerInMsg::setMessage(), and UServerInMsg::size.
Referenced by UServerClient::gotNewMessage(), and UCmdExe::postCommand().
const char * UServerInQueue::list | ( | const char * | preStr, |
char * | buff, | ||
const int | buffCnt, | ||
int | maxOldElements | ||
) |
List queue elements List all pending elements and a maximum number of old elements
preStr | is a string to print atin the start of the buffer |
buff | is the buffer to use |
buffCnt | is the maximum length to use of the buffer |
maxOldElements | is the maximum number of history elements to list |
References UTime::getDecSec(), UServerInMsg::message, mini(), UServerInMsg::print(), UServerInMsg::rxTime, UServerInMsg::size, and UTime::valid.
Referenced by UCmdExe::handleServerCommand().
void UServerInQueue::print | ( | const char * | preStr | ) |
print buffer information to console
References UServerInMsg::print().
Referenced by UServerPort::print().
UServerInMsg * UServerInQueue::skipToNextMessage | ( | bool | checkForDublicates | ) |
Get message and remove it from queue. NB! Cheeck for dublicates is not supported yet.
References UMsgQueue::skipToNextMessage().
Referenced by UCmdExe::handleOneMessageFromQueue(), and testServerPort().