public float get() { bool flag = false; float retvalue = 0.0f; Arbiter.Activate(DssEnvironment.TaskQueue, Arbiter.Receive <sonar.SonarState>(false, sensorPort.Get(), delegate(sonar.SonarState state) { retvalue = (float)state.DistanceMeasurement; flag = true; } )); while (!flag) { ; } return(retvalue); }
IEnumerator <ITask> UpdateSonar() { var sensorOrFault = _simulatedSonarServicePort.Get(); yield return(sensorOrFault.Choice()); if (!HasError(sensorOrFault)) { sonar.SonarState sensorState = (sonar.SonarState)sensorOrFault; WinFormsServicePort.Post(new FormInvoke(() => { _imageProcessingForm.SetSonarReadingValue(sensorState.DistanceMeasurement); })); } yield break; }