Exemplo n.º 1
0
        public void StopSensing()
        {
            if (!IsSensing() || sensorValues != null)
            {
                throw new NxtControlException(Name, "Could not stop sensing: no event-driven sensing task started or incompatible list of sensor values storing task in progress");
            }

            cancellation.Cancel();
            SensorPoller.Wait(TimeResolution.Add(TimeResolution));
            SensorPoller = null;
        }
Exemplo n.º 2
0
        public IList <TSensorValue> StopGettingValues()
        {
            if (!IsSensing() || sensorValues == null)
            {
                throw new NxtControlException(Name, "Could not stop getting: no list of sensor values being stored or incompatible event-driven sensing task in progress");
            }

            cancellation.Cancel();
            SensorPoller.Wait(TimeResolution.Add(TimeResolution));
            SensorPoller = null;

            var retValues = sensorValues;

            sensorValues = null;
            return(retValues);
        }