Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
IoT_Team_Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kim Siwon
IoT_Team_Project
Commits
c95c2fd9
Commit
c95c2fd9
authored
5 years ago
by
Server (Shared Users)
Browse files
Options
Downloads
Patches
Plain Diff
coapserver.py
parent
e275126f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Server_CoAP/CoAPthon3/coapserver.py
+3
-3
3 additions, 3 deletions
Server_CoAP/CoAPthon3/coapserver.py
Server_CoAP/CoAPthon3/exampleresources.py
+12
-4
12 additions, 4 deletions
Server_CoAP/CoAPthon3/exampleresources.py
with
15 additions
and
7 deletions
Server_CoAP/CoAPthon3/coapserver.py
+
3
−
3
View file @
c95c2fd9
...
@@ -39,9 +39,9 @@ class CoAPServer(CoAP):
...
@@ -39,9 +39,9 @@ class CoAPServer(CoAP):
print
(
c
[
'
uuid
'
])
print
(
c
[
'
uuid
'
])
positionCalculationThread
=
threading
.
Thread
(
target
=
self
.
positionCalculation
,
args
=
([
c
[
'
uuid
'
]]))
positionCalculationThread
=
threading
.
Thread
(
target
=
self
.
positionCalculation
,
args
=
([
c
[
'
uuid
'
]]))
positionCalculationThread
.
start
()
positionCalculationThread
.
start
()
time
.
sleep
(
2
.1
)
time
.
sleep
(
10
.1
)
currentTime
=
time
.
time
()
currentTime
=
time
.
time
()
trackingCursor
=
self
.
trackingCollection
.
remove
({
'
updateTime
'
:
{
'
lte
'
:
currentTime
-
2
}})
trackingCursor
=
self
.
trackingCollection
.
remove
({
'
updateTime
'
:
{
'
lte
'
:
currentTime
-
10
}})
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
print
(
"
existing updateUserLocation
"
)
print
(
"
existing updateUserLocation
"
)
...
@@ -49,7 +49,7 @@ class CoAPServer(CoAP):
...
@@ -49,7 +49,7 @@ class CoAPServer(CoAP):
print
(
useruuid
)
print
(
useruuid
)
currentTime
=
time
.
time
()
currentTime
=
time
.
time
()
trackingCursor
=
self
.
trackingCollection
.
find
({
'
$and
'
:[{
'
useruuid
'
:
useruuid
},
trackingCursor
=
self
.
trackingCollection
.
find
({
'
$and
'
:[{
'
useruuid
'
:
useruuid
},
{
'
updateTime
'
:{
'
$gt
'
:
currentTime
-
2
}}]})
{
'
updateTime
'
:{
'
$gt
'
:
currentTime
-
10
}}]})
#trackingCursor = self.trackingCollection.find({'$and':[{'useruuid':{'$eq' : useruuid}}]})
#trackingCursor = self.trackingCollection.find({'$and':[{'useruuid':{'$eq' : useruuid}}]})
userLocationData
=
[]
userLocationData
=
[]
...
...
This diff is collapsed.
Click to expand it.
Server_CoAP/CoAPthon3/exampleresources.py
+
12
−
4
View file @
c95c2fd9
...
@@ -49,6 +49,7 @@ class RpNodeInfoResource(Resource): #문제 없음.
...
@@ -49,6 +49,7 @@ class RpNodeInfoResource(Resource): #문제 없음.
def
deleteNodeData
(
self
,
info
):
#문제 없음
def
deleteNodeData
(
self
,
info
):
#문제 없음
info
=
info
[
'
rpMAC
'
]
info
=
info
[
'
rpMAC
'
]
graphColletion
=
self
.
db
.
RpGraphData
graphColletion
=
self
.
db
.
RpGraphData
if
self
.
collection
.
find
({
'
rpMAC
'
:
info
}).
count
()
!=
0
:
rpuuid
=
self
.
collection
.
find
({
'
rpMAC
'
:
info
})[
0
][
'
rpuuid
'
]
rpuuid
=
self
.
collection
.
find
({
'
rpMAC
'
:
info
})[
0
][
'
rpuuid
'
]
graphColletion
.
delete_many
({
'
v2
'
:
rpuuid
})
graphColletion
.
delete_many
({
'
v2
'
:
rpuuid
})
self
.
collection
.
delete_many
({
'
rpMAC
'
:
info
})
self
.
collection
.
delete_many
({
'
rpMAC
'
:
info
})
...
@@ -102,7 +103,9 @@ class RpNodeInfoResource(Resource): #문제 없음.
...
@@ -102,7 +103,9 @@ class RpNodeInfoResource(Resource): #문제 없음.
tempdoc
=
self
.
collection
.
find
({
'
rpuuid
'
:
doc
[
'
v1
'
]})
tempdoc
=
self
.
collection
.
find
({
'
rpuuid
'
:
doc
[
'
v1
'
]})
if
tempdoc
[
0
][
'
x
'
]
==
0
and
tempdoc
[
0
][
'
y
'
]
==
0
:
# 첫번째 RpNode 즉, (0,0)
if
tempdoc
[
0
][
'
x
'
]
==
0
and
tempdoc
[
0
][
'
y
'
]
==
0
:
# 첫번째 RpNode 즉, (0,0)
vertexA
=
tempdoc
[
0
]
# 첫번째 RpNode를 vertexA라 한다.
vertexA
=
tempdoc
[
0
]
# 첫번째 RpNode를 vertexA라 한다.
vertexB
=
tempdoc
[
1
]
vertexB
=
tempdoc
[
0
]
#두번째 RpNode를 vertexB라 한다.
vertexB
=
tempdoc
[
0
]
#두번째 RpNode를 vertexB라 한다.
vertexA
=
tempdoc
[
1
]
dis
=
{
dis
=
{
'
a
'
:
graphColletion
.
find
({
'
v1
'
:
vertexB
[
'
rpuuid
'
],
'
v2
'
:
info
})[
0
][
'
distance
'
],
'
a
'
:
graphColletion
.
find
({
'
v1
'
:
vertexB
[
'
rpuuid
'
],
'
v2
'
:
info
})[
0
][
'
distance
'
],
'
b
'
:
graphColletion
.
find
({
'
v1
'
:
vertexA
[
'
rpuuid
'
],
'
v2
'
:
info
})[
0
][
'
distance
'
],
'
b
'
:
graphColletion
.
find
({
'
v1
'
:
vertexA
[
'
rpuuid
'
],
'
v2
'
:
info
})[
0
][
'
distance
'
],
...
@@ -138,7 +141,9 @@ class RpNodeInfoResource(Resource): #문제 없음.
...
@@ -138,7 +141,9 @@ class RpNodeInfoResource(Resource): #문제 없음.
return
json
.
dumps
(
response
)
return
json
.
dumps
(
response
)
nodeList
=
[]
nodeList
=
[]
for
i
in
range
(
3
):
for
i
in
range
(
3
):
print
(
self
.
piNodeCollection
.
find
({
'
rpuuid
'
:
nodeLocationData
[
i
][
'
rpuuid
'
]})[
0
])
nodeList
.
append
({
nodeList
.
append
({
'
x
'
:
self
.
piNodeCollection
.
find
({
'
rpuuid
'
:
nodeLocationData
[
i
][
'
rpuuid
'
]})[
0
][
'
x
'
],
'
x
'
:
self
.
piNodeCollection
.
find
({
'
rpuuid
'
:
nodeLocationData
[
i
][
'
rpuuid
'
]})[
0
][
'
x
'
],
'
y
'
:
self
.
piNodeCollection
.
find
({
'
rpuuid
'
:
nodeLocationData
[
i
][
'
rpuuid
'
]})[
0
][
'
y
'
],
'
y
'
:
self
.
piNodeCollection
.
find
({
'
rpuuid
'
:
nodeLocationData
[
i
][
'
rpuuid
'
]})[
0
][
'
y
'
],
...
@@ -156,7 +161,10 @@ class RpNodeInfoResource(Resource): #문제 없음.
...
@@ -156,7 +161,10 @@ class RpNodeInfoResource(Resource): #문제 없음.
self
.
collection
.
update
({
'
rpuuid
'
:
info
},
{
'
$set
'
:{
'
x
'
:
x
,
'
y
'
:
y
}},
False
)
self
.
collection
.
update
({
'
rpuuid
'
:
info
},
{
'
$set
'
:{
'
x
'
:
x
,
'
y
'
:
y
}},
False
)
return
json
.
dump
(
response
)
return
json
.
dumps
(
response
)
else
:
response
[
'
operate
'
]
=
0
return
json
.
dumps
(
response
)
class
RpGraphInfoResource
(
Resource
):
#문제 없음
class
RpGraphInfoResource
(
Resource
):
#문제 없음
def
__init__
(
self
,
name
=
"
RpGraphInfo
"
):
def
__init__
(
self
,
name
=
"
RpGraphInfo
"
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment