You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
174 lines
5.0 KiB
YAML
174 lines
5.0 KiB
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)
|
|
# -
|
|
# #
|
|
# # Suspend Handling
|
|
# #
|
|
# trigger: InputEvent()
|
|
# filters:
|
|
# - HasAttr(switch, "POWER")
|
|
# - HasAttr(event, "released")
|
|
# - HasAttr(duration, 0)
|
|
# actions: Suspend()
|
|
-
|
|
#
|
|
# 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')
|
|
- OccupyResource(CPU)
|
|
-
|
|
name: 'handset'
|
|
while: CallStatus()
|
|
filters: Or(HasAttr(status, "outgoing"), HasAttr(status, "active"))
|
|
actions:
|
|
- SetScenario(gsmhandset)
|
|
- OccupyResource(CPU)
|
|
-
|
|
name: 'headset'
|
|
while: CallStatus()
|
|
filters: Or(HasAttr(status, "outgoing"), HasAttr(status, "active"))
|
|
actions:
|
|
- SetScenario(gsmheadset)
|
|
- OccupyResource(CPU)
|
|
-
|
|
while: PowerStatus()
|
|
filters: HasAttr(status, "charging")
|
|
actions: SetLed("gta02_power_orange", "light")
|
|
#-
|
|
# while: PowerStatus()
|
|
# filters: Not(HasAttr(status, "discharging"))
|
|
# actions: OccupyResource(Display)
|
|
|
|
-
|
|
while: PowerStatus()
|
|
filters: HasAttr(status, "critical")
|
|
actions: SetLed("gta02_power_orange", "blink")
|
|
-
|
|
while: PowerStatus()
|
|
filters: HasAttr(status, "full")
|
|
actions: SetLed("gta02_power_blue", "light")
|
|
-
|
|
trigger: PowerStatus()
|
|
filters: HasAttr(status, "empty")
|
|
actions: Command('poweroff')
|
|
|
|
#
|
|
# Headset Audio Scenario Support
|
|
#
|
|
-
|
|
name: 'default'
|
|
trigger: InputEvent()
|
|
filters:
|
|
- HasAttr(switch, "HEADSET")
|
|
- HasAttr(event, "pressed")
|
|
actions:
|
|
- SetScenario(headset)
|
|
- SetProfile(headset)
|
|
-
|
|
name: 'silent'
|
|
trigger: InputEvent()
|
|
filters:
|
|
- HasAttr(switch, "HEADSET")
|
|
- HasAttr(event, "pressed")
|
|
actions:
|
|
- SetScenario(headset)
|
|
- SetProfile(headset_silent)
|
|
-
|
|
name: 'headset'
|
|
trigger: InputEvent()
|
|
filters:
|
|
- HasAttr(switch, "HEADSET")
|
|
- HasAttr(event, "released")
|
|
actions:
|
|
- SetScenario(stereoout)
|
|
- SetProfile(default)
|
|
-
|
|
name: 'headset_silent'
|
|
trigger: InputEvent()
|
|
filters:
|
|
- HasAttr(switch, "HEADSET")
|
|
- HasAttr(event, "released")
|
|
actions:
|
|
- SetScenario(silent)
|
|
- SetProfile(silent)
|
|
|
|
#change scenarios on profile change
|
|
-
|
|
trigger: DbusTrigger(system, 'org.freesmartphone.opreferencesd', 0, 'org.freesmartphone.Preferences.Service', 'Notify')
|
|
filters:
|
|
- HasAttr(key, "enabled-rules")
|
|
- HasAttr(variant, "silent")
|
|
actions: Debug("dbus trigger test")
|
|
|
|
#
|
|
# A few testing rules :
|
|
#
|
|
|
|
-
|
|
trigger: DbusTrigger(system, 'org.freesmartphone.odeviced', 0, 'org.freesmartphone.Device.IdleNotifier', 'State')
|
|
actions: Debug("dbus trigger test")
|
|
|
|
#
|
|
# 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)
|
|
-
|
|
trigger: IdleState()
|
|
filters: HasAttr(status, "busy")
|
|
actions: Command('xset -display localhost:0 s reset')
|
|
-
|
|
trigger: IdleState()
|
|
filters: HasAttr(status, "idle_dim")
|
|
actions: Command('xset -display localhost:0 s activate')
|
|
#-
|
|
# trigger: IdleState()
|
|
# filters: HasAttr(status, "idle_prelock")
|
|
# actions: SetDisplayBrightness("0", 0)
|
|
|
|
#
|
|
# usb and aux Handling
|
|
#
|
|
-
|
|
trigger: InputEvent()
|
|
filters:
|
|
- HasAttr(switch, "USB")
|
|
- HasAttr(event, "pressed")
|
|
actions: Command('pybat')
|
|
# -
|
|
# trigger: InputEvent()
|
|
#
|
|
# filters:
|
|
# - HasAttr(switch, "AUX")
|
|
# - HasAttr(event, "pressed")
|
|
#
|
|
# actions: Command('auxmenu')
|