Exemplo n.º 1
0
        public DeviceSimulator(IMonitoringHubCommunication gatewayCommunication, bool produceRandomInputValues)
        {
            Randomize = produceRandomInputValues;

            for (int i = 0; i < NumberOfInputs; i++)
            {
                this.Inputs.Add(new DeviceSimulatorInput(i));
                Inputs[i].InputChanged += gatewayCommunication.UpdateSingleInputState;
            }

            for (int i = 0; i < NumberOfInputs; i++)
            {
                this.Outputs.Add(new DeviceSimulatorOutput(i));
                Outputs[i].OutputChanged += gatewayCommunication.UpdateSingleOutputState;
            }
        }
Exemplo n.º 2
0
        public PiFaceDevice(IMonitoringHubCommunication gatewayCommunication)
        {
            GatewayCommunication = gatewayCommunication;
            for (int i = 0; i < NumberOfInputs; i++)
            {
                this.Inputs.Add(new PiFaceInput(i));
                Inputs[i].InputChanged += GatewayCommunication.UpdateSingleInputState;
            }

            for (int i = 0; i < NumberOfOutputs; i++)
            {
                this.Outputs.Add(new PiFaceOutput(i));
                Outputs[i].OutputChanged += GatewayCommunication.UpdateSingleOutputState;
                Outputs[i].OutputChanged += PiFaceIOcommands.WriteOutput;
            }

            InitPiFace();
        }