/*-=-=-=-=-=-=-=-=-=-=-=- RCCL/RCI Notice of Copyright -=-=-=-=-=-=-=-=-=-=-*
 *									    *
 *	Copyright (C) 1991 by John E. Lloyd.				    *
 *									    *
 *	Information on copyright permissions, as well as a complete	    *
 *	disclaimer of warranty, is given in the file COPYRIGHT.		    *
 *									    *
 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#include "../h/rccl.h"
#include "../rccl/testSet.h"

ptMonitor (arg, mnp)
int arg;
MANIP *mnp;
{
	PT_BLK *cbk;
	MANIP *tmnp;

	if ((cbk = (PT_BLK*)getMemByAddr((void*)arg)) == NULL)
	 { rciAbort (0, "ptMonitor() -- can't get control block\n");
	 }

	if (cbk->com)
	 { tmnp = getManipByAddr (cbk->mnp);
	 }

	switch (cbk->com)
	 { case GET_ACTIVE_MOD:
	    { cbk->retval = getActiveMod(tmnp);
	      break;
	    }
	   case GET_ACTIVE_CART_VEL:
	    { getActiveCartVel (tmnp, &cbk->floatval[0], &cbk->floatval[1]);
	      break;
	    }
	   case GET_ACTIVE_CART_ACCEL:
	    { getActiveCartAccel (tmnp, &cbk->floatval[0], &cbk->floatval[1]);
	      break;
	    }
	   case GET_ACTIVE_JOINT_VEL:
	    { getActiveJointVel (tmnp, &cbk->jntsval);
	      break;
	    }
	   case GET_ACTIVE_JOINT_ACCEL:
	    { getActiveJointAccel (tmnp, &cbk->jntsval);
	      break;
	    }
	   case GET_ACTIVE_COMPLY:
	    { getActiveComply (tmnp, &cbk->ulongval[0], &cbk->forceval);
	      break;
	    }
	   case GET_ACTIVE_DIFF_LIMIT:
	    { getActiveDispLimit (tmnp, &cbk->ulongval[0], &cbk->diffval);
	      break;
	    }
	   case GET_ACTIVE_FORCE_LIMIT:
	    { getActiveForceLimit (tmnp, &cbk->ulongval[0], &cbk->forceval);
	      break;
	    }
	   case GET_ACTIVE_MOTION_COUNTS:
	    { getActiveMotionCounts(tmnp,&cbk->intval[0],&cbk->intval[1]);
	      break;
	    }
	   case GET_ACTIVE_COUNT:
	    { cbk->retval = getActiveCount (tmnp);
	      break;
	    }
	   case GET_ACTIVE_CONF:
	    { cbk->retval = getActiveConf (tmnp, cbk->strval);
	      break;
	    }
	   case GET_CART_VEL:
	    { getCartVel (tmnp, &cbk->floatval[0], &cbk->floatval[1]);
	      break;
	    }
	   case GET_CART_ACCEL:
	    { getCartAccel (tmnp, &cbk->floatval[0], &cbk->floatval[1]);
	      break;
	    }
	   case GET_JOINT_VEL:
	    { getJointVel (tmnp, &cbk->jntsval);
	      break;
	    }
	   case GET_JOINT_ACCEL:
	    { getJointAccel (tmnp, &cbk->jntsval);
	      break;
	    }
	   case GET_COMPLY:
	    { getComply (tmnp, &cbk->ulongval[0], &cbk->forceval);
	      break;
	    }
	   case GET_DEFAULT_CART_VEL:
	    { getDefaultCartVel (tmnp, &cbk->floatval[0], &cbk->floatval[1]);
	      break;
	    }
	   case GET_DEFAULT_JOINT_VEL:
	    { getDefaultJointVel (tmnp, &cbk->jntsval);
	      break;
	    }
	   case GET_JVEL_SCALE:
	    { cbk->floatval[0] = getJvelScale (tmnp);
	      break;
	    }
	   case GET_SPEED:
	    { cbk->floatval[0] = getSpeed (tmnp);
	      break;
	    }
	   case GET_ACCEL_SCALE:
	    { cbk->floatval[0] = getAccelScale (tmnp);
	      break;
	    }
	   case GET_MOTION_QUEUE_SIZE:
	    { cbk->retval = getMotionQueueSize (tmnp);
	      break;
	    }
	   case NUM_MOTIONS_QUEUED:
	    { cbk->retval = numMotionsQueued (tmnp);
	      break;
	    }
	   case GET_MOD:
	    { cbk->retval = getMod (tmnp);
	      break;
	    }
	   case RCCL_GET_OPTIONS:
	    { cbk->retval = rcclGetOptions(~0);
	      break;
	    }
	   case RCCL_PUT_OPTIONS:
	    { cbk->retval = rcclPutOptions (cbk->intval[0]);
	      break;
	    }
	   case RCCL_SET_OPTIONS:
	    { cbk->retval = rcclSetOptions (cbk->intval[0]);
	      break;
	    }
	   case RCCL_CLEAR_OPTIONS:
	    { cbk->retval = rcclClearOptions (cbk->intval[0]);
	      break;
	    }
	   case RCCL_GET_MODES:
	    { cbk->retval = rcclGetModes (tmnp, ~0);
	      break;
	    }
	   case RCCL_GET_ACTIVE_MODES:
	    { cbk->retval = rcclGetActiveModes (tmnp, ~0);
	      break;
	    }
	   case RCCL_PUT_MODES:
	    { cbk->retval = rcclPutModes (tmnp, cbk->intval[0]);
	      break;
	    }
	   case RCCL_SET_MODES:
	    { cbk->retval = rcclSetModes (tmnp, cbk->intval[0]);
	      break;
	    }
	   case RCCL_CLEAR_MODES:
	    { cbk->retval = rcclClearModes (tmnp, cbk->intval[0]);
	      break;
	    }
	 }
	cbk->com = 0;
}
