Beispiel #1
0
        public void ActionFinished(Action action)
        {
            this.Log(LogLevel.Info, LogSource.Action, action + " finished");

            // you cannot continue resoning here as action has to be executed with VIEW agent
            var item = currentItem;

            currentItem   = null;
            currentAction = null;

            if (this.workQueue.Count == 0 && item.Sensor == Sensor.Schedule)
            {
                this.Sense(item);
            }
        }
Beispiel #2
0
        private Action ExecuteAction(SensorData data)
        {
            if (actions.Length == 0)
            {
                throw new Exception("ERROR: " + this.name + " has no action sets!");
            }

            // find the action
            var action = actions.FirstOrDefault(w => w.sensor == data.Sensor && w.sensorRequest == data.SensorRequest);

            if (action == null)
            {
                throw new Exception(string.Format("ERROR: {0}'s action for '{1}: {2}' does no exist", name, data.Sensor, data.SensorRequest));
            }

            this.currentItem   = data;
            this.currentAction = action;

            return(action);
        }