MPIActionSource

Definition

typedef enum MPIActionSource {
	MPIActionSourceINVALID = -1,

	MPIActionSourceUSER,
	MPIActionSourceCONTROLLER,

	MPIActionSourceEND,
	MPIActionSourceFIRST = MPIActionSourceINVALID + 1
} MPIActionSource;

Change History: Added in the 03.04.00

Description

MPIActionSource is an enumeration that helps determine whether a non-idle axis and motion supervisor state was caused by an application on the host computer or by an action created by a controller event.

Idle states are not checked for the action source because the idle state is considered to be the "normal" state. If the state of an axis or motion supervisor is idle, then MPIStatus.actionSource will be set to MPIActionSourceCONTROLLER.

It is sometimes useful to know whether a non-idle state was caused by a controller event or host action. If the action source was the controller, the controller may be queried to find out what event caused the error state. In a multi-threaded or multi-process environment, it can also be useful to know if a another thread or process commanded an action that placed the motion supervisor or axis into a non-idle state.

MPIActionSourceUSER An application on the host computer commanded an action via mpiMotionAction that put the axis or motion supervisor into the current non-idle state.
MPIActionSourceCONTROLLER An event on the motion controller put the axis or motion supervisor into the current non-idle state.

Remarks

The MPIMotor object does not store information about action sources. Therefore, mpiMotorStatus will always set MPIStatus.actionSource to MPIActionSourceCONTROLLER.

Sample Code

MPIAxisStatus status;

   returnValue = mpiAxisStatus(axis, &status);
   msgCHECK(returnValue); 

   if (status.state != MPIStateIDLE)
   {
       switch(status.actionSource)
       {
           case MPIActionSourceUSER:
                printf("Action source was the host computer\n");
                break;
           case MPIActionSourceCONTROLLER:
                printf("Action source was the controller\n");
                break;
           default:
                printf("ERROR: The action source value is invalid.\n");
                break;
       }
   }

See Also

mpiAxisStatus | mpiMotionStatus | mpiMotionAction