public IEnumerator <ITask> WaitHandler(Wait wait) { // Create a variable to hold the completion status drive.DriveStage result = drive.DriveStage.InitialRequest; // Wait until the next Canceled or Completed notification // NOTE: There is no guarantee that the notification is the result // of a particular drive motion request, but it drive requests are // always paired with Waits then this should be the case. yield return((Receiver <drive.DriveStage>) Arbiter.Receive(false, completionPort, delegate(drive.DriveStage status) { result = status; })); // Make a new state and send it to ourselves as a Replace message // This will force a notification out to subscribers WaitForDriveCompletionState body = new WaitForDriveCompletionState(); body.LastStatus = result; _mainPort.Post(new Replace(body)); // Finally, send back the response message so that the caller // can now continue wait.ResponsePort.Post(new WaitResponseType(result)); yield break; }
/// <summary> /// Constructor /// </summary> /// <param name="result"></param> public WaitResponseType(drive.DriveStage result) { _driveStatus = result; }