root@htcdream ~ $ cat /etc/freesmartphone/oevents/rules.yaml
# This file is in YAML format (http://www.yaml.org/)
# We define a list of rules that will be automatically loaded
# When we start the oevents module of the framework daemon
#
# The attributes of a rule are :
# - trigger : trigger object
# - filters : filters object or list of filters objects
# - actions : action object or list of actions objects
#
# We define the following functions :
# - CallStatus() : create a trigger object activated on a call status event
# - PowerStatus() : create a trigger object activated on a power status event
# - HasAttr(name, value) : create a filter that accept signal with a given attribute
# - Not(filter) : create a neg filter
# - PlaySound(file) : Action that starts to play an audio file
# - StopSound(file) : Action that stop an audio file
# - SetScenario(name) : Action that sets an audio scenario
# - StartVibration
# - StopVibration
# - RingTone(cmd) : cmd can be 'start' or 'stop'
# - Time(hour, min) : create a trigger activated at the given time
# - Debug(msg) : Action that prints a debug message (only for debuging)
-
#
# Call -> Audio Scenario Handling
#
trigger: IncomingMessage()
actions: MessageTone(play)
-
while: CallListContains("incoming")
filters: Not(CallListContains("active"))
actions:
- RingTone()
- Command('xset -display localhost:0 s reset')
- SetLed("green", "blink")
- OccupyResource(Display)
-
while: CallStatus()
filters: Or(HasAttr(status, "outgoing"), HasAttr(status, "active"))
actions:
- OccupyResource(CPU)
-
# while: CallStatus()
# filters:
# - Or(Or(HasAttr(status, "outgoing"), HasAttr(status, "active")), And(HasAttr(status, "incoming"), CallListContains("active")))
# - Not(BTHeadsetIsConnected())
# actions:
# - SetScenario(gsmhandset)
#-
while: CallStatus()
filters:
- Or(Or(HasAttr(status, "outgoing"), HasAttr(status, "active")), And(HasAttr(status, "incoming"), CallListContains("active")))
- BTHeadsetIsConnected()
actions:
- SetScenario(gsmbluetooth)
- BTHeadsetPlaying()
-
while: PowerStatus()
filters: HasAttr(status, "charging")
actions: SetLed("blue", "light")
-
while: PowerStatus()
filters: Not(HasAttr(status, "discharging"))
actions: OccupyResource(CPU)
-
while: PowerStatus()
filters: HasAttr(status, "critical")
actions: SetLed("red", "blink")
-
while: PowerStatus()
filters: HasAttr(status, "full")
actions: SetLed("green", "light")
-
trigger: PowerStatus()
filters: HasAttr(status, "empty")
actions: Command('poweroff')
#
# Headset Audio Scenario Support. There is still work to be done.
#
-
trigger: InputEvent()
filters:
- HasAttr(switch, "HEADSET")
- HasAttr(event, "pressed")
actions: Command('amixer -d sset "Amp Spk" mute')
-
trigger: InputEvent()
filters:
- HasAttr(switch, "HEADSET")
- HasAttr(event, "released")
actions: Command('amixer -d sset "Amp Spk" unmute')
#
# Idleness Brightness Handling
# (activating the user's screen saver from a central daemon is quite hacky
# we really want some user's application to listen for the right signals)
-
while: IdleState()
filters: HasAttr(status, "busy")
actions:
- SetLed("lcd_backlight", "light")
- SetLed("button_backlight", "light")
- SetLed("keyboard_backlight", "light")
-
trigger: IdleState()
filters: HasAttr(status, "idle_dim")
actions:
- Command('xset -display localhost:0 s blank')
- Command('xset -display localhost:0 s activate')
-
trigger: IdleState()
filters: HasAttr(status, "suspend")
actions:
- Suspend()
-
trigger: InputEvent()
filters:
- HasAttr(status, "suspend")
- HasAttr(key, "POWER")
- HasAttr(event, "pressed")
actions:
- Command('/usr/bin/susres')
-
trigger: InputEvent()
filters:
- HasAttr(switch, "LID")
- HasAttr(event, "pressed")
actions:
- SetLed("keyboard_backlight", "light")
- SetLed("button_backlight", "light")
- SetLed("lcd_backlight", "light")
- Command('/usr/bin/susres')
- Debug("Lid Opened")