summaryrefslogtreecommitdiffstats
path: root/src/ogProcess.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/ogProcess.py')
-rw-r--r--src/ogProcess.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/ogProcess.py b/src/ogProcess.py
index 6601b8c..def76f1 100644
--- a/src/ogProcess.py
+++ b/src/ogProcess.py
@@ -1,22 +1,29 @@
import threading
import platform
import time
+from src import ogRest
if platform.system() == 'Linux':
from src.linux import ogOperations
class ogProcess():
- def processOperation(self, op, URI):
+ def processOperation(self, op, URI, sock):
if ("poweroff" in URI):
+ sock.send(bytes(ogRest.getResponse(ogRest.ogResponses.IN_PROGRESS), 'utf-8'))
+ sock.close()
self.process_poweroff()
- return 1
+ return 0
elif ("reboot" in URI):
+ sock.send(bytes(ogRest.getResponse(ogRest.ogResponses.IN_PROGRESS), 'utf-8'))
+ sock.close()
self.process_reboot()
- return 1
+ return 0
elif ("probe" in URI):
- return 1
+ sock.send(bytes(ogRest.getResponse(ogRest.ogResponses.OK), 'utf-8'))
+ else:
+ sock.send(bytes(ogRest.getResponse(ogRest.ogResponses.BAD_REQUEST), 'utf-8'))
- return 0
+ return 1
def process_reboot(self):
# Rebooting thread