AURobotServers
4
|
#include <userverpush.h>
Public Member Functions | |
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 () |
Private Attributes | |
UResVarPool * | callImpl |
ULock | callLock |
UServerPushImplement * | cmdImpl |
UServerPushQueue | push |
int | updateCnt |
UServerPush::UServerPush | ( | ) |
Constructor
Referenced by UResKeep::createResources(), and UKeepItem::UKeepItem().
|
virtual |
Destructor
int UServerPush::addPushCommand | ( | UServerInMsg * | msg | ) |
Add a push command. A push command is typically triggered when a new data is available. number of affected push commands. 0 if command failed or no commands affected by a flush command.
References UServerPushElement::activeCall, UServerPushElement::activeCmd, UServerPushElement::clear(), UServerInMsg::client, UServerPushElement::countGoodTarget, UServerPushElement::countTotalTarget, UServerPushElement::functionIndex, USmlTagIn::getAttValue(), UServerPushElement::interval, MAX_MESSAGE_LENGTH_TO_CAM, UServerPushElement::nextExeTime, UTime::Now(), USmlTagIn::reset(), UServerInMsg::serverPushCommand, UServerPushElement::setCall(), UServerInMsg::setMessage(), UServerInMsg::tag, and UServerPushElement::toDo.
Referenced by UCamPush::addCamPushCommand(), UImgPush::addPoolPushCommand(), UFuncCron::handleCommand(), UFunctionIf::handleIfPush(), UFuncKeep::handleKeepPush(), UFunctionPoseHist::handlePoseHistPush(), UFuncRhdIf::handlePushCommand(), UFunctionLaser::handleScanPushCommand(), UFunctionSmrIf::handleSmrPush(), UFuncV360::handleV360Push(), UFunctionVarPool::handleVarPush(), and UResRuleState::run().
|
inlinevirtual |
Called from push structure to get push object followed by a call to 'gotNewData(object)'. Should be overwritten by push object holder.
Reimplemented in UFuncTOF, ULaserDevice, UFuncTOF, UResV360, UFuncPTgrey, UFuncKinect, UFuncPiCam, UImgPush, UCamPush, and UFuncStereo.
bool UServerPush::doPushCall | ( | UServerPushElement * | pe, |
const char * | value | ||
) |
do the push call called for by this push element. Update the push element after the call.
pe | the push element to implement call for. |
value | is the (optional) event value string to be used in the call |
References doPushCall().
Referenced by doPushCall().
void UServerPush::flushClientCmds | ( | int | clientIdx | ) |
Flush all pending commands from this client
|
inline |
get server core pointer (cmdExe)
|
inline |
Get number of active push commands
cmdCnt | is set to number of command-based commands |
callCnt | is set to number of call-based commands. |
Referenced by ULaserDevice::gotNewScan(), UFunctionCam::handleCamsGetCommand(), UFuncCron::handleCommand(), UFunctionIf::handleIfPush(), UFuncKeep::handleKeepPush(), UFunctionPoseHist::handlePoseHistPush(), UFuncRhdIf::handlePushCommand(), UFunctionLaser::handleScanPushCommand(), UFunctionSmrIf::handleSmrPush(), UFuncV360::handleV360Push(), and UFunctionVarPool::handleVarPush().
|
inline |
Get the camera push queue
Referenced by ULaserDevice::gotNewScan(), UFunctionImgPool::handleImageListCommand(), and UFunctionImgPool::handlePoolPushCommand().
|
inline |
Has the push function got a cmdExe pointer
Referenced by UResPoseHist::gotAllResources(), UResVarPool::gotAllResources(), UFuncPlugBasePush::handlePush(), UFunctionVarPool::handleVarPush(), and UResPoseHist::setResource().
void UServerPush::gotNewData | ( | void * | pData | ) |
A new image (push element) is received. should be called, when new data is available. The new data (structure/class etc.) is transferred by the pData pointer.
References UServerPushElement::activeCmd, UServerInMsg::client, UServerPushElement::events, UServerPushElement::functionIndex, UServerPushElement::interval, roundi(), UServerPushElement::toDo, and UServerPushElement::update().
Referenced by UFuncStereo::callGotNewDataWithObject(), UCamPush::callGotNewDataWithObject(), UImgPush::callGotNewDataWithObject(), UFuncPiCam::callGotNewDataWithObject(), UFuncKinect::callGotNewDataWithObject(), UFuncPTgrey::callGotNewDataWithObject(), UResV360::callGotNewDataWithObject(), ULaserDevice::callGotNewDataWithObject(), UFuncTOF::callGotNewDataWithObject(), and UCamPush::gotNewImage().
|
inline |
test if the object has had an update since last check
lastCnt | is the last saved count. |
newCnt | is where the new count is saved (if not NULL) returns true if the update count (updateCnt) is different from lastCnt |
Referenced by UResVarPool::isVarPoolUpdated().
bool UServerPush::needNewData | ( | ) |
A pretest when new data is available to request if it is needed, so that data extraction can be avoided if nothing is needed.
References UServerPushElement::activeCmd, UServerInMsg::client, UServerPushElement::events, UServerPushElement::interval, roundi(), and UServerPushElement::toDo.
Referenced by UCamPush::needNewPushData().
void UServerPush::print | ( | const char * | preString | ) |
Debug print of camera status
Referenced by UFuncCron::handleCommand(), UFuncKeep::handleKeepPush(), UFuncPlugBasePush::handlePush(), UFunctionVarPool::handleVarPush(), UCamPush::print(), and UResRuleState::UResRuleState().
void UServerPush::print | ( | const char * | preString, |
char * | buff, | ||
int | buffCnt | ||
) |
Debug print of camera status to a string buffer.
|
inline |
Test for push (just a more appropriate name for the call)
|
inline |
Set command executor reference for push functions (same as setImplementor())
Referenced by ULaserPool::addDevice(), UResKeep::createResources(), UCamPool::findDevices(), UImagePool::getImage(), UFunctionVarPool::handleVarPush(), UCamPool::makeDevice(), UResIf::setResource(), UResPoseHist::setResource(), UResCamIf::setResource(), UResLaserIf::setResource(), UResSmrIf::setResource(), and UCamPool::setResource().
|
inline |
Set command executor reference for push functions (same as setCmdExe())
Referenced by UKeepItem::setCore().
bool UServerPush::setResource | ( | UResBase * | resource, |
bool | remove | ||
) |
Called when a new resource is available (or is removed), local pointers to the resource should be updated as appropriate.
References UResVarPool::getResClassID(), UResBase::isA(), and UResBase::isAlsoA().
Referenced by UFuncPlugBasePush::setResource(), UResV360::setResource(), and UResRuleState::setResource().
bool UServerPush::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.
Referenced by UResPoseHist::addPoseHist(), UVarPool::addStruct(), UVarPool::addStructLink(), UVarPool::addStructLocal(), UFuncKinect::callGotNewDataWithObject(), UResCamIf::connectionChange(), UResLaserIf::connectionChange(), UResSmrIf::connectionChange(), UFuncKinect::decodeReplayLine(), ULaserDevice::gotNewScan(), UImgPush::imgUpdated(), UCamPush::imgUpdated(), UResIf::interfaceTick(), UFuncKinect::processDepthImages(), UFuncStereo::processImages(), UFuncPiCam::run(), UResRuleState::run(), UVarPool::setLocalVar(), UVarPool::setLocalVar3D(), UVarPool::setLocalVar6D(), UVarPool::setLocalVarAdd(), UVarPool::setLocalVarRot(), UVariable::setUpdated(), UKeepItem::tick(), UResRhdIf::tryConnect(), and UResV360::update().
|
private |
pointer to a varpool resource for push-calls
|
private |
Lock, to ensure that an update call triggers this update again - that is endless loop detection. This is done by a lock, if not lockable, then no calls are performed.
|
private |
Pointer to push server queue
|
private |
push queue when new push data gets available
|
private |
this variable is incremented on every call to setUpdated(), and can be used to test for potential new values by others than the push command handler.