Index

ParameterSet Overview

  1. Basic Tests
  2. Compound tests
  3. Examples
  4. Notes

A ParameterSet is currently used in two places within the Event despatch configuration, i) In the event filter selection and ii) In Compound to select the interface actions. A ParameterSet consists of 1 or more tests that can be nested. Sample XML configuration is given (note for developers the internal structures are not XML).

Basic Tests

Within each test there are two values, the first is always given by name the second may be given by name or as an absolute value. The second value may be repeated to allow an implicit OR test, i.e. time is 1 minute or 6 minutes.

The test parameter types may be stated explicitly as int, float or string or it may be derived from the parameters. If the second parameter is provided as an explicit value then: i) if the content of the value is a decimal number then the test will use floating point tests, ii) if the content of the value is an integer string then the test will use integer tests iii) in all other cases it defaults to string comparison. Note a string test sees 012 and 12 as different whilst integer test will see them as identical.

Where multiple tests are given at a level then an implicit 'And' is performed. If multiple value elements are given then an implicit Or is performed

The following are examples given in XML notation. Note anything in [] brackets is optional, although at least one of value and param2 must be given.

Simplest test

, compare the contents of firstName with someValue or the contents of secondName.

            <testName [type='int|float|string'] name='firstName' value='someValue'|param2='secondName' /> 
        

Alternate compare the contents of firstName with someValue.

        <testName [type='int|float|string'] name='firstName'> 
             <value>someValue/>
        </testName>
        

Alternate compare the contents of firstName with secondName.

        <testName [type='int|float|string'] name='firstName'> 
             <param2>secondName/>
        </testName>
        

Compare the contents of firstName for match with 1 of a set of values, implicit Or.

        <testName [type='int|float|string'] name='firstName'> 
             <value>someValue/>
             <value>someValue/>
        </testName>
        
This could alternately be configured thus.
        <testOr>
            <testName [type='int|float|string'] name='firstName' value='someValue'/> 
            <testName [type='int|float|string'] name='firstName' value='someValue2'/> 
        </testOr>
        

Compare the contents of firstName for match with 1 of a set of values, implicit Or. In this case one value is provided explicitly and the other by name

        <testName [type='int|float|string'] name='firstName'> 
             <value>someValue/>
             <param2>secondName/>
        </testName>
        

testEq

This tests for equality between two values.

testNe

This tests for in-equality between two values.

testLe

This tests for the first value being less than or equal to the second value.

testLt

This tests for the first value being less than the second value.

testGe

This tests for the first value being greater than or equal to the second value.

testGt

This tests for the first value being greater than the second value.

testDiffGe

This tests for difference between the first and second value being greater than or equal to the diffValue. The test is (value1 - value2) >= diffValue

testDiffLe

This tests for difference between the first and second value being less than or equal to the diffValue. The test is (value1 - value2) <= diffValue

testAbsDiffGe

This tests for the magnitude of the difference between the first and second value being greater than or equal to the diffValue. The test is (value1 - value2) >= diffValue.

testAbsDiffLe

This tests for magnitude of the difference between the first and second value being less than or equal to the diffValue. The test is (value1 - value2) <= diffValue

Compound tests

The implicit AND is used when you provide multiple basic tests. The implicit OR is when you provide multiple values to compare against. To provide multiple values you need to specify the values in XML as multiple nested elements. The following lists explicit compound tests.

testOr

Explicit OR.

testAnd

Explicit AND.

Examples

        <eventInterface module='EventHandlers.EventMapper' name='EventMapper' category='debug'>
            <eventtype type="http://id.webbrick.co.uk/events/time/sunrise">
                <eventsource source="" >
                    <event>
                        <newEvent type="http://id.webbrick.co.uk/events/state" source="background">
                            <other_data val='/static/images/backgrounds/day.png' val2='22.0'/>
                        </newEvent>
                    </event>
                </eventsource>
            </eventtype>
        <eventInterface>
        
This is a sample for the event mapper it picks up the sunrise event and creates a new event when sunrise occurs. (This new event is used to update some data in the web server for the user interface). This example does not use the params filter.
        <eventInterface module='EventHandlers.EventMapper' name='EventMapper' category='debug'>
            <eventtype type="">
                <eventsource source="time/minute" >
                    <event>
                        <param>
                            <testEq name='minute' value='5' />
                        </param>
                        <newEvent type="http://id.webbrick.co.uk/events/state" source="background">
                            <other_data val='/static/images/backgrounds/day.png' val2='22.0'/>
                        </newEvent>
                    </event>
                </eventsource>
            </eventtype>
        <eventInterface>
        
This example looks for the minute event at 5 minutes past the hour.
            <params>
                <testEq name='timeStr' name2='actiontime' />
            </params>

        
This example is just the filter set and compares two named values.
            <params>
                <testEq name='timeStr' > <name2 >actiontime </name2 >
                </testEq>
            </params>

        
This is an alternative that uses the alternate form of the second value.

Notes