aboutsummaryrefslogtreecommitdiff
path: root/behaviors/MobileShakeBehavior.py
blob: e25e92972341eac0436051e45d8d5901252c4277 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)