Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
df-aggregator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
df-aggregator
Commits
c1cf0ef6
Commit
c1cf0ef6
authored
Dec 01, 2020
by
Corey Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Receiver handling improvements
parent
b3aa7c67
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
25 deletions
+81
-25
README.md
README.md
+17
-0
df-aggregator.py
df-aggregator.py
+31
-14
menu.css
static/menu.css
+29
-7
receiver_configurator.js
static/receiver_configurator.js
+0
-0
cesium.tpl
views/cesium.tpl
+4
-4
No files found.
README.md
View file @
c1cf0ef6
# DF Aggregator
## New Features 1 December 2020:
-
Receivers can be added from the WebUI
-
Click the + at the bottom of the receiver cards, enter the URL, click save.
Click the refresh button to update the cards and map.
-
A list of receiver URLs is now optional. Receivers are saved to the database.
-
Receivers are read from the database first. Duplicate receiver URLs are ignored.
-
You can mark a receiver as mobile.
-
Click the edit icon for the applicable receiver, click the checkbox to mark
it as mobile, then click save.
-
You can now delete receivers from the list. This will remove it from the map
and database. No historical data is affected.
-
You can now enable/disable LOB collection from individual receivers.
Click the power button to enable/disable.
-
Black is enabled, red is disabled.
-
If you lose connectivity to a receiver, that particular receiver will be disabled.
Click the power button to try to reconnect.
## Dependencies:
-
Python >= 3.6
-
[
numpy
](
https://numpy.org/install/
)
...
...
df-aggregator.py
View file @
c1cf0ef6
...
...
@@ -46,17 +46,16 @@ class receiver:
self
.
isAuto
=
True
# hashed_url = hashlib.md5(station_url.encode('utf-8')).hexdigest()
# self.uid = hashed_url[:5] + hashed_url[-5:]
try
:
self
.
update
()
except
:
raise
IOError
self
.
update
(
first_run
=
True
)
self
.
isActive
=
True
# Updates receiver from the remote URL
def
update
(
self
):
def
update
(
self
,
first_run
=
False
):
try
:
xml_contents
=
etree
.
parse
(
self
.
station_url
)
xml_station_id
=
xml_contents
.
find
(
'STATION_ID'
)
self
.
station_id
=
xml_station_id
.
text
if
first_run
:
xml_station_id
=
xml_contents
.
find
(
'STATION_ID'
)
self
.
station_id
=
xml_station_id
.
text
xml_doa_time
=
xml_contents
.
find
(
'TIME'
)
self
.
doa_time
=
int
(
xml_doa_time
.
text
)
xml_freq
=
xml_contents
.
find
(
'FREQUENCY'
)
...
...
@@ -81,7 +80,20 @@ class receiver:
except
KeyboardInterrupt
:
finish
()
except
:
raise
IOError
if
first_run
:
self
.
station_id
=
"Unknown"
self
.
latitude
=
0.0
self
.
longitude
=
0.0
self
.
heading
=
0.0
self
.
raw_doa
=
0.0
self
.
doa
=
0.0
self
.
frequency
=
0.0
self
.
power
=
0.0
self
.
confidence
=
0
self
.
doa_time
=
0
self
.
isActive
=
False
print
(
f
"Problem connecting to {self.station_url}, receiver deactivated. Reactivate in WebUI."
)
# raise IOError
# Returns receivers properties as a dict,
# useful for passing data to the WebUI
...
...
@@ -102,7 +114,6 @@ class receiver:
confidence
=
0
doa_time
=
0
isMobile
=
False
isActive
=
True
###############################################
# Converts Lat/Lon to polar coordinates
...
...
@@ -473,9 +484,11 @@ def update_cesium():
###############################################
@get
(
'/rx_params'
)
def
rx_params
():
write_czml
(
*
process_data
(
database_name
,
geofile
))
all_rx
=
{
'receivers'
:{}}
rx_properties
=
[]
for
index
,
x
in
enumerate
(
receivers
):
x
.
update
()
rx
=
x
.
receiver_dict
()
rx
[
'uid'
]
=
index
rx_properties
.
append
(
rx
)
...
...
@@ -497,6 +510,10 @@ def update_rx(action):
index
=
int
(
data
[
'uid'
])
del_receiver
(
receivers
[
index
]
.
station_id
)
del
receivers
[
index
]
elif
action
==
"activate"
:
index
=
int
(
data
[
'uid'
])
receivers
[
index
]
.
isActive
=
data
[
'state'
]
# print(f"RX {index} changed state to {data['state']}")
else
:
action
=
int
(
action
)
try
:
...
...
@@ -564,10 +581,10 @@ def run_receiver(receivers):
for
rx
in
receivers
:
try
:
rx
.
update
()
if
rx
.
isActive
:
rx
.
update
()
except
IOError
:
print
(
"Problem connecting to receiver."
)
ms
.
receiving
=
False
#
ms.receiving = False
time
.
sleep
(
1
)
if
dots
>
5
:
...
...
@@ -607,8 +624,9 @@ def add_receiver(receiver_url):
[
new_rx
[
'station_id'
]])
.
fetchone
()[
0
]
receivers
[
-
1
]
.
isMobile
=
bool
(
mobile
)
print
(
"Created new DF Station at "
+
receiver_url
)
except
IOError
:
ms
.
receiving
=
False
except
AttributeError
:
pass
conn
.
close
()
###############################################
...
...
@@ -716,7 +734,6 @@ if __name__ == '__main__':
###############################################
read_rx_table
()
if
rx_file
:
print
(
"I got a file!"
)
with
open
(
rx_file
,
"r"
)
as
file2
:
receiver_list
=
file2
.
readlines
()
for
x
in
receiver_list
:
...
...
static/menu.css
View file @
c1cf0ef6
...
...
@@ -110,6 +110,21 @@ body {
transition
:
transform
0.5s
cubic-bezier
(
0.77
,
0.2
,
0.05
,
1.0
);
}
#add_station
{
width
:
23px
;
height
:
23px
;
}
#new_rx_div
{
position
:
relative
;
background
:
#d4d4d4
;
color
:
#111
;
font-weight
:
bold
;
padding
:
5px
;
margin
:
5px
;
vertical-align
:
middle
;
}
.receiver
{
position
:
relative
;
background
:
#d4d4d4
;
...
...
@@ -138,6 +153,20 @@ body {
font-size
:
23pt
;
}
.delete-icon
{
display
:
block
;
position
:
absolute
;
top
:
5px
;
right
:
30px
;
}
.activate-icon
{
display
:
block
;
position
:
absolute
;
top
:
5px
;
right
:
60px
;
}
.edit-checkbox
{
cursor
:
pointer
;
opacity
:
0
;
/* hide this */
...
...
@@ -146,13 +175,6 @@ body {
height
:
20px
;
}
.delete-icon
{
display
:
block
;
position
:
absolute
;
top
:
5px
;
right
:
30px
;
}
.no-select
{
-webkit-user-select
:
none
;
/* Safari */
-khtml-user-select
:
none
;
/* Konqueror HTML */
...
...
static/receiver_configurator.js
View file @
c1cf0ef6
This diff is collapsed.
Click to expand it.
views/cesium.tpl
View file @
c1cf0ef6
...
...
@@ -37,7 +37,7 @@
loadRx
(
refreshRx
);
clearOld
();
loadCzml
();
console
.
log
(
response
);
//
console.log(response);
}
})
}
...
...
@@ -45,13 +45,13 @@
function
loadCzml
()
{
var
dataSourcePromise
=
Cesium
.
CzmlDataSource
.
load
(
'/static/output.czml'
);
viewer
.
dataSources
.
add
(
dataSourcePromise
);
console
.
log
(
"Loaded CZML"
);
//
console.log("Loaded CZML");
return
dataSourcePromise
;
}
function
clearOld
()
{
viewer
.
dataSources
.
removeAll
(
true
);
console
.
log
(
"Cleared old"
);
//
console.log("Cleared old");
}
// Add Cesium OSM Buildings, a global 3D buildings layer.
...
...
@@ -71,7 +71,7 @@
<input
id=
"add_station"
class=
"edit-checkbox add-icon"
type=
"checkbox"
style=
"width: 23px; height: 23px;"
/>
<span
id=
"add_station_icon"
class=
"material-icons add-icon no-select"
>
add_circle_outline
</span>
<div
style=
"visibility: hidden; height: 0;"
id=
"new_rx_div"
style=
"padding: 0;"
class=
"receiver"
>
<div
style=
"visibility: hidden; height: 0;"
id=
"new_rx_div"
style=
"padding: 0;"
>
<span
id=
"new-url"
>
Station URL:
</span>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment