aboutsummaryrefslogtreecommitdiff
path: root/inputs
diff options
context:
space:
mode:
Diffstat (limited to 'inputs')
-rw-r--r--inputs/MouseFollower.xml8
-rw-r--r--inputs/RandomLocs.py13
-rw-r--r--inputs/TCPInput.py5
3 files changed, 24 insertions, 2 deletions
diff --git a/inputs/MouseFollower.xml b/inputs/MouseFollower.xml
new file mode 100644
index 0000000..7d7963d
--- /dev/null
+++ b/inputs/MouseFollower.xml
@@ -0,0 +1,8 @@
+<InputElement>
+ <Class>inputs.PygameInput</Class>
+ <Args>
+ <Id>followmouse</Id>
+ <RefreshInterval>50</RefreshInterval>
+ <FollowMouse>True</FollowMouse>
+ </Args>
+</InputElement>
diff --git a/inputs/RandomLocs.py b/inputs/RandomLocs.py
new file mode 100644
index 0000000..d1ce1c7
--- /dev/null
+++ b/inputs/RandomLocs.py
@@ -0,0 +1,13 @@
+import util.TimeOps as clock
+import random
+import util.Geo as Geo
+import util.Strings as Strings
+from operationscore.Input import *
+class RandomLocs(Input):
+ def inputInit(self):
+ self['LastEvent'] = clock.time()
+ def sensingLoop(self): #TODO: move to params
+ currentTime = clock.time()
+ if currentTime - self['LastEvent'] > 2000:
+ self.respond({Strings.LOCATION: Geo.randomLoc((50,50))})
+ self['LastEvent'] = currentTime
diff --git a/inputs/TCPInput.py b/inputs/TCPInput.py
index 1517afa..197045f 100644
--- a/inputs/TCPInput.py
+++ b/inputs/TCPInput.py
@@ -1,6 +1,7 @@
import util.Strings as Strings
from operationscore.Input import *
import socket, json, time
+import logging as main_log
class TCPInput(Input):
def inputInit(self):
self.HOST = '' # Symbolic name meaning all available interfaces
@@ -16,9 +17,9 @@ class TCPInput(Input):
def sensingLoop(self):
data = self.conn.recv(self.BUFFER_SIZE)
- print data
+ main_log.debug('Incoming data', data)
if not data or 'end' in data: # data end, close socket
- print 'END!!'
+ main_log.debug('End in data')
self.IS_RESPONDING = 0
self.sock.close()