mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-20 18:32:09 +00:00
Filter duplicate clears
This commit is contained in:
parent
c49f244ca2
commit
d0cc16935b
2 changed files with 14 additions and 0 deletions
|
@ -2,8 +2,10 @@
|
|||
|
||||
* EcAlarmDestination.h:
|
||||
* EcAlarmDestination.m:
|
||||
* EcControl.m:
|
||||
Add (-latest:) method to find the most recent match for an alarm
|
||||
in the queue/active/cleared data structures.
|
||||
Use it to filter out duplicate clears.
|
||||
|
||||
2021-12-16 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
12
EcControl.m
12
EcControl.m
|
@ -403,6 +403,7 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
- (oneway void) alarm: (in bycopy EcAlarm*)alarm
|
||||
{
|
||||
EcAlarmSeverity severity;
|
||||
EcAlarm *old;
|
||||
NSString *desc;
|
||||
NSRange range;
|
||||
|
||||
|
@ -415,6 +416,17 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
}
|
||||
|
||||
severity = [alarm perceivedSeverity];
|
||||
|
||||
old = [sink latest: alarm];
|
||||
if (old)
|
||||
{
|
||||
if (EcAlarmSeverityCleared == severity
|
||||
&& [old perceivedSeverity] == severity)
|
||||
{
|
||||
return; // Duplicate clear ignored.
|
||||
}
|
||||
}
|
||||
|
||||
desc = [alarm description];
|
||||
|
||||
/* A local copy of an alarm will have an address differing from that of the
|
||||
|
|
Loading…
Reference in a new issue