Beispiel #1
0
        /// <summary>
        /// Sends the given <see cref="ModelAction"/> output.
        /// </summary>
        public void SendModelOutput(ModelAction modelOutput)
        {
            lock (locker)
            {
                // Pre-filter incompatible types.
                if (modelOutput is null)
                {
                    throw new ArgumentNullException(nameof(modelOutput));
                }
                if (!ModelOutputs.Contains(modelOutput.GetType()))
                {
                    return;
                }

                Log.Debug(this, nameof(SendModelOutput) + ": " + modelOutput);
                string         serialized = modelOutput.Serialize();
                TorXakisAction output     = TorXakisAction.FromOutput(TorXakisModel.OutputChannel, serialized);
                Connector.SendOutput(output);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Handles the given <see cref="ModelAction"/> input.
        /// </summary>
        public void HandleModelInput(ModelAction modelInput)
        {
            lock (locker)
            {
                // Pre-filter incompatible types.
                if (modelInput is null)
                {
                    throw new ArgumentNullException(nameof(modelInput));
                }
                if (!ModelInputs.Contains(modelInput.GetType()))
                {
                    return;
                }

                Log.Debug(this, nameof(HandleModelInput) + ": " + modelInput);
                inputs.Enqueue(modelInput);

                // This must now be called manually from the thread that should perform the operations.
                //CheckSystems();
            }
        }