Ticket #435: rules.yaml

File rules.yaml, 4.0 KB (added by MadHatter, 3 years ago)

OM2009T4 rules.yaml

Line 
1
2# This file is in YAML format (http://www.yaml.org/)
3# We define a list of rules that will be automatically loaded
4# When we start the oevents module of the framework daemon
5#
6# The attributes of a rule are :
7# - trigger     : trigger object
8# - filters     : filters object or list of filters objects
9# - actions     : action object or list of actions objects
10#
11# We define the following functions :
12# - CallStatus()            : create a trigger object activated on a call status event
13# - PowerStatus()           : create a trigger object activated on a power status event
14# - HasAttr(name, value)    : create a filter that accept signal with a given attribute
15# - Not(filter)             : create a neg filter
16# - PlaySound(file)         : Action that starts to play an audio file
17# - StopSound(file)         : Action that stop an audio file
18# - SetScenario(name)       : Action that sets an audio scenario
19# - StartVibration
20# - StopVibration
21# - RingTone(cmd)           : cmd can be 'start' or 'stop'
22# - Time(hour, min)         : create a trigger activated at the given time
23# - Debug(msg)              : Action that prints a debug message (only for debuging)
24-
25    #
26    # Suspend Handling
27    #
28    trigger: InputEvent()
29    filters:
30             - HasAttr(switch, "POWER")
31             - HasAttr(event, "released")
32             - HasAttr(duration, 0)
33             - Not(CallListContains("active"))
34             - Not(CallListContains("incoming"))
35    actions: Suspend()
36-
37    #
38    # Power button Handling
39    #
40    trigger: InputEvent()
41    filters:
42             - HasAttr(switch, "POWER")
43             - HasAttr(event, "held")
44             - HasAttr(duration, 2)
45    actions: Command('poweroff')
46-
47    while: CallListContains("incoming")
48    filters: Not(CallListContains("active"))
49    actions:
50             - SetDisplayBrightness("0", 90)
51             - OccupyResource(CPU)
52
53-
54    while: CallStatus()
55    filters:
56            - Or(HasAttr(status, "outgoing"), HasAttr(status, "active"))
57            - Not(BTHeadsetIsConnected())
58    actions:
59            - SetScenario(gsmhandset)
60            - OccupyResource(CPU)
61
62-
63    while: CallStatus()
64    filters:
65            - Or(HasAttr(status, "outgoing"), HasAttr(status, "active"))
66            - BTHeadsetIsConnected()
67    actions:
68            - SetScenario(gsmbluetooth)
69            - BTHeadsetPlaying()
70            - OccupyResource(CPU)
71
72-
73    while: PowerStatus()
74    filters: HasAttr(status, "charging")
75    actions: SetLed("gta02_power_orange", "light")
76
77-
78   while: PowerStatus()
79   filters: Not(HasAttr(status, "discharging"))
80   actions: OccupyResource(Display)
81-
82    while: PowerStatus()
83    filters: HasAttr(status, "critical")
84    actions: SetLed("gta02_power_orange", "blink")
85-
86    while: PowerStatus()
87    filters: HasAttr(status, "full")
88    actions: SetLed("gta02_power_blue", "light")
89-
90    trigger: PowerStatus()
91    filters: HasAttr(status, "empty")
92    actions: Command('poweroff')
93
94    #
95    # Headset Audio Scenario Support
96    #
97-
98    trigger: InputEvent()
99    filters:
100             - HasAttr(switch, "HEADSET")
101             - HasAttr(event, "pressed")
102    actions: Command('amixer -d sset "Amp Spk" mute')
103-
104    trigger: InputEvent()
105    filters:
106             - HasAttr(switch, "HEADSET")
107             - HasAttr(event, "released")
108    actions: Command('amixer -d sset "Amp Spk" unmute')
109
110    #
111    # Idleness Brightness Handling
112    #
113    trigger: IdleState()
114    filters: HasAttr(status, "busy")
115    actions:
116             - SetDisplayBrightness("0", 100)
117             - Command( "xset -display localhost:0 s off" )
118-
119    trigger: IdleState()
120    filters: HasAttr(status, "idle_dim")
121    actions: SetDisplayBrightness("0", 20)
122-
123    trigger: IdleState()
124    filters: HasAttr(status, "idle_prelock")
125    actions:
126             - SetDisplayBrightness("0", 0)
127             - Command( "xset -display localhost:0 s blank" )
128             - Command( "xset -display localhost:0 s activate" )
129-
130    trigger: IdleState()
131    filters: HasAttr(status, "suspend")
132    actions: Suspend()