Allow 2 optional parameters to oevents blink statements - durationOn and
durationOff.  The default is the previous blink rate.

Signed-off-by: Ben Deering <ben_deer...@swissmail.org>
---
 framework/subsystems/oeventsd/leds_actions.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/framework/subsystems/oeventsd/leds_actions.py 
b/framework/subsystems/oeventsd/leds_actions.py
index 77b96d1..70fca53 100644
--- a/framework/subsystems/oeventsd/leds_actions.py
+++ b/framework/subsystems/oeventsd/leds_actions.py
@@ -78,7 +78,7 @@ class Led(object):
 
     def __blink(self):
         logger.info("blink led %s", self)
-        self.interface.SetBlinking(128, 2048, reply_handler=self.on_reply, 
error_handler=self.on_error)
+        self.interface.SetBlinking(self.durationOn, self.durationOff, 
reply_handler=self.on_reply, error_handler=self.on_error)
 
     def turn_on(self, user):
         self.users[user] = 'on'
@@ -91,8 +91,10 @@ class Led(object):
             logger.warning("try to turn off led %s before having turing it 
on", self)
         self.__update()
 
-    def blink(self, user):
+    def blink(self, user, durationOn, durationOff):
         self.users[user] = 'blink'
+        self.durationOn = durationOn
+        self.durationOff = durationOff
         self.__update()
 
     def __update(self):
@@ -113,7 +115,7 @@ class LedAction(Action):
     """
     function_name = 'SetLed'
 
-    def __init__(self, device, action):
+    def __init__(self, device, action, onDuration = 128, offDuration = 1024):
         Action.__init__( self )
         self.led = Led(device)
         self.action = action
@@ -124,7 +126,7 @@ class LedAction(Action):
         if self.action == 'light':
             self.led.turn_on(self)
         elif self.action == 'blink':
-            self.led.blink(self)
+            self.led.blink(self, onDuration, offDuration)
 
     def untrigger(self, **kargs):
         self.led.turn_off(self)
-- 
1.9.0

_______________________________________________
Shr-devel mailing list
Shr-devel@lists.shr-project.org
http://lists.shr-project.org/mailman/listinfo/shr-devel

Reply via email to