コード例 #1
0
        public override void TimerCallback(object state)
        {
            Debug.Print("Temperature Callback");
            TempData tempData = new TempData();

            // get current temperature
            tempData.SetValue(CalculateTemperature());

            Debug.Print("Temperature = " + tempData.GetValue().ToString());
            //Timer Callbacks receive a Delegate in the state object
            InputDataAvailable ida = (InputDataAvailable)state;

            // call out to the delegate with expected value
            ida(tempData);
        }
コード例 #2
0
        public override void TimerCallback(object state)
        {
            Debug.Print("pH Callback");
            AlkalinityData phData = new AlkalinityData();

            // get current pH Value
            phData.SetValue(CalculatePH());
            Debug.Print("pH = " + phData.GetValue().ToString("F"));

            //Timer Callbacks receive a Delegate in the state object
            InputDataAvailable ida = (InputDataAvailable)state;

            // call out to the delegate with expected value
            // TODO: Currently there is a glitch with SerialPort and
            // sometimes data doesn't come back from the Stamp.
            // Discard bad readings, and report any meaningful ones
            if (phData.GetValue() > 0.0F)
            {
                ida(phData);
            }
        }
コード例 #3
0
        public override void TimerCallback(object state)
        {
            Debug.Print("ElectricalConductivity Callback");
            ElectricalConductivityData ECData = new ElectricalConductivityData();

            // get current ElectricalConductivity Value
            ECData.SetValue(GetPPM());
            Debug.Print("ElectricalConductivity = " + ECData.GetValue().ToString("F"));

            //Timer Callbacks receive a Delegate in the state object
            InputDataAvailable ida = (InputDataAvailable)state;

            // call out to the delegate with expected value
            // TODO: Currently there is a glitch with SerialPort and
            // sometimes data doesn't come back from the Stamp.
            // Discard bad readings, and report any meaningful ones
            if (ECData.GetValue() > 0.0F)
            {
                ida(ECData);
            }
        }