libinco_32
 All Files Functions Enumerations Enumerator Macros Modules Pages
Use case: INCO procedure with asynchronous part

INOS code

The following INCO function (MoveXAxis) "just" puts a message into the tasks message queue. Later, when the message will be 'dispatched' by the task, it'll actually perform an axis Move (iMoveXAxis). The function does not return any results (except the INOS_MCMSG_CODE_MYMODULE_MOVEXAXIS_FAILED application error in case the move fails).

CMcResult CMyModule::MoveXAxis(double arAxisPosition)
{
CINOSTaskExMsg* msg = new CINOSTaskExMsg(eMsgCmd, CmdMoveXAxis, apSync);
msg->AddParam(arAxisPosition);
return PutMsg(msg);
}
//------------------------------------------------------------------------------
void CMyModule::iMoveXAxis(CINOSTaskExMsg* apMsg)
{
real64 rAxisPosition = apMsg->GetParam<real64>();
...
// move axis and wait until move finishs
if( pAxis->Move(rAxisPosition, DF_INOS_SYNCHRONOUS) == 0 ) {
// success
MsgDone(apMsg);
} else {
MsgDone(apMsg, CINOSTaskEx::eRplError, INOS_MCMSG_CODE_MYMODULE_MOVEXAXIS_FAILED);
}
}

PC code

Correct usage

Strange (but valid) usage

Forbidden/invalid usage


Generated by doxygen 1.8.8