Beispiel #1
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="comm">Object implementing the <see cref="ICommunication"/> interface for talking to the brick</param>
		/// <param name="alwaysSendEvents">Send events when data changes, or at every poll</param>
		public Brick(ICommunication comm, bool alwaysSendEvents)
		{
			_directCommand = new DirectCommand(this);
			_systemCommand = new SystemCommand(this);
			_batchCommand = new Command(this);

			Buttons = new BrickButtons();

			_alwaysSendEvents = alwaysSendEvents;

			int index = 0;

			_comm = comm;
			_comm.ReportReceived += ReportReceived;

			Ports = new Dictionary<InputPort,Port>();

			foreach(InputPort i in Enum.GetValues(typeof(InputPort)))
			{
				Ports[i] = new Port
				{
					InputPort = i,
					Index = index++,
					Name = i.ToString(),
				};
			}
		}
Beispiel #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="comm">Object implementing the <see cref="ICommunication"/> interface for talking to the brick</param>
        /// <param name="alwaysSendEvents">Send events when data changes, or at every poll</param>
        public Brick(ICommunication comm, bool alwaysSendEvents)
        {
            _directCommand = new DirectCommand(this);
            _systemCommand = new SystemCommand(this);
            _batchCommand  = new Command(this);

            Buttons = new BrickButtons();

            _alwaysSendEvents = alwaysSendEvents;

            int index = 0;

            _comm = comm;
            _comm.ReportReceived += ReportReceived;

            Ports = new Dictionary <InputPort, Port>();

            foreach (InputPort i in Enum.GetValues(typeof(InputPort)))
            {
                Ports[i] = new Port
                {
                    InputPort = i,
                    Index     = index++,
                    Name      = i.ToString(),
                };
            }
        }