aboutsummaryrefslogtreecommitdiff
path: root/behaviors/MobileShakeBehavior.py
diff options
context:
space:
mode:
authorGravatar eugue <eug.sun@gmail.com>2011-01-27 14:28:20 -0500
committerGravatar eugue <eug.sun@gmail.com>2011-01-27 14:28:20 -0500
commit328464219a02c014caf1608a27a898900cad8456 (patch)
tree488008ea4a832f101631758b0ea6f11fb5209f2f /behaviors/MobileShakeBehavior.py
parent82f99fc4583ca3cc9861a9fe30990a4a9ef162c4 (diff)
mobile shake behavior added.
Diffstat (limited to 'behaviors/MobileShakeBehavior.py')
-rw-r--r--behaviors/MobileShakeBehavior.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/behaviors/MobileShakeBehavior.py b/behaviors/MobileShakeBehavior.py
new file mode 100644
index 0000000..e25e929
--- /dev/null
+++ b/behaviors/MobileShakeBehavior.py
@@ -0,0 +1,17 @@
+from operationscore.Behavior import *
+import util.Strings as Strings
+
+class MobileShakeBehavior(Behavior):
+ def processResponse(self, sensorInputs, recursiveInputs):
+ #print sensorInputs
+ ret = []
+ for sInput in sensorInputs:
+ outDict = dict(sInput)
+ if 'type' in sInput and sInput['type'] == 2:
+ outDict['Location'] = '{x}>' + str(0) + ',{y}>' + str(0)
+ outDict['Color'] = [sInput['r'], sInput['g'], sInput['b']]
+ else: # dumb invisible pixel
+ outDict['Location'] = (-1, -1)
+ outDict['Color'] = [0, 0, 0]
+ ret.append(outDict)
+ return (ret, recursiveInputs)