AURobotServers
4
|
#include <uclientport.h>
Public Member Functions | |
virtual const char * | getSourceName () |
UClientPortSml () | |
Public Member Functions inherited from UClientPort | |
bool | blockSend (const char *buffer, int length) |
void | closeConnection () |
int | getDataFromLine (char *buffer, int bufferSize, int pollTimeoutMs) |
const char * | getHost () |
const char * | getHostIP () |
int | getPort () |
bool | isConnected () |
bool | isVerbose () |
bool | sendMsg (const char *message) |
bool | sendWithLock (const char *message) |
void | setHost (const char *toHost) |
void | setPort (int toPort) |
void | setVerbose (bool value) |
bool | tryConnect () |
UClientPort () | |
virtual | ~UClientPort () |
Public Member Functions inherited from ULock | |
bool | lock () |
void | lockInit () |
void | post () |
bool | tryLock () |
bool | tryWait () |
ULock () | |
void | unlock () |
bool | wait () |
~ULock () | |
Public Member Functions inherited from USmlSource | |
void | allowTagAtStartOfLineOnly () |
const char * | getErrorBuffer () |
virtual int | getLineNumber () |
virtual int | getNBytes (char *buffer, int n, int msTimeout=100) |
virtual bool | getNextTag (USmlTag *tag, int msTimeout=100, USmlTagIn *failEndTag=NULL, char *beforeTagBuffer=NULL, int *beforeTagCnt=NULL) |
char * | getRxDataBuffer () |
int | getRxDataBufferCnt () |
bool | getToEndTag (USmlTagIn *tag, char *buffer, const int bufferSize, int msTimeout=100, USmlTagIn *lastTag=NULL) |
bool | isErrorText () |
bool | isVerbose () |
virtual bool | logSourceData (const char *, int) |
void | setErrorBuffer (char *buf, const int bufCnt) |
virtual void | setLineNumber (int) |
int | setRxDataBufferCnt (int newMaxLength) |
virtual bool | skipNBytes (int n, int msTimeout=100) |
virtual bool | skipToEndTag (USmlTagIn *tag, int msTimeout=100) |
virtual void | syntaxError (const char *message) |
USmlSource () | |
virtual | ~USmlSource () |
Protected Member Functions | |
virtual bool | doVerboseMessages () |
virtual int | getMoreData (char *buffer, int bufferSize, int pollTimeoutMs) |
virtual bool | isSourceAvailable () |
virtual bool | outputData (const char *message) |
Protected Member Functions inherited from UClientPort | |
virtual void | connectionChange (bool nowConnected) |
virtual void | sendNamespaceOpenTag () |
Protected Member Functions inherited from USmlSource | |
void | clearRxBuffer () |
Additional Inherited Members | |
Public Attributes inherited from UClientPort | |
int | rxByteCnt |
ULock | tx |
Public Attributes inherited from USmlSource | |
const char * | ifName |
Protected Types inherited from UClientPort | |
enum | { notLost, forReopen, rxError, txError } |
Protected Attributes inherited from UClientPort | |
enum UClientPort:: { ... } | connectionLostReason |
UTime | connectTime |
char | host [MAX_HOST_LENGTH] |
char | hostIP [MAX_HOST_LENGTH] |
int | port |
unsigned int | readCnt |
bool | verboseMessages |
Protected Attributes inherited from USmlSource | |
int | dataCnt |
char * | errorBuffer |
int | errorBufferCnt |
bool | gotFirstTag |
bool | tagStartAtStartOfLineOnly |
class that extends the client post functions with a receive buffer and functions to handle simple SML formatted tags.
UClientPortSml::UClientPortSml | ( | ) |
Constructor
|
protectedvirtual |
Should additional messaves be printed to console
Reimplemented from USmlSource.
References UClientPort::verboseMessages.
|
protectedvirtual |
Get more data, if more data is available.
buffer,put | the new data in the buffer |
bufferSize,but | not more that this number of bytes |
wait | at maximum this number of ms for more data |
Reimplemented from USmlSource.
References UClientPort::getDataFromLine().
Referenced by UClientHandler::threadRunLoop().
|
inlinevirtual |
Got an unusable message - just skip to other end. 'tag' should point to the start tag, of which the content is unwanted. timeout is in miliseconds, when waiting for new data. Returns true when relevant end-tag is removed from the stream or false when a period of 'msTimeout' has passed with no data. Skip N bytes (from a binary message). Returns true if n bytes skipped. Returns false if timeout or source is down. Get the next n bytes loaded into the provided buffer. N may be of any length (that can be received within the timeout period). Returns the number of bytes loaded into the buffer. If source is invalid or no data is available zero is returned. Read the next available tag into the provided buffer. The found tag is loaded into the 'tag' buffer. if 'beforeTagBuffer' != NULL then the data before the next tag is stored in this buffer. The buffer size is initiated in 'beforeTagCnt'. The number of bytes befor the next tag is also returned into 'beforeTagCnt'. If there is more data before the next tag than the space in 'beforeTagBuffer' then the function returns with 'beforeTagBuffer' equal to the buffer size and the function returnes true. Note the buffer is NOT nul-terminated (to allow binary data), so the user must add a nul at the 'beforeTagCnt' position if the result is used as a string. The search is also stopped if an end-tag is found matching the 'failEndTag' (makes the function return false). Returns true if tag is valid (and the beforeTagBuffer has no overflow). Get source name pointer for the SML source
Reimplemented from USmlSource.
References UClientPort::getHost().
|
protectedvirtual |
Discard all data in buffer – assumed garbage, e.g server reply error Is tha data source (still) open.
Reimplemented from USmlSource.
References UClientPort::isConnected().
|
protectedvirtual |
Output a reply to the source (if possible, e.g. a socket connection)
message | is 0-terminated |
Reimplemented from USmlSource.
References UClientPort::sendWithLock().