AURobotServers
4
|
#include <uresif.h>
Public Member Functions | |
const char * | binName () |
bool | binNameValid () |
void | connectionHangUp () |
const char * | getResID () |
virtual bool | methodCall (const char *name, const char *paramOrder, char **strings, const double *pars, double *value, UDataBase **returnStruct, int *returnStructCnt) |
void | openConnection (const char *newHost, const int newPort) |
virtual const char * | print (const char *preString, char *buff, int buffCnt) |
void | quitRemoteEnd () |
double | rxTimeout () |
void | setBinName (const char *handlerName) |
void | setBinNameValid (bool value) |
void | setHost (const char *newHost) |
void | setPort (const int) |
virtual bool | setReplay (bool value) |
bool | setResource (UResBase *resource, bool remove) |
virtual const char * | snprint (const char *preString, char *buff, int buffCnt) |
UResIf (const char *aliasID) | |
virtual | ~UResIf () |
Public Member Functions inherited from UClientHandler | |
unsigned long | addDataTrap (const char *key, EVENT_CALL onEvent, void *object) |
bool | addFunction (UClientFuncBase *functionHandler, bool remove=false) |
void | closeConnection () |
void | delDataTrap (unsigned long serial) |
bool | getNamespaceUse () |
const char * | getServerNamespaceName () |
double | getServerToLocalTime () |
bool | isServerToLocalTimeValid () |
bool | isThreadRunning () |
bool | openConnection () |
void | print (const char *preString) |
void | sendPing () |
void | setHost (const char *host) |
void | setNamespace (const char *toName, const char *attributeString) |
void | setNamespaceLost () |
void | setNamespaceUse (bool value) |
void | setPort (const int port) |
void | setVerbose (bool value) |
const char * | snprint (const char *preString, char *buff, const int buffCnt) |
bool | start () |
void | stop (bool andWait) |
void | threadRunLoop () |
UClientHandler () | |
virtual | ~UClientHandler () |
Public Member Functions inherited from UClientPortSml | |
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 () |
Public Member Functions inherited from UResVarPool | |
int | addMethod (const char *formalName, const char *paramTypes, const char *comment) |
int | addMethodV (const char *formalName, const char *paramTypes, const char *comment) |
UVarPool * | addStruct (const char *name, const char *comment, bool copy=false) |
UVariable * | addVar (const char *name, const double initialValue, const char *type, const char *comment) |
UVariable * | addVar (const char *name, const char *initialValue, const char *type, const char *comment) |
UVariable * | addVarA (const char *name, const char *initialValue, const char *type, const char *comment) |
bool | callGlobal (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt) |
bool | callGlobalV (const char *name, const char *paramOrder, UVariable **params, UDataBase **returnStruct, int *returnStructCnt) |
Call a method from the root var pool scope It may be in the structure direct (no '.') or in any sub-structure that the 'name.subname' indicate. More... | |
bool | callLocal (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt) |
bool | callVS (const char *function, const char *stringParam) |
int | callVSCD (const char *function, const char *strPar, UDataBase *data, int cooSys) |
void | createBaseVar () |
virtual bool | createVarSpace (const int varCnt, const int structCnt, const int methCnt, const char *note, bool copy=false) |
bool | getGlobalString (const char *name, const char **value) |
bool | getGlobalValue (const char *name, double *value) |
bool | getGlobalValue (const char *name, const char **value) |
bool | getGlobalValue (const char *name, bool *value) |
bool | getGlobalValue (const char *name, UTime *value) |
bool | getLocalValue (const char *name, double *value) |
get a value in this variable tree More... | |
bool | getLocalValue (const char *name, bool *value) |
bool | getLocalValue (const char *name, UTime *value) |
double | getLocalValue (int idx) |
UPosition | getLocalValue3D (int idx) |
UPosRot | getLocalValue6D (int idx) |
bool | getLocalValueBool (int idx) |
int | getLocalValueInt (int idx) |
UTime | getLocalValueTime (int idx) |
const char * | getLogFileName () |
const char * | getVarDescription (int idx) |
UVarCalc * | getVarPool () |
virtual bool | gotAllResources (char *missingThese, int missingTheseCnt) |
bool | isLogFileOpen () |
bool | isLogFileOpen (const char *structName) |
bool | isVarPoolUpdated (int lastCnt, int *newCnt) |
void | logFileClose () |
bool | logFileOpen () |
void | logFileStart (const char *structName, bool open) |
bool | setGlobalVar (const char *name, const double value, bool mayAdd) |
Assigns a value to a variable. The variable may be a part of a structure. More... | |
bool | setLocalVar (int idx, double value, const int element) |
bool | setLocalVar (const char *name, const double value, bool mayAdd) |
Assigns a value to a variable. The variable may be a part of a structure. More... | |
bool | setLocalVar3D (int idx, UPosition *value) |
bool | setLocalVar6D (int idx, UPosRot *value) |
bool | setLocalVarAdd (int idx, double value, const int element) |
bool | setLocalVarPose (int idx, UPose *value) |
void | setVarPool (UVarCalc *sharedVarPool) |
int | updateQTvars (int structIdx) |
UResVarPool () | |
virtual | ~UResVarPool () |
Public Member Functions inherited from UResBase | |
void | createReplayVar (UVarPool *pool) |
virtual void | createResources () |
UCmdExe * | getCorePointer () |
char * | getLogFileName (char *fn, const int fnCnt) |
int | getResFuncIdx () |
const char * | getResID () |
int | getResVersion () |
bool | isA (const char *idStr) |
bool | isAlsoA (const char *id) |
virtual void | print (const char *preString) |
virtual void | saveSettings () |
void | setCorePointer (UCmdExe *serverCore) |
void | setResFuncIdx (int idx) |
virtual void | setResID (const char *id, const int version) |
virtual void | stop (bool) |
virtual void | updateReplayStatus () |
UResBase () | |
virtual | ~UResBase () |
Public Member Functions inherited from UReplay | |
void | addChild (UReplay *child) |
virtual bool | decodeReplayLine (char *) |
char * | getLogFileName (char *fn, const int fnCnt) |
char * | getReplayFileName (char *fn, const int fnCnt) |
int | getReplayLogLine () |
bool | isReplay () |
bool | isReplayFileOpen () |
void | removeChild (UReplay *child) |
virtual void | replayAdvanceTime (UTime untilTime) |
void | replaySetBaseFileName (const char *name, const char *preName="") |
void | replaySetFileName (const char *name) |
virtual bool | replayStep () |
int | replayStep (int steps) |
void | setParent (UReplay *parent) |
bool | setReplay (bool value) |
UReplay () | |
virtual | ~UReplay () |
Public Member Functions inherited from UVarMethodImplement | |
virtual bool | methodCallV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct, int *returnStructCnt) |
virtual | ~UVarMethodImplement () |
Public Member Functions inherited from UServerPush | |
int | addPushCommand (UServerInMsg *msg) |
virtual void | callGotNewDataWithObject () |
bool | doPushCall (UServerPushElement *pe, const char *value) |
void | flushClientCmds (int clientIdx) |
UServerPushImplement * | getImplementor () |
int | getPushCmdCnt (int *cmdCnt, int *callCnt) |
UServerPushQueue * | getPushQueue () |
bool | gotCmdExe () |
void | gotNewData (void *pData) |
bool | isUpdated (int lastCnt, int *newCnt) |
bool | needNewData () |
void | print (const char *preString) |
void | print (const char *preString, char *buff, int buffCnt) |
void | servicePendingPushCmds () |
void | setCmdExe (UServerPushImplement *executor) |
void | setImplementor (UServerPushImplement *executor) |
bool | setResource (UResBase *resource, bool remove) |
bool | setUpdated (const char *value) |
Add watch object if needed. An image or other object is updated. set object as updated, with an extra qualifier, that may be used as a parameter in a push call. this push list is then added to the to the push list examined by the server thread. when server thread reach this push list it will call to get a possible associated data structure by a call to needNewData() whish is expected to call gotNewData(void * data_structure) - but now in the server thread. More... | |
UServerPush () | |
virtual | ~UServerPush () |
Protected Member Functions | |
virtual void | connectionChange (bool connected) |
void | createBaseVar () |
virtual void | interfaceAlive () |
virtual void | interfaceAliveTag (USmlTag *tag) |
virtual void | interfaceTick () |
virtual bool | replayToTime (UTime untilTime) |
Protected Member Functions inherited from UClientHandler | |
void | sendNamespaceCloseTag () |
virtual void | sendNamespaceOpenTag () |
Protected Member Functions inherited from UClientPortSml | |
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 USmlSource | |
void | clearRxBuffer () |
Protected Member Functions inherited from UResVarPool | |
void | setDescription (const char *note, bool copy=false) |
Protected Member Functions inherited from UResBase | |
UResBase * | getStaticResource (const char *resName, bool mayCreate, bool staticOnly=true) |
get a pointer to a static resource. More... | |
Static Protected Attributes | |
static const int | MAX_ALIAS_LENGTH = 30 |
Static Protected Attributes inherited from UClientHandler | |
static const int | MAX_BIN_NAME_LENGTH = 30 |
binary tag name More... | |
Static Protected Attributes inherited from UReplay | |
static const int | MAX_LOG_LINE_LENGTH = 10000 |
static const int | REPLAY_FILE_NAME_LENGTH = 264 |
max length of replay filename More... | |
Private Attributes | |
bool | makeUpdateEvent |
flag to make an event a little while after connection is established More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from UResVarPool | |
static const char * | getResClassID () |
Public Attributes inherited from UClientHandler | |
bool | showInfo |
bool | showWarnings |
bool | tryHoldConnection |
Public Attributes inherited from UClientPort | |
int | rxByteCnt |
ULock | tx |
Public Attributes inherited from USmlSource | |
const char * | ifName |
Public Attributes inherited from UReplay | |
bool | replayTimeAdvancePending |
UTime | replayTimeNow |
Static Public Attributes inherited from UClientHandler | |
static const int | MAX_DATA_TRAPS = 100 |
Protected Types inherited from UClientPort | |
enum | { notLost, forReopen, rxError, txError } |
This is the shared resource class. It must enherit from the resource base class (or one of its decendent) as shown.
UResIf::UResIf | ( | const char * | aliasID | ) |
|
virtual |
Destructor
|
inline |
Get name associated to binary data
References UClientHandler::binTagName.
Referenced by UFunctionIf::handleIf().
|
inline |
Get status of data as binary
References UClientHandler::binData.
Referenced by UFunctionIf::handleIf().
|
protectedvirtual |
Connection status is changed
Reimplemented from UClientHandler.
References UVariable::add(), aliveTime, aliveTimeSend, connectedTime, UClientHandler::connectionChange(), makeUpdateEvent, UTime::now(), UVariable::setDouble(), UVariable::setValued(), varConnected, varConnectedTime, and varConnectionCnt.
Referenced by connectionHangUp().
|
inline |
try to open connection
References UClientPort::connected, connectionChange(), createBaseVar(), interfaceAlive(), interfaceAliveTag(), interfaceTick(), quitRemoteEnd(), replayToTime(), UVariable::setBool(), and varConnected.
Referenced by UFunctionIf::handleIf().
|
protected |
Create the smrif related variables
References UResVarPool::addMethod(), UResVarPool::addVar(), UResVarPool::addVarA(), ifQuitOnClose, MAX_CLIENT_RX_BUFFER, varAliveLimit, varAliveReceived, varBinaryName, varBinaryValid, varConnected, varConnectedTime, varConnectionCnt, varExableXml, varHost, varHostAlive, varHostLoopAlive, varPort, varQuitOnClose, varRxBufSize, varRxBytes, varRxBytesPerSec, and varRxTimeout.
Referenced by connectionHangUp(), and UResIf().
|
inline |
Fixed name of this resource type
References aliasResID, and print().
Referenced by UFunctionIf::createResources(), and UResIf().
|
protectedvirtual |
Alive from other tags
Reimplemented from UClientHandler.
References aliveTime, and UTime::now().
Referenced by connectionHangUp().
|
protectedvirtual |
Alive tick from receives data loop
Reimplemented from UClientHandler.
References aliveTime, USmlTagIn::getAttDouble(), UTime::now(), UVariable::setValued(), and varHostLoopAlive.
Referenced by connectionHangUp().
|
protectedvirtual |
Time tick from receive data loop
Reimplemented from UClientHandler.
References absi(), aliasResID, aliveTime, aliveTimeSend, UClientHandler::binData, UClientHandler::binTagName, UClientHandler::closeConnection(), connectedTime, UVariable::getBool(), UClientPort::getHost(), UVariable::getInt(), UClientPort::getPort(), USmlSource::getRxDataBufferCnt(), UTime::getSec(), UTime::getTimePassed(), UVariable::getValued(), UVariable::getValues(), UClientPort::isConnected(), makeUpdateEvent, UClientHandler::MAX_BIN_NAME_LENGTH, UClientHandler::namespaceUse, UTime::now(), roundi(), UClientPort::rxByteCnt, rxByteSec, rxBytseSecCnt, UClientHandler::rxTimeoutMs, UClientPort::sendMsg(), UVariable::setBool(), UVariable::setDouble(), UVariable::setInt(), USmlSource::setRxDataBufferCnt(), UServerPush::setUpdated(), UVariable::setValued(), UClientHandler::tryHoldConnection, ULock::tryLock(), ULock::unlock(), varAliveLimit, varAliveReceived, varBinaryName, varBinaryValid, varConnected, varConnectedTime, varExableXml, varHostAlive, varHostLoopAlive, varRxBufSize, varRxBytes, varRxBytesPerSec, and varRxTimeout.
Referenced by connectionHangUp().
|
virtual |
The varPool has methods, and a call to one of these is needed. Do what is needed and return (a double sized) result in 'value' and return true if the method call is allowed. The 'paramOrder' indicates the valid parameters d, s or c for double, string or class that is available as input values for the call. If the returnStruct and returnStructCnt is not NULL, then a number (no more than initial value of returnStructCnt) of structures based on UDataBase may be returned into returnStruct array of pointers. The returnStructCnt should be modified to the actual number of used pointers (if needed).
Reimplemented from UResVarPool.
References UClientPort::sendWithLock().
Referenced by snprint().
|
inline |
try to open connection
References UVariable::getInt(), UVariable::getString(), UClientHandler::setHost(), UVariable::setInt(), UClientHandler::setPort(), UVariable::setValues(), varConnected, varHost, and varPort.
Referenced by UFunctionIf::handleIf().
|
virtual |
print status to a string buffer
Reimplemented from UResVarPool.
References UClientHandler::snprint().
Referenced by getResID(), and snprint().
void UResIf::quitRemoteEnd | ( | ) |
Send quit to remote end if this is a connected server that uses a namespace this is assumed to understand a quit command
References UVariable::getBool(), UClientPort::isConnected(), UClientPort::sendWithLock(), UClientHandler::serverNamespaceLevel, varQuitOnClose, and Wait().
Referenced by connectionHangUp(), and UFunctionIf::~UFunctionIf().
|
protectedvirtual |
Advance replay for this resources - if in replay mode - until just before this time
untilTime | advance with steps in logfile until this time is reached |
Reimplemented from UReplay.
References UTime::getMicrosec(), UTime::getSec(), UClientPort::isConnected(), UResBase::replay, replayTime, and UClientPort::sendWithLock().
Referenced by connectionHangUp().
|
inline |
Get timeout value for RX
References UClientHandler::rxTimeoutMs.
|
inline |
Set name associated to binary data
References UVariable::setValues(), and varBinaryName.
Referenced by UFunctionIf::handleIf().
|
inline |
Set status of data as binary
References UVariable::setValued(), and varBinaryValid.
Referenced by UFunctionIf::handleIf().
|
inline |
Set hostname to connect to
References UVariable::setValues(), and varHost.
|
inline |
Set port number to connect to
References UClientPort::port, UVariable::setInt(), and varPort.
|
inlinevirtual |
Set replay flag. replay actions is relayed to server in other end, if flag is true.
value | if true replay is enabled, and interface will respond to replay actions true |
References UTime::clear(), UResBase::replay, and replayTime.
Referenced by UFunctionIf::handleIf().
|
virtual |
Called by server core when new resources are available. return true is resouurce is used Save a pointer to the resource as needed.
Reimplemented from UResVarPool.
References UClientHandler::addFunction(), UCmdExe::getResClassID(), UResBase::isAlsoA(), UServerPush::setCmdExe(), and UResVarPool::setResource().
Referenced by snprint().
|
inlinevirtual |
Print status for this resource
References methodCall(), print(), and setResource().
Referenced by UFunctionIf::handleIf().
|
protected |
The alias name for this interface.
Referenced by getResID(), interfaceTick(), and UResIf().
|
protected |
Time last alive statement were received
Referenced by connectionChange(), interfaceAlive(), interfaceAliveTag(), and interfaceTick().
|
protected |
Time last alive statement were received
Referenced by connectionChange(), and interfaceTick().
|
protected |
time of last connect
Referenced by connectionChange(), and interfaceTick().
|
private |
flag to make an event a little while after connection is established
Referenced by connectionChange(), interfaceTick(), and UResIf().
|
staticprotected |
Referenced by UResIf().
|
protected |
Replay time used
Referenced by replayToTime(), and setReplay().
|
protected |
UTime last second.
Referenced by interfaceTick().
|
protected |
number of bytes at last sec time
Referenced by interfaceTick().
|
protected |
how long is the longest allowed pause before deemed dead
Referenced by createBaseVar(), and interfaceTick().
|
protected |
time since last alive message was received
Referenced by createBaseVar(), and interfaceTick().
|
protected |
binary alias name
Referenced by createBaseVar(), interfaceTick(), and setBinName().
|
protected |
data handled as binary
Referenced by createBaseVar(), interfaceTick(), and setBinNameValid().
|
protected |
Should interface try hold connection try hold the connection
Referenced by connectionChange(), connectionHangUp(), createBaseVar(), interfaceTick(), and openConnection().
|
protected |
length of last connection
Referenced by connectionChange(), createBaseVar(), and interfaceTick().
|
protected |
number of successful connections
Referenced by connectionChange(), and createBaseVar().
|
protected |
sent an alive test every second - if true
Referenced by createBaseVar(), and interfaceTick().
|
protected |
host name used when next connected
Referenced by createBaseVar(), openConnection(), and setHost().
|
protected |
sent an alive test every second - if true
Referenced by createBaseVar(), and interfaceTick().
|
protected |
time since last server loop
Referenced by createBaseVar(), interfaceAliveTag(), and interfaceTick().
|
protected |
portnumber when nex connected
Referenced by createBaseVar(), openConnection(), and setPort().
|
protected |
send quit on exit
Referenced by createBaseVar(), and quitRemoteEnd().
|
protected |
size of receive buffer
Referenced by createBaseVar(), and interfaceTick().
|
protected |
number of bytes received
Referenced by createBaseVar(), and interfaceTick().
|
protected |
number of bytes received each second
Referenced by createBaseVar(), and interfaceTick().
|
protected |
time to maximum wait for more data on receive - befor give-up or return.
Referenced by createBaseVar(), and interfaceTick().