Commit 3c6f2a7c by SHINDAESUB

teaching info update

parent 9ed3eb2f
...@@ -7,7 +7,7 @@ const dotenv = require('dotenv'); ...@@ -7,7 +7,7 @@ const dotenv = require('dotenv');
const app = express() const app = express()
const bodyParser = require('body-parser'); // const bodyParser = require('body-parser'); //
let infoMsg = ''
dotenv.config({ dotenv.config({
path: path.resolve( path: path.resolve(
...@@ -50,7 +50,7 @@ const jsonFile = fs.readFileSync('./json/projects.json', 'utf8'); ...@@ -50,7 +50,7 @@ const jsonFile = fs.readFileSync('./json/projects.json', 'utf8');
const jsonData = JSON.parse(jsonFile); const jsonData = JSON.parse(jsonFile);
console.log(jsonData); console.table(jsonData);
//Post 방식은 Get 과 다르기 때문에 body-parser 를 설치해서 사용해야한다. //Post 방식은 Get 과 다르기 때문에 body-parser 를 설치해서 사용해야한다.
app.use(bodyParser.json()); app.use(bodyParser.json());
...@@ -205,10 +205,11 @@ const wrapper = asyncFn => { return (async (req, res, next) => { try { return aw ...@@ -205,10 +205,11 @@ const wrapper = asyncFn => { return (async (req, res, next) => { try { return aw
app.get('/api/requestManager',wrapper(async (req,res)=>{ app.get('/api/requestManager',wrapper(async (req,res)=>{
req.query.image_path = process.env.TEACHING_IMAGE_PATH req.query.image_path = process.env.TEACHING_IMAGE_PATH
if(req.query.cmd === "neuro_check") req.query.teaching = `${process.env.TEACHING_IMAGE_PATH}-test-2-${process.env.TEACHING_RESOLUTION}-${req.query.teaching_info}`
//req.query.project_num if(req.query.cmd === "neuro_check"){
req.query.teaching = `${process.env.TEACHING_IMAGE_PATH}-${req.query.project_num}-2-${process.env.TEACHING_RESOLUTION}${req.query.teaching_info}`
}
console.log("param :",JSON.stringify(req.query) ) console.log("param :",JSON.stringify(req.query) )
sendToManager (JSON.stringify(req.query)) sendToManager (JSON.stringify(req.query))
...@@ -258,9 +259,10 @@ function responseManager (requestMsg) { ...@@ -258,9 +259,10 @@ function responseManager (requestMsg) {
let timer = setInterval(() => { let timer = setInterval(() => {
if(requestMsg === JSON.parse(udpResultMsg).cmd ){ if(requestMsg === JSON.parse(udpResultMsg).cmd ){
console.log(`json 데이터는 ? ${JSON.parse(udpResultMsg).cmd}`) console.log(`json 데이터는 ? ${JSON.parse(udpResultMsg).cmd}`)
if(requestMsg === 'capture_done') infoMsg = JSON.parse(udpResultMsg).msg
resolve(udpResultMsg) resolve(udpResultMsg)
clearInterval(timer) clearInterval(timer)
}else if(waitingTime === 5000){ }else if(waitingTime === 500000){
reject('No response from Manager') reject('No response from Manager')
clearInterval(timer) clearInterval(timer)
}else{ }else{
......
...@@ -178,10 +178,17 @@ export default { ...@@ -178,10 +178,17 @@ export default {
}, },
async neuroCheck(){ async neuroCheck(){
let teachingInfo = ''
this.info.info.forEach((rect) => {
let str = `(${Math.ceil(rect.startX * 1.5)},${Math.ceil(rect.startY * 1.5)},${Math.ceil(rect.lastX * 1.5)},${Math.ceil( rect.lastY * 1.5) })`
teachingInfo= teachingInfo + "-" + str
})
let msg = new Object() let msg = new Object()
msg.cmd = "neuro_check" msg.cmd = "neuro_check"
msg.project_num = this.info.uid msg.project_num = this.info.uid
msg.teaching_info ='(1113,720,1329,840)-(1626,504,1788,651)-(1953,816,2049,978)' msg.teaching_info = teachingInfo
await teachingService.requestManager(msg) await teachingService.requestManager(msg)
.then(data => { .then(data => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment