AlarmScreenNg 0.9.6
|
In some cases the list of possible values (strings) for particular alarm property is fixed, and can be even known in advance. The individual filter for such property can use apriori known list of possible values in two ways:
In either case, for this to work, the filter widget shal know possible values for this particular alarm property. In sumple cases list of possible values can be just hardcoded in plugin that builds widgets for structured filter (see FilterWidget). Example can be a boolean property with possible values YES/NO.
However, there are cases where list of possible values is not known until runtime. The example of such list is JCOP device types, which can differ from one project to another. In order to support building completions list at run time, AS EWO uses dedicated items in basic configuration. This sections of document describes briefly the way filter completers can be built at run time.
There are two major types of filter completers, which affect the way the lists for completion shall be built:
The basic configuration contains different CTRL functions for building the lists of possible values for these two types of completers. The functions are supposed to be written in CTRL language and placed in some CTRL library (the name of library is also a part of configuration). These CTRL functions will be called directly from C++ code of AS EWO when EWO needs to build a completions list for certain filter. One can not expect that functions will be called only once (for example, when UI start) - they can be called at any moment during EWO's lifecycle.
The following secions describe API and expected functionalify for these two functions. There are constants AS_FILTER_COMPLETION_KEY_xxx
declared in CTRL library AlarmScreenNg.ctl and enum FilterCompletionsType
declared in the same library.
The CTRL function to get a list of possible completions for master completer must have the following signature:
Two arguments are passed to this functions:
The function must return mapping
with the following keys of type string
(see constants AS_FILTER_COMPLETION_KEY_xxx
declared in CTRL library AlarmScreenNg.ctl):
int
containing the type of result, see enum FilterCompletionsType
declared in the same CTRL library. This key must always be present in returned result, it determines what other keys are expected to appear in returned mapping
and how AS EWO shall interpet the values for those other keys. dyn_string
. This key in mapping must be present for two possible values of type member, but content and interpretation of result by AS EWO are completely different for these cases: mapping
is Static (value 1), then the list is intepreted as ready to use list of completions for filter widget. mapping
is Dynamic (value 2), then the returned value is interpred as 'in order to find completions for filter on this property, I need to know seeting(s) of filter(s) for other properties'. The returned strings are interpreted by AS EWO as names of other alarm properties, whose filter settings are required to find the result. In such case AS EWO will call another function with settings for requested filter(s). mapping
; this key is expected in result of function call if type member of mapping
is SysRelated (value 3). The mapping
is expected to contain: string
s: names of systems dyn_string
: list of completions that shall be shown when this system is connected mapping
is None (value 0), then other keys are ignored by AS EWO, even if they are present in returned result.The CTRL function to get a list of possible completions for slave completer must have the following signature:
Two arguments are passed to this function:
mappng
contains: string
with the name of alarm property that was returned by previous functions as a name of master. string
with current value of filter for this property mapping
are not empty. The AS EWO just passes to this function all the information it knows at this moment, then it is responsability of this function to decide what to do with (potentially) incomplete input argument. The mapping
, returned by this function, must containe the only key of type string
: list. The value for this key must be dyn_string
, containing possible completions for filter.