Hello good sirs. I'm currently working on a project where I'm simulating a patientmonitor. Im using background worker to update the values every second. I got a treshhold on the values receives, so lets say that pulse = 140, its > 120, so it sends an alarm message to the sentral. All this works, but the problem is that i keep on sending "alarm on" messages. How can i fix, so that if the value stays the same, it only sends one message?
Some of the code:
private int _pulse
public int Pulse { get { return _pulse; } set { _pulse = value; } }
public void Alarm()
{
MinMaxPulse= ("0-120");
string[] splittp = MinMaxPulse.Split('-');
int minpulse = Int32.Parse(splittp[0]);
int maxpulse = Int32.Parse(splittp[1]);
if (_pulse > maxpulse || _pulse < minpulse)
{
alarmPulse = true;
alarmPActive = true;
SendAlarmOnToSentral(Alarm.PULSE);
}
else
{
alarmPuls = false;
if (alarmPActive == true && alarmPulse == false)
{
SendAlarmStopToSentral(Alarm.PULSE);
alarmPactiv = false;
}
}
}
Regards, asotop