/// <summary> /// Initializes a new instance of the <see cref="Brick"/> class. /// </summary> /// <param name="communicationFactory">Object implementing the <see cref="ICommunicationFactory"/> interface.</param> /// <param name="fileProvider">Object implementing the <see cref="IFileProvider"/> interface.</param> /// <param name="alwaysSendEvents">Send events when data changes, or at every poll</param> public Brick(ICommunicationFactory communicationFactory, IFileProvider fileProvider, bool alwaysSendEvents = false) { DirectCommandFactory = new DirectCommandFactory(this); SystemCommandFactory = new SystemCommandFactory(this, fileProvider); BatchCommandFactory = new BatchCommandFactory(this); Buttons = new BrickButtons(); _communicationFactory = communicationFactory; _alwaysSendEvents = alwaysSendEvents; int index = 0; Ports = new Dictionary <InputPort, Port>(); foreach (InputPort i in Enum.GetValues(typeof(InputPort))) { Ports[i] = new Port { InputPort = i, Index = index++, Name = i.ToString(), }; } }
/// <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(), }; } }
/// <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(), }; } }