AURobotServers
4
|
#include <ulasersim.h>
Public Member Functions | |
virtual bool | changeMode (int scanangle, double resolution) |
virtual bool | getNewestData (ULaserData *dest, unsigned long lastSerial, int fake) |
virtual bool | isPortOpen () |
virtual bool | logSourceData (const char *data, int dataCnt) |
ULaserSim () | |
~ULaserSim () | |
Public Member Functions inherited from ULaserDevice | |
virtual void | callGotNewDataWithObject () |
virtual void | createBaseVars () |
unsigned int | getBad () |
char * | getDeviceName () |
int | getDeviceNum () |
UPosition | getDevicePos () |
UPosRot | getDevicePose () |
URotation | getDeviceRot () |
unsigned int | getGood () |
char * | getLogFileName (char *buffer, int bufferCnt) |
int | getLogInterval () |
bool | getLogUsedScans () |
int | getMaxMeasurements () |
bool | getMirror () |
double | getMsgRate () |
char * | getName () |
int | getScanAngle () |
double | getScanAngle (int measurement) |
double | getScanResolution () |
unsigned long | getSerial () |
void | gotNewScan (ULaserData *gotData) |
virtual bool | isLogFileOpen () |
virtual bool | isReplayDevice () |
bool | isRunning () |
bool | isSend () |
virtual bool | isVerbose () |
void | logFileClose () |
bool | logFileOpen () |
void | logThisScan (ULaserData *scan) |
void | openRequest (bool toOpen) |
void | print (char *preString) |
virtual const char * | print (const char *preString, char *buff, int buffCnt) |
void | send (char *msg) |
virtual void | setDeviceName (const char *device) |
void | setDeviceNum (int value) |
void | setDevicePose (UPosRot *newPose) |
void | setLogInterval (int value) |
void | setLogUsedScans (bool value) |
void | setMirror (bool value) |
void | setVarStructure (UVarPool *varStruct) |
void | setVerbose (bool value) |
bool | start () |
void | stop (bool justClosePort) |
void | threadRunLoop () |
ULaserDevice () | |
virtual | ~ULaserDevice () |
Public Member Functions inherited from UServerPush | |
int | addPushCommand (UServerInMsg *msg) |
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 () |
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 () |
virtual void | connectionChange (bool nowConnected) |
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 () |
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 void | closePort () |
virtual const char * | getNameFromDevice () |
virtual bool | openPort () |
virtual bool | receiveData () |
virtual bool | sendToDevice (const char *msg, int lng) |
virtual void | setCore (UCmdExe *pCore) |
Protected Member Functions inherited from ULaserDevice | |
virtual double | getDefaultDelay () |
void | getFakeScan (ULaserData *dest, unsigned long lastSerial, int fake, double fakeDt=0.2) |
void | updateScanData (UTime scanTime) |
Protected Member Functions inherited from UClientHandler | |
virtual void | interfaceAlive () |
virtual void | interfaceAliveTag (USmlTag *) |
virtual void | interfaceTick () |
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 () |
Additional Inherited Members | |
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 |
Static Public Attributes inherited from UClientHandler | |
static const int | MAX_DATA_TRAPS = 100 |
Protected Types inherited from UClientPort | |
enum | { notLost, forReopen, rxError, txError } |
Static Protected Attributes inherited from UClientHandler | |
static const int | MAX_BIN_NAME_LENGTH = 30 |
binary tag name More... | |
Class to connect to a simulated laserscanner
ULaserSim::ULaserSim | ( | ) |
Constructor
References UClientHandler::addFunction(), core, dataTime, MAX_NAME_LNG, ULaserDevice::maxValidRange, ULaserDevice::name, UClientHandler::namespaceUse, newData, UTime::Now(), repeatGetScan, rxSerial, scan, scanf, UClientFuncSimScan::setLaserData(), ULogFile::setLogName(), and sourceLogFile.
|
virtual |
Change scanner resolution mode. (modeAngleScan and angleResolution) Returns true if new resolution is implemented. If not open, then values are just saved
Reimplemented from ULaserDevice.
References ULaserDevice::angleResolution, ULaserDevice::getDeviceName(), and ULaserDevice::modeAngleScan.
Referenced by isPortOpen().
|
protectedvirtual |
Close serial port
Reimplemented from ULaserDevice.
References UClientHandler::closeConnection(), UClientPort::isConnected(), and UClientHandler::tryHoldConnection.
Referenced by isPortOpen().
|
protectedvirtual |
|
virtual |
Get newest available data to this destination structure. Returns true if data is available.
Reimplemented from ULaserDevice.
References ULaserData::copy(), ULaserDevice::datalogUsedScans, ULaserDevice::deviceNum, ULaserDevice::getFakeScan(), ULaserData::getSerial(), UClientPort::isConnected(), ULock::lock(), ULaserDevice::logThisScan(), ULaserDevice::mirrorData, repeatGetScan, scan, UClientPort::sendMsg(), ULaserData::setDeviceNum(), ULaserData::setMaxValidRange(), ULaserData::setMirror(), ULaserData::setSerial(), ULaserDevice::start(), ULock::unlock(), ULaserDevice::var, and Wait().
Referenced by isPortOpen().
|
inlinevirtual |
Is the port to the device open
Reimplemented from ULaserDevice.
References changeMode(), closePort(), USmlSource::data, USmlSource::dataCnt, getNameFromDevice(), getNewestData(), UClientPort::isConnected(), logSourceData(), openPort(), receiveData(), and sendToDevice().
|
virtual |
is called when new data is fetched. gives the possibility to log all received data.
data | is the string received - NULL teminated, but data may hold binary 0 too! |
dataCnt | is length of data |
Reimplemented from USmlSource.
References ULogFile::closeLog(), USmlSource::data, ULogFile::getF(), ULogFile::isOpen(), ULogFile::openLog(), sourceLogFile, and ULaserDevice::var.
Referenced by isPortOpen().
|
protectedvirtual |
Open serial post. Return true if open(ed)
Reimplemented from ULaserDevice.
References UClientHandler::closeConnection(), ULaserDevice::devName, UClientPort::isConnected(), UClientHandler::isThreadRunning(), mini(), UClientHandler::openConnection(), UClientHandler::setHost(), UClientHandler::setPort(), UClientHandler::start(), and UClientHandler::tryHoldConnection.
Referenced by isPortOpen().
|
protectedvirtual |
Receive data from device – called from device loop, should return as fast as possible after dooing the job, i.e. no blocking read. Should add number of good and bad blocks of data to statBadCnt and statGootcnt. Returns true if data received.
Reimplemented from ULaserDevice.
References dataTime, ULaserDevice::deviceNum, ULaserData::getSerial(), UTime::getTimePassed(), ULaserDevice::gotNewScan(), UClientPort::isConnected(), ULaserDevice::mirrorData, newData, UTime::Now(), rxSerial, scan, sendToDevice(), ULaserData::setDeviceNum(), ULaserData::setMaxValidRange(), ULaserData::setMirror(), ULaserData::setValid(), ULaserDevice::var, and Wait().
Referenced by isPortOpen().
|
protectedvirtual |
Send data to device. Sends 'lng' bytes from 'msg'. Data must be a zero-terminated string.
Reimplemented from ULaserDevice.
References UClientPort::blockSend(), and mini().
Referenced by isPortOpen(), and receiveData().
|
inlineprotectedvirtual |
set server core pointer - just a debug feature - I think)
Reimplemented from ULaserDevice.
|
protected |
server core pointer
Referenced by ULaserSim().
|
protected |
Time of last received data
Referenced by receiveData(), and ULaserSim().
|
protected |
New data received
Referenced by receiveData(), and ULaserSim().
|
protected |
Automatic repeat get scan
Referenced by getNewestData(), and ULaserSim().
|
protected |
Last received serial from simulator
Referenced by receiveData(), and ULaserSim().
|
protected |
latest data received from device
Referenced by getNewestData(), receiveData(), ULaserSim(), and ~ULaserSim().
|
protected |
Client data decoder for simulated laser scanner connection
Referenced by ULaserSim(), and ~ULaserSim().
|
protected |
potential logfile
Referenced by logSourceData(), and ULaserSim().