diff --git a/backend/app/classes/ChameleonCamera.py b/backend/app/classes/ChameleonCamera.py new file mode 100644 index 000000000..daa3d8ba4 --- /dev/null +++ b/backend/app/classes/ChameleonCamera.py @@ -0,0 +1,11 @@ +from ChameleonPipeLine import ChameleonPipeline + + +class ChameleonCamera: + + def __init__(self, dic): + self.pipelines = [] + + for pipeline in dic["pipelines"]: + self.pipelines.append(ChameleonPipeline(pipeline)) + diff --git a/backend/app/classes/ChameleonPipeLine.py b/backend/app/classes/ChameleonPipeLine.py new file mode 100644 index 000000000..1412cdfd6 --- /dev/null +++ b/backend/app/classes/ChameleonPipeLine.py @@ -0,0 +1,8 @@ + + +class ChameleonPipeline: + + def __init__(self, dic): + self.id = dic["id"] + self.exposure = dic["exposure"] + self.brightness = dic["brightness"] \ No newline at end of file diff --git a/backend/app/classes/__init__.py b/backend/app/classes/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/backend/app/handlers/SocketHandler.py b/backend/app/handlers/SocketHandler.py index 7f1bf87b6..39bb0349e 100644 --- a/backend/app/handlers/SocketHandler.py +++ b/backend/app/handlers/SocketHandler.py @@ -1,15 +1,20 @@ import tornado.websocket import json +from classes.ChameleonCamera import ChameleonCamera + class ChameleonWebSocket(tornado.websocket.WebSocketHandler): + def check_origin(self, origin): return True + def open(self): self.write_message(json.dumps( { - 'cam1':{ - 'pipeline':1, - 'exposure':12 + 'cam1': { + 'pipelines': [ + {"id": 1, "Exposure": 45} + ] } } )) @@ -17,6 +22,28 @@ class ChameleonWebSocket(tornado.websocket.WebSocketHandler): def on_message(self, message): # print(json.loads(message)) + + cams = [] + + dic = { + 'cam1': { + 'pipelines': [ + {"id": 1, "exposure": 45, "brightness": 123123}, + {"id": 2, "exposure": 12, "brightness": 123}, + {"id": 3, "exposure": 23, "brightness": 12} + ] + }, + 'cam2': { + 'pipelines': [ + {"id": 1, "exposure": 15, "brightness": 1233}, + {"id": 2, "exposure": 68, "brightness": 453} + ] + } + } + + for cam in dic: + cams.append(ChameleonCamera(dic[cam])) + print(message) self.write_message(message) diff --git a/chameleon-client/src/App.vue b/chameleon-client/src/App.vue index 535c7abab..1a28d8ed5 100644 --- a/chameleon-client/src/App.vue +++ b/chameleon-client/src/App.vue @@ -58,7 +58,7 @@ this.openedNames = ['']; } else { this.activeName = this.$refs.menu.currentActiveName; - this.openedNames = [this.activeName.split("-")[0]]; + this.openedNames = ["/" + this.activeName.split("/")[1]]; } this.$nextTick(function() {