Skip to content

Commit

Permalink
update: MNID/PAT property of iotcam nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
rootkwak528 committed Oct 6, 2021
1 parent f47961c commit 77fdc20
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
12 changes: 12 additions & 0 deletions body/pose-detection-iotcam/pose-detection-iotcam.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
monitorPort: {value: 1882, validate:RED.validators.number()},
rtspPort: {value: 1886, validate:RED.validators.number()},
dataSocketUrl: {value: 'ws://localhost:1880/ws/data'},
smartthingsMnid: {value: ""},
smartthingsPat: {value: ""},
},
inputs: 1,
outputs: 1,
Expand Down Expand Up @@ -46,6 +48,16 @@
<label for="node-input-dataSocketUrl"><i class="fa fa-tag"></i> Data Socket Url</label>
<input type="text" id="node-input-dataSocketUrl" placeholder="(default) 'ws://localhost:1880/ws/data'">
</div>

<div class="form-row">
<label for="node-input-smartthingsMnid"><i class="fa fa-tag"></i> Smartthings MNID</label>
<input type="text" id="node-input-smartthingsMnid">
</div>

<div class="form-row">
<label for="node-input-smartthingsPat"><i class="fa fa-tag"></i> Smartthings PAT</label>
<input type="text" id="node-input-smartthingsPat">
</div>
</script>

<script type="text/html" data-help-name="pose-detection-iotcam">
Expand Down
11 changes: 1 addition & 10 deletions body/pose-detection-iotcam/pose-detection-iotcam.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const ws = require('ws')
const http = require('http')
const cors = require('cors')
const express = require('express')
require("dotenv").config()


module.exports = function(RED) {
Expand Down Expand Up @@ -455,13 +454,6 @@ module.exports = function(RED) {

RED.nodes.createNode(this, config)
let rtspStream
console.log('hjello')

// .env variable
// .env로부터 변수 호출
const mnid = process.env.SAMSUNG_MNID
const token = process.env.SAMSUNG_TOKEN
console.log(mnid, token)

// listener to receive messages from the up-stream nodes in a flow.
this.on('input', (msg, send, done) => {
Expand Down Expand Up @@ -534,7 +526,7 @@ module.exports = function(RED) {
// newStream 생성
rtspStream = new newStream({
name: 'name',
streamUrl: `rtsps://${mnid}:${token}@${rtspUrl}`,
streamUrl: `rtsps://${config.smartthingsMnid}:${config.smartthingsPat}@${rtspUrl}`,
wsPort: rtspPort,
ffmpegOptions: { // options ffmpeg flags
'-stats': '', // an option with no neccessary value uses a blank string
Expand All @@ -543,7 +535,6 @@ module.exports = function(RED) {
})
})

// :1880/ws/monitor >> :1881
httpServer.listen(rtspPort)

// return HTML document to the client.
Expand Down
12 changes: 12 additions & 0 deletions hand/hand-detection-iotcam/hand-detection-iotcam.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
monitorPort: {value: 1884, validate:RED.validators.number()},
rtspPort: {value: 1886, validate:RED.validators.number()},
dataSocketUrl: {value: 'ws://localhost:1880/ws/data'},
smartthingsMnid: {value: ""},
smartthingsPat: {value: ""},
},
inputs: 1,
outputs: 1,
Expand Down Expand Up @@ -46,6 +48,16 @@
<label for="node-input-dataSocketUrl"><i class="fa fa-tag"></i> Data Socket Url</label>
<input type="text" id="node-input-dataSocketUrl" placeholder="(default) 'ws://localhost:1880/ws/data'">
</div>

<div class="form-row">
<label for="node-input-smartthingsMnid"><i class="fa fa-tag"></i> Smartthings MNID</label>
<input type="text" id="node-input-smartthingsMnid">
</div>

<div class="form-row">
<label for="node-input-smartthingsPat"><i class="fa fa-tag"></i> Smartthings PAT</label>
<input type="text" id="node-input-smartthingsPat">
</div>
</script>

<script type="text/html" data-help-name="hand-detection-iotcam">
Expand Down
9 changes: 1 addition & 8 deletions hand/hand-detection-iotcam/hand-detection-iotcam.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const ws = require('ws')
const http = require('http')
const cors = require('cors')
const express = require('express')
require("dotenv").config()


module.exports = function(RED) {
Expand Down Expand Up @@ -432,11 +431,6 @@ module.exports = function(RED) {
RED.nodes.createNode(this, config)
let rtspStream

// .env variable
// .env로부터 변수 호출
const mnid = process.env.SAMSUNG_MNID
const token = process.env.SAMSUNG_TOKEN

// listener to receive messages from the up-stream nodes in a flow.
this.on('input', (msg, send, done) => {

Expand Down Expand Up @@ -508,7 +502,7 @@ module.exports = function(RED) {
// newStream 생성
rtspStream = new newStream({
name: 'name',
streamUrl: `rtsps://${mnid}:${token}@${rtspUrl}`,
streamUrl: `rtsps://${config.smartthingsMnid}:${config.smartthingsPat}@${rtspUrl}`,
wsPort: rtspPort,
ffmpegOptions: { // options ffmpeg flags
'-stats': '', // an option with no neccessary value uses a blank string
Expand All @@ -517,7 +511,6 @@ module.exports = function(RED) {
})
})

// :1880/ws/monitor >> :1881
httpServer.listen(rtspPort)

// return HTML document to the client.
Expand Down

0 comments on commit 77fdc20

Please sign in to comment.