forked from vineethh91/Etch-A-Sketch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RequestInterpreter.py
executable file
·38 lines (26 loc) · 1.07 KB
/
RequestInterpreter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python2.7
# Invoked from the webserserver to interpret the incoming request
# Supposed input will be array of key:value pairs
# eg. "command:updateBoard"
# "duration:5000"
# "command:startDiagnostics"
#
from BoardHandler import BoardHandler
class RequestInterpreter:
# Interpret incoming request to kick off action handlers based on request
def interpretRequest(self):
print "RequestInterpreter interpretRequest invoked..."
# User initiatied board initialization
def initializeBoard(self):
print "Invoking BoardHandler to initialize as per user request..."
board = BoardHandler()
board.initializeBoard()
# Saves the incoming request data to local buffer
# Can be used if user only wants to queue up their request
def saveData(self):
print "Saving request data to buffer..."
# Kick off transmitting data to the board/external output
def displayData(self):
print "Invoking BoardHandler to display data..."
request = RequestInterpreter()
request.initializeBoard()