From 478a480fcea6e55b3746ce3eda4697681f57373f Mon Sep 17 00:00:00 2001 From: ori agranat Date: Sun, 31 Mar 2019 22:51:43 +0300 Subject: [PATCH 1/2] Auto stash before merge of "master" and "origin/master" --- chameleon-client/src/App.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/chameleon-client/src/App.vue b/chameleon-client/src/App.vue index f4e2d4f2b..7ae476c02 100644 --- a/chameleon-client/src/App.vue +++ b/chameleon-client/src/App.vue @@ -75,8 +75,13 @@ }, created () { this.$options.sockets.onmessage = (data) => { - console.log(data.data); - } // console writes recived data + let message = JSON.parse(data.data); + for (var prop in message){ + if(message.hasOwnProperty(prop)){ + this.$store.state[prop] = message[prop]; + } + } + } // console writes recived data } } From 8d627736b785ae2d71d154f4840f174b882d7b5b Mon Sep 17 00:00:00 2001 From: ori agranat Date: Sun, 31 Mar 2019 22:52:38 +0300 Subject: [PATCH 2/2] created recived data handler from server --- backend/app/handlers/SocketHandler.py | 2 -- backend/settings/cams/cam1/pipeline1.json | 2 +- backend/settings/cams/cam1/pipeline5.json | 1 + chameleon-client/src/App.vue | 1 + chameleon-client/src/store.js | 10 +++++----- 5 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 backend/settings/cams/cam1/pipeline5.json diff --git a/backend/app/handlers/SocketHandler.py b/backend/app/handlers/SocketHandler.py index 5b01dda18..03a90f58d 100644 --- a/backend/app/handlers/SocketHandler.py +++ b/backend/app/handlers/SocketHandler.py @@ -57,9 +57,7 @@ class ChameleonWebSocket(tornado.websocket.WebSocketHandler): for key in message_dic: self.actions.get(key, self.actions["change_pipeline_values"])(message_dic) - print(message) - self.write_message(message) def on_close(self): self.save_settings() diff --git a/backend/settings/cams/cam1/pipeline1.json b/backend/settings/cams/cam1/pipeline1.json index 8438b90d1..89f5e7a95 100644 --- a/backend/settings/cams/cam1/pipeline1.json +++ b/backend/settings/cams/cam1/pipeline1.json @@ -1 +1 @@ -{"exposure": 21, "brightness": 71} \ No newline at end of file +{"exposure": 32, "brightness": 36, "hue": [10, 45], "orientation": "Normal", "camera": "3", "resolution": "Normal"} \ No newline at end of file diff --git a/backend/settings/cams/cam1/pipeline5.json b/backend/settings/cams/cam1/pipeline5.json new file mode 100644 index 000000000..70c73a717 --- /dev/null +++ b/backend/settings/cams/cam1/pipeline5.json @@ -0,0 +1 @@ +{"exposure": 50, "brightness": 50} \ No newline at end of file diff --git a/chameleon-client/src/App.vue b/chameleon-client/src/App.vue index 7ae476c02..53e31b690 100644 --- a/chameleon-client/src/App.vue +++ b/chameleon-client/src/App.vue @@ -75,6 +75,7 @@ }, created () { this.$options.sockets.onmessage = (data) => { + console.log(data.data); let message = JSON.parse(data.data); for (var prop in message){ if(message.hasOwnProperty(prop)){ diff --git a/chameleon-client/src/store.js b/chameleon-client/src/store.js index b47b2ce0d..f8875376a 100644 --- a/chameleon-client/src/store.js +++ b/chameleon-client/src/store.js @@ -2,12 +2,10 @@ import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex); - const set = key => (state,val) =>{ state[key] = val -} +}; export const store = new Vuex.Store({ - strict: true, state:{ //header @@ -22,10 +20,12 @@ export const store = new Vuex.Store({ hue:[0,10], saturation:[0,10], value:[0,10] - }, mutations:{ - camera: set('camera'), + camera (state,value){ + state['camera'] = value; + state['pipeline'] = "0"; + }, pipeline: set('pipeline'), brightness: set('brightness'), exposure: set('exposure'),