Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
RIT_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박권수
2021-05-11 04:16:35 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ecb5d359d685f9483e07bc8900f42ab96e9f18e3
ecb5d359
1 parent
86405161
style. code style change
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
server/src/lib/DataProcess.js
server/src/lib/MqttModule.js
server/src/lib/DataProcess.js
View file @
ecb5d35
...
...
@@ -39,9 +39,7 @@ const bottleInfoUpdate = async(data) => {
if
(
isOpen
===
'1'
)
{
await
Bottle
.
findOneAndUpdate
({
bottleId
},
{
recentOpen
:
openDate
},
{
new
:
true
});
},
{
recentOpen
:
openDate
});
}
await
Bottle
.
findOneAndUpdate
({
...
...
@@ -50,12 +48,12 @@ const bottleInfoUpdate = async(data) => {
temperature
,
humidity
,
balance
}
,
{
new
:
true
}
);
});
}
//해당 MQTT Broker(client)에 bottleId의 정보에 관한 topic과 message를 리턴한다.
const
transPublishingTopicAndMessage
=
async
(
bottleId
)
=>
{
const
topic
=
'bottle/'
.
concat
(
bottleId
)
+
'/stb'
;
const
topic
=
'bottle/'
+
bottleId
+
'/stb'
;
const
bottle
=
await
Bottle
.
findByBottleId
(
bottleId
);
const
recentOpen
=
await
bottle
.
getRecentOpenDate
();
...
...
@@ -65,7 +63,7 @@ const transPublishingTopicAndMessage = async(bottleId) => {
return
{
topic
,
message
}
}
;
}
//날짜를 yymmdd로 변환해주는 함수
...
...
server/src/lib/MqttModule.js
View file @
ecb5d35
...
...
@@ -39,6 +39,9 @@ exports.mqttOff = (hosting) => {
&&
client
.
options
.
host
===
hosting
.
host
&&
client
.
options
.
port
===
hosting
.
port
)
});
clientList
[
filterIndex
].
end
();
clientList
.
splice
(
filterIndex
,
1
);
if
(
filterIndex
!==
-
1
)
{
clientList
[
filterIndex
].
end
();
clientList
.
splice
(
filterIndex
,
1
);
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment