Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
winaps-server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pierre-antoine Comby
winaps-server
Commits
7cd7b14e
Commit
7cd7b14e
authored
Aug 29, 2019
by
Pierre-antoine Comby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
final commit ?
parent
c29d48b6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
234 additions
and
4 deletions
+234
-4
indoor/management/commands/make_fp.py
indoor/management/commands/make_fp.py
+41
-0
indoor/migrations/0001_initial.py
indoor/migrations/0001_initial.py
+163
-0
indoor/migrations/0002_auto_20190821_2108.py
indoor/migrations/0002_auto_20190821_2108.py
+24
-0
indoor/models.py
indoor/models.py
+5
-3
indoor/templates/indoor/landmark_detail.html
indoor/templates/indoor/landmark_detail.html
+1
-1
No files found.
indoor/management/commands/make_fp.py
0 → 100644
View file @
7cd7b14e
#!/usr/bin/env python
from
django.core.management.base
import
BaseCommand
from
django.conf
import
settings
from
django.apps
import
apps
from
indoor.models
import
*
from
django.db
import
transaction
# from django.contrib.gis.geos import GEOSGeometry
import
csv
import
os
BDD_DIR
=
"media/bdd/Base"
WIFI
=
{
"LANDMARK_ID"
:
"landmark_id"
,
"MINIMUM"
:
"min_val"
,
"MAXIMUM"
:
"max_val"
,
"HOTSPOT_ID"
:
"emitter_id"
"HITS"
:
"hits"
,
"AVERAGE"
:
"average"
,
"DEVIATION"
:
"deviation"
,
}
BLUETOOTH
=
{
}
class
Command
(
BaseCommand
):
help
=
"Import a csv file to a model"
def
add_arguments
(
self
,
parser
):
parser
.
add_argument
(
"--type"
,
type
=
str
,
help
=
"Bluetooth or Wifi "
)
parser
.
add_argument
(
"--file"
,
type
=
str
,
help
=
"csv file for import"
)
def
handle
(
self
,
*
args
,
**
options
):
filename
=
options
.
get
(
"file"
,
None
)
with
open
(
os
.
path
.
join
(
BDD_DIR
,
filename
),
'r'
,
encoding
=
'utf-8'
)
as
csv_file
:
reader
=
csv
.
reader
((
line
.
replace
(
'
\0
'
,
''
)
for
line
in
csv_file
),
delimiter
=
";"
)
header
=
next
(
reader
)
with
transaction
.
atomic
():
for
row
in
reader
:
for
key
,
value
in
zip
(
header
,
row
):
indoor/migrations/0001_initial.py
0 → 100644
View file @
7cd7b14e
# Generated by Django 2.2.1 on 2019-08-07 22:03
import
django.contrib.gis.db.models.fields
from
django.db
import
migrations
,
models
import
django.db.models.deletion
import
uuid
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'BtEmitter'
,
fields
=
[
(
'id'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
)),
(
'ssid'
,
models
.
CharField
(
max_length
=
255
)),
(
'mac_adress'
,
models
.
CharField
(
max_length
=
17
)),
(
'active_flag'
,
models
.
BooleanField
()),
(
'namespace'
,
models
.
CharField
(
max_length
=
255
)),
(
'frame_name'
,
models
.
CharField
(
max_length
=
255
)),
(
'instance'
,
models
.
CharField
(
max_length
=
255
)),
],
options
=
{
'abstract'
:
False
,
},
),
migrations
.
CreateModel
(
name
=
'Building'
,
fields
=
[
(
'id'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
)),
(
'name'
,
models
.
CharField
(
max_length
=
255
)),
],
),
migrations
.
CreateModel
(
name
=
'FileMeasure'
,
fields
=
[
(
'id'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
)),
(
'name'
,
models
.
CharField
(
max_length
=
255
)),
(
'brand'
,
models
.
CharField
(
max_length
=
255
)),
(
'model'
,
models
.
CharField
(
max_length
=
255
)),
(
'write_time'
,
models
.
DateTimeField
()),
(
'lines'
,
models
.
IntegerField
()),
(
'duplicates'
,
models
.
IntegerField
()),
],
),
migrations
.
CreateModel
(
name
=
'Floor'
,
fields
=
[
(
'id'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
)),
(
'name'
,
models
.
CharField
(
blank
=
True
,
max_length
=
255
)),
(
'elevation'
,
models
.
IntegerField
()),
(
'building'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.Building'
)),
],
),
migrations
.
CreateModel
(
name
=
'Landmark'
,
fields
=
[
(
'id'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
)),
(
'active_flag'
,
models
.
BooleanField
()),
(
'pos'
,
django
.
contrib
.
gis
.
db
.
models
.
fields
.
PointField
(
srid
=
4326
)),
(
'alt'
,
models
.
IntegerField
()),
(
'tag'
,
models
.
CharField
(
max_length
=
255
)),
(
'filelink'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.FileMeasure'
)),
(
'floor'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.Floor'
)),
],
),
migrations
.
CreateModel
(
name
=
'WifiEmitter'
,
fields
=
[
(
'id'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
)),
(
'ssid'
,
models
.
CharField
(
max_length
=
255
)),
(
'mac_adress'
,
models
.
CharField
(
max_length
=
17
)),
(
'active_flag'
,
models
.
BooleanField
()),
(
'high_freq'
,
models
.
BooleanField
()),
(
'building'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.Building'
)),
],
options
=
{
'abstract'
:
False
,
},
),
migrations
.
CreateModel
(
name
=
'WifiMeasure'
,
fields
=
[
(
'id'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
)),
(
'moment'
,
models
.
DateTimeField
()),
(
'mac_adress'
,
models
.
CharField
(
max_length
=
255
)),
(
'level'
,
models
.
IntegerField
()),
(
'count'
,
models
.
IntegerField
()),
(
'frequency'
,
models
.
IntegerField
()),
(
'capabilities'
,
models
.
CharField
(
max_length
=
255
)),
(
'ssid'
,
models
.
CharField
(
max_length
=
255
)),
(
'filelink'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.FileMeasure'
)),
],
options
=
{
'abstract'
:
False
,
},
),
migrations
.
CreateModel
(
name
=
'WifiFingerprint'
,
fields
=
[
(
'hits'
,
models
.
IntegerField
()),
(
'id'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
)),
(
'min_val'
,
models
.
FloatField
()),
(
'max_val'
,
models
.
FloatField
()),
(
'average'
,
models
.
FloatField
()),
(
'deviation'
,
models
.
FloatField
()),
(
'emitter'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.WifiEmitter'
)),
(
'landmark'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.Landmark'
)),
],
options
=
{
'abstract'
:
False
,
},
),
migrations
.
AddField
(
model_name
=
'filemeasure'
,
name
=
'floor'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.Floor'
),
),
migrations
.
CreateModel
(
name
=
'BtMeasure'
,
fields
=
[
(
'id'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
)),
(
'moment'
,
models
.
DateTimeField
()),
(
'mac_adress'
,
models
.
CharField
(
max_length
=
255
)),
(
'level'
,
models
.
IntegerField
()),
(
'count'
,
models
.
IntegerField
()),
(
'frame_content'
,
models
.
CharField
(
max_length
=
1024
)),
(
'name'
,
models
.
CharField
(
max_length
=
255
)),
(
'namespace'
,
models
.
CharField
(
max_length
=
255
)),
(
'instance'
,
models
.
CharField
(
max_length
=
255
)),
(
'filelink'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.FileMeasure'
)),
],
options
=
{
'abstract'
:
False
,
},
),
migrations
.
CreateModel
(
name
=
'BtFingerprint'
,
fields
=
[
(
'hits'
,
models
.
IntegerField
()),
(
'id'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
)),
(
'min_val'
,
models
.
FloatField
()),
(
'max_val'
,
models
.
FloatField
()),
(
'average'
,
models
.
FloatField
()),
(
'deviation'
,
models
.
FloatField
()),
(
'emitter'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.BtEmitter'
)),
(
'landmark'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.Landmark'
)),
],
options
=
{
'abstract'
:
False
,
},
),
migrations
.
AddField
(
model_name
=
'btemitter'
,
name
=
'building'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'indoor.Building'
),
),
]
indoor/migrations/0002_auto_20190821_2108.py
0 → 100644
View file @
7cd7b14e
# Generated by Django 2.2.1 on 2019-08-21 21:08
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'indoor'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'btfingerprint'
,
name
=
'landmark'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'indoor.Landmark'
),
),
migrations
.
AlterField
(
model_name
=
'wififingerprint'
,
name
=
'landmark'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'indoor.Landmark'
),
),
]
indoor/models.py
View file @
7cd7b14e
...
@@ -81,9 +81,11 @@ class Landmark(models.Model):
...
@@ -81,9 +81,11 @@ class Landmark(models.Model):
ret
=
""
ret
=
""
fingerprints
=
self
.
wififingerprint_set
.
all
()
fingerprints
=
self
.
wififingerprint_set
.
all
()
for
fp
in
fingerprints
:
for
fp
in
fingerprints
:
ret
+=
"Emetteur:{}</br>"
.
format
(
fp
.
emitter
.
ssid
)
ret
+=
"<b>ssid:{} bssid: {}</b></br>"
.
format
(
fp
.
emitter
.
ssid
,
fp
.
emitter
.
mac_adress
)
ret
+=
"min: {} max: {}</br>"
.
format
(
fp
.
min_val
,
fp
.
max_val
)
ret
+=
"min: {} max: {}mean: {} ,std: {} </br>"
.
format
(
fp
.
min_val
,
ret
+=
"mean: {} ,std: {} </br>"
.
format
(
fp
.
average
,
fp
.
deviation
)
fp
.
max_val
,
fp
.
average
,
fp
.
deviation
)
return
ret
return
ret
...
...
indoor/templates/indoor/landmark_detail.html
View file @
7cd7b14e
...
@@ -104,8 +104,8 @@
...
@@ -104,8 +104,8 @@
alert
(
"
les niveaux sont en rouge, les boutiques en bleu
"
)
alert
(
"
les niveaux sont en rouge, les boutiques en bleu
"
)
for
(
var
floor
in
floors
){
for
(
var
floor
in
floors
){
overlaysObj
[
floor
]
=
L
.
layerGroup
(
floors
[
floor
]);
overlaysObj
[
floor
]
=
L
.
layerGroup
(
floors
[
floor
]);
map
.
addLayer
(
overlaysObj
[
floor
]);
}
}
map
.
addLayer
(
overlaysObj
[
2
]);
L
.
control
.
layers
({},
overlaysObj
).
addTo
(
map
);
L
.
control
.
layers
({},
overlaysObj
).
addTo
(
map
);
map
.
fitBounds
(
shops
.
getBounds
());
map
.
fitBounds
(
shops
.
getBounds
());
}
}
...
...
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