| 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 | |
|---|
| 52 | - |
|---|
| 53 | while: CallStatus() |
|---|
| 54 | filters: |
|---|
| 55 | - Or(HasAttr(status, "outgoing"), HasAttr(status, "active")) |
|---|
| 56 | - Not(BTHeadsetIsConnected()) |
|---|
| 57 | actions: |
|---|
| 58 | - SetScenario(gsmhandset) |
|---|
| 59 | - OccupyResource(CPU) |
|---|
| 60 | |
|---|
| 61 | - |
|---|
| 62 | while: CallStatus() |
|---|
| 63 | filters: |
|---|
| 64 | - Or(HasAttr(status, "outgoing"), HasAttr(status, "active")) |
|---|
| 65 | - BTHeadsetIsConnected() |
|---|
| 66 | actions: |
|---|
| 67 | - SetScenario(gsmbluetooth) |
|---|
| 68 | - BTHeadsetPlaying() |
|---|
| 69 | - OccupyResource(CPU) |
|---|
| 70 | |
|---|
| 71 | - |
|---|
| 72 | while: PowerStatus() |
|---|
| 73 | filters: HasAttr(status, "charging") |
|---|
| 74 | actions: SetLed("gta02_power_orange", "light") |
|---|
| 75 | |
|---|
| 76 | - |
|---|
| 77 | while: PowerStatus() |
|---|
| 78 | filters: Not(HasAttr(status, "discharging")) |
|---|
| 79 | actions: OccupyResource(Display) |
|---|
| 80 | - |
|---|
| 81 | while: PowerStatus() |
|---|
| 82 | filters: HasAttr(status, "critical") |
|---|
| 83 | actions: SetLed("gta02_power_orange", "blink") |
|---|
| 84 | - |
|---|
| 85 | while: PowerStatus() |
|---|
| 86 | filters: HasAttr(status, "full") |
|---|
| 87 | actions: SetLed("gta02_power_blue", "light") |
|---|
| 88 | - |
|---|
| 89 | trigger: PowerStatus() |
|---|
| 90 | filters: HasAttr(status, "empty") |
|---|
| 91 | actions: Command('poweroff') |
|---|
| 92 | |
|---|
| 93 | # |
|---|
| 94 | # Headset Audio Scenario Support |
|---|
| 95 | # |
|---|
| 96 | - |
|---|
| 97 | trigger: InputEvent() |
|---|
| 98 | filters: |
|---|
| 99 | - HasAttr(switch, "HEADSET") |
|---|
| 100 | - HasAttr(event, "pressed") |
|---|
| 101 | actions: Command('amixer -d sset "Amp Spk" mute') |
|---|
| 102 | - |
|---|
| 103 | trigger: InputEvent() |
|---|
| 104 | filters: |
|---|
| 105 | - HasAttr(switch, "HEADSET") |
|---|
| 106 | - HasAttr(event, "released") |
|---|
| 107 | actions: Command('amixer -d sset "Amp Spk" unmute') |
|---|
| 108 | |
|---|
| 109 | # |
|---|
| 110 | # Idleness Brightness Handling |
|---|
| 111 | # |
|---|
| 112 | trigger: IdleState() |
|---|
| 113 | filters: HasAttr(status, "busy") |
|---|
| 114 | actions: |
|---|
| 115 | - SetDisplayBrightness("0", 100) |
|---|
| 116 | - Command( "xset -display localhost:0 s off" ) |
|---|
| 117 | - |
|---|
| 118 | trigger: IdleState() |
|---|
| 119 | filters: HasAttr(status, "idle_dim") |
|---|
| 120 | actions: SetDisplayBrightness("0", 20) |
|---|
| 121 | - |
|---|
| 122 | trigger: IdleState() |
|---|
| 123 | filters: HasAttr(status, "idle_prelock") |
|---|
| 124 | actions: |
|---|
| 125 | - SetDisplayBrightness("0", 0) |
|---|
| 126 | - Command( "xset -display localhost:0 s blank" ) |
|---|
| 127 | - Command( "xset -display localhost:0 s activate" ) |
|---|
| 128 | - |
|---|
| 129 | trigger: IdleState() |
|---|
| 130 | filters: HasAttr(status, "suspend") |
|---|
| 131 | actions: Suspend() |
|---|