Legrand / Raritan / Server Technology Xerus™ JSON-RPC API

Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
event::Engine Interface Reference

There is a single event engine instance reachable by a well known reference. More...

## Classes
struct | Action
| An action is a tuple of 'id' (unique within the scope of this event engine), 'name' which is unique as well and used by the GUI as user readable identificator, 'isSystem' which denotes the action as system action, 'type' which defines what it is, and an argument vector that vary depending on type and which is passed to the action. More...
struct | Condition
| Condition is a logical combination of multiple events. More...
struct | EventDesc
| An event descriptor. More...
struct | Rule
| A Rule binds an action to a condition. More...

## Public Member Functions
int | listEventDescs (in vector< string > eventIdPrefix, out vector< EventDesc > eventDescs)
| Query existing event descriptors.
vector< string > | listActionTypes ()
| List all available action types.
int | addAction (in Action action, out string actionId)
| Add a new action.
int | modifyAction (in Action action)
| Modify an action.
int | deleteAction (in string actionId)
| Remove an action.
vector< Action > | listActions ()
| List all actions currently know to this event engine.
int | triggerAction (in string actionId, out string errMsg, in vector< KeyValue > context)
| Trigger an action.
int | testAction (in Action action, out string errMsg, in vector< KeyValue > context)
| Test an action.
int | addRule (in Rule rule, out string ruleId)
| Add a new rule.
int | modifyRule (in Rule rule)
| Modify a rule.
int | enableRule (in string ruleId)
| Enable a rule.
int | disableRule (in string ruleId)
| Disable a rule.
int | deleteRule (in string ruleId)
| Delete a rule.
vector< Rule > | listRules ()
| List all rules.
int | deliverEvent (in Event event)
| Deliver an event.
int | rearmRule (in string ruleId)
| Rearm an event rule that is active.

## Detailed Description

There is a single event engine instance reachable by a well known reference.

Definition at line 53 of file EventEngine.idl.

## Member Function Documentation

## ◆ addAction()

int event::Engine::addAction | ( | in Action | action,
|  | out string | actionId
| ) |  |

Add a new action.

The id and isSystem fields are ignored. The actions's id field is allocated automatically and returned in the actionId parameter.

Returns
  0 if OK
  1 if the name of the new action already exists
  2 if generating the action id failed
  3 if the maximum number of actions have been created

## ◆ addRule()

int event::Engine::addRule | ( | in Rule | rule,
|  | out string | ruleId
| ) |  |

Add a new rule.

The id, hasMatched and isSystem fields are ignored. The rule's id field is allocated automatically and returned in the the ruleId parameter.

Returns
  0 if OK
  1 if the name of the new rule already exists
  2 if generating the rule id failed
  3 if the rule condition contains an invalid event id
  4 if the maximum number of rules have been created
  5 if the maximum number of actions per rule is exceeded

## ◆ deleteAction()

int event::Engine::deleteAction | ( | in string | actionId | ) |

Remove an action.

Returns
  0 if OK
  1 if id is unknown
  2 if the action is not deletable

## ◆ deleteRule()

int event::Engine::deleteRule | ( | in string | ruleId | ) |

Delete a rule.

Returns
  0 if OK
  1 if ruleId is unknown
  2 if the rule is not deletable

## ◆ deliverEvent()

int event::Engine::deliverEvent | ( | in Event | event | ) |

Deliver an event.

Returns
  0 if OK
  1 if event is unknown

## ◆ disableRule()

int event::Engine::disableRule | ( | in string | ruleId | ) |

Disable a rule.

A disabled rule will be ignored when processing events.

Returns
  0 if OK
  1 if ruleId is unknown

## ◆ enableRule()

int event::Engine::enableRule | ( | in string | ruleId | ) |

Enable a rule.

An enabled rule will be evaluated when processing events.

Returns
  0 if OK
  1 if id is unknown

## ◆ listActionTypes()

vector< string > event::Engine::listActionTypes | ( |  | ) |

List all available action types.

The action type is intentionally defined generically so that implementation can be extensible without changing interface.

## ◆ listEventDescs()

int event::Engine::listEventDescs | ( | in vector< string > | eventIdPrefix,
|  | out vector< EventDesc > | eventDescs
| ) |  |

Query existing event descriptors.

Returns
  0 if OK
  1 if id was not found

## ◆ listRules()

vector< Rule > event::Engine::listRules | ( |  | ) |

List all rules.

Question: will number of rules be small enough to list them all in a single operation. A single Rule may be quite large... See below for alternative interface using iterator.

## ◆ modifyAction()

int event::Engine::modifyAction | ( | in Action | action | ) |

Modify an action.

Returns
  0 if OK
  1 if the name of the new action already exists
  2 if the action id does not exist

## ◆ modifyRule()

int event::Engine::modifyRule | ( | in Rule | rule | ) |

Modify a rule.

The hasMatched and isSystem fields are ignored.

Returns
  0 if OK
  1 if the name of the new rule already exists
  2 if the rule id does not exist
  3 if the rule condition contains an invalid event id
  4 if the maximum number of actions per rule is exceeded

## ◆ rearmRule()

int event::Engine::rearmRule | ( | in string | ruleId | ) |

Rearm an event rule that is active.

Once a Rule triggers its actions it is done once. If the condition of the rules becomes false and back again true, no action will be performed unless the rule is rearmed. Rules may be auto-rearmed what means whenever the rule's conditions changes from false to true actions are triggered over and again.

Returns
  0 if OK
  1 if the rule is unknown
  2 if the rule is not enabled

## ◆ testAction()

int event::Engine::testAction | ( | in Action | action,
|  | out string | errMsg,
|  | in vector< KeyValue > | context
| ) |  |

Test an action.

This is similar to `triggerAction`, except that an action that is not yet saved can be passed in. Therefore this method can be used for testing actions to be newly created. The operation will block until the action has been performed or an error occurred. In the latter case errMsg will contain an error message. The context is passed to the actions.

NOTE: Currently this function doesn't block!

Returns
  0 if OK
  1 if the action name is invalid
  2 if no actor was found for the action
  3 if performing the action failed, errmsg will be set

## ◆ triggerAction()

int event::Engine::triggerAction | ( | in string | actionId,
|  | out string | errMsg,
|  | in vector< KeyValue > | context
| ) |  |

Trigger an action.

This is mainly used for test and debugging. The operation will block until the action has been performed or an error occurred. In the latter case errMsg will contain an error message. The context is passed to the actions.

NOTE: Currently this function doesn't block!

Returns
  0 if OK
  1 if id is unknown
  2 if no actor was found for the action
  3 if performing the action failed, errmsg will be set

The documentation for this interface was generated from the following file:

- EventEngine.idl