Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fpbuilder_ble
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jaehyu
fpbuilder_ble
Commits
d87eef10
Commit
d87eef10
authored
Dec 02, 2016
by
jaehyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
location coordinate
parent
1b8504da
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
79 deletions
+66
-79
src/main/java/com/skt/ehs/mbs/fpbuilder/BLECell.java
src/main/java/com/skt/ehs/mbs/fpbuilder/BLECell.java
+7
-65
src/main/java/com/skt/ehs/mbs/fpbuilder/BLEFPBuilder.java
src/main/java/com/skt/ehs/mbs/fpbuilder/BLEFPBuilder.java
+40
-6
src/main/java/com/skt/ehs/mbs/fpbuilder/Floor.java
src/main/java/com/skt/ehs/mbs/fpbuilder/Floor.java
+19
-8
No files found.
src/main/java/com/skt/ehs/mbs/fpbuilder/BLECell.java
View file @
d87eef10
...
@@ -6,18 +6,13 @@ package com.skt.ehs.mbs.fpbuilder;
...
@@ -6,18 +6,13 @@ package com.skt.ehs.mbs.fpbuilder;
public
class
BLECell
{
public
class
BLECell
{
private
int
ble_cell_id
;
private
int
ble_cell_id
;
private
double
location_x
;
private
int
location_x
;
private
double
location_y
;
// 실거리 ??
private
int
location_y
;
// 실거리 ??
private
double
rssi_min
;
private
double
rssi_max
;
private
double
rssi_avg
;
private
double
rssi_std_dev
;
private
int
rssi_dir
;
BLECell
(
int
id
)
{
BLECell
(
int
id
)
{
ble_cell_id
=
id
;
ble_cell_id
=
id
;
}
}
double
mag_angle
;
// 해당 cell의 각 수집방향에 대하여 수집된 지자기방향의 평균값으로 대표
public
int
getBle_cell_id
()
{
public
int
getBle_cell_id
()
{
return
ble_cell_id
;
return
ble_cell_id
;
...
@@ -27,69 +22,22 @@ public class BLECell {
...
@@ -27,69 +22,22 @@ public class BLECell {
this
.
ble_cell_id
=
ble_cell_id
;
this
.
ble_cell_id
=
ble_cell_id
;
}
}
public
double
getLocation_x
()
{
public
int
getLocation_x
()
{
return
location_x
;
return
location_x
;
}
}
public
void
setLocation_x
(
double
location_x
)
{
public
void
setLocation_x
(
int
location_x
)
{
this
.
location_x
=
location_x
;
this
.
location_x
=
location_x
;
}
}
public
double
getLocation_y
()
{
public
int
getLocation_y
()
{
return
location_y
;
return
location_y
;
}
}
public
void
setLocation_y
(
double
location_y
)
{
public
void
setLocation_y
(
int
location_y
)
{
this
.
location_y
=
location_y
;
this
.
location_y
=
location_y
;
}
}
public
double
getRssi_min
()
{
return
rssi_min
;
}
public
void
setRssi_min
(
double
rssi_min
)
{
this
.
rssi_min
=
rssi_min
;
}
public
double
getRssi_max
()
{
return
rssi_max
;
}
public
void
setRssi_max
(
double
rssi_max
)
{
this
.
rssi_max
=
rssi_max
;
}
public
double
getRssi_avg
()
{
return
rssi_avg
;
}
public
void
setRssi_avg
(
double
rssi_avg
)
{
this
.
rssi_avg
=
rssi_avg
;
}
public
double
getRssi_std_dev
()
{
return
rssi_std_dev
;
}
public
void
setRssi_std_dev
(
double
rssi_std_dev
)
{
this
.
rssi_std_dev
=
rssi_std_dev
;
}
public
int
getRssi_dir
()
{
return
rssi_dir
;
}
public
void
setRssi_dir
(
int
rssi_dir
)
{
this
.
rssi_dir
=
rssi_dir
;
}
public
double
getMagnitude_angle
()
{
return
mag_angle
;
}
public
void
setMagnitude_angle
(
double
magnitude_angle
)
{
this
.
mag_angle
=
magnitude_angle
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
...
@@ -97,12 +45,6 @@ public class BLECell {
...
@@ -97,12 +45,6 @@ public class BLECell {
"ble_cell_id="
+
ble_cell_id
+
"ble_cell_id="
+
ble_cell_id
+
", location_x="
+
location_x
+
", location_x="
+
location_x
+
", location_y="
+
location_y
+
", location_y="
+
location_y
+
", rssi_min="
+
rssi_min
+
", rssi_max="
+
rssi_max
+
", rssi_avg="
+
rssi_avg
+
", rssi_std_dev="
+
rssi_std_dev
+
", rssi_dir="
+
rssi_dir
+
", mag_angle="
+
mag_angle
+
'}'
;
'}'
;
}
}
}
}
src/main/java/com/skt/ehs/mbs/fpbuilder/BLEFPBuilder.java
View file @
d87eef10
...
@@ -3,6 +3,8 @@ package com.skt.ehs.mbs.fpbuilder;
...
@@ -3,6 +3,8 @@ package com.skt.ehs.mbs.fpbuilder;
import
com.skt.ehs.mbs.db.maria.DBManager
;
import
com.skt.ehs.mbs.db.maria.DBManager
;
import
com.skt.ehs.mbs.db.maria.MariaConnectionManager
;
import
com.skt.ehs.mbs.db.maria.MariaConnectionManager
;
import
java.util.Arrays
;
public
class
BLEFPBuilder
{
public
class
BLEFPBuilder
{
public
static
final
int
CELL_SIZE_BLE
=
300
;
public
static
final
int
CELL_SIZE_BLE
=
300
;
...
@@ -63,23 +65,55 @@ public class BLEFPBuilder {
...
@@ -63,23 +65,55 @@ public class BLEFPBuilder {
return
ret
;
return
ret
;
}
}
public
boolean
build
()
{
public
boolean
build
()
{
double
scale_pixel
=
readMapScale
();
double
scale_pixel
=
readMapScale
();
System
.
out
.
println
(
"scale_pixel : "
+
scale_pixel
);
System
.
out
.
println
(
"scale_pixel : "
+
scale_pixel
);
mFloor
.
setMap_scale_pixel
(
scale_pixel
);
// Todo access DB & calculate factor & build fp.
// Todo access DB & calculate factor & build fp.
// 수집방향 맵 준비
int
[]
temp
=
mFloor
.
loadRSSIDir
();
System
.
out
.
println
(
Arrays
.
toString
(
temp
));
/* Todo 8분위 되어 있는 기준값을 단말기에서 올려주는 값의 범위로 바꾸어 사용할 수 있도록 준비
switch case 사용
*/
// location coordinate 준비
BLECell
bleCell
=
mFloor
.
getBLECell
(
3
,
5
);
System
.
out
.
printf
(
"Location : ("
+
bleCell
.
getLocation_x
()+
", "
+
bleCell
.
getLocation_y
()+
")"
);
System
.
out
.
println
();
int
coordinate_pixel_x1
=
(
mFloor
.
getBLECell
(
3
,
5
).
getLocation_x
()
-
CELL_SIZE_BLE
/
2
)
/
(
int
)
mFloor
.
getMap_scale_pixel
();
int
coordinate_pixel_y1
=
(
mFloor
.
getBLECell
(
3
,
5
).
getLocation_y
()
-
CELL_SIZE_BLE
/
2
)
/
(
int
)
mFloor
.
getMap_scale_pixel
();
int
coordinate_pixel_x2
=
(
mFloor
.
getBLECell
(
3
,
5
).
getLocation_x
()
+
CELL_SIZE_BLE
/
2
)
/
(
int
)
mFloor
.
getMap_scale_pixel
();
int
coordinate_pixel_y2
=
(
mFloor
.
getBLECell
(
3
,
5
).
getLocation_y
()
+
CELL_SIZE_BLE
/
2
)
/
(
int
)
mFloor
.
getMap_scale_pixel
();
System
.
out
.
printf
(
"Pixel Coordinate : ("
+
coordinate_pixel_x1
+
", "
+
coordinate_pixel_y1
+
") ("
+
coordinate_pixel_x2
+
", "
+
coordinate_pixel_y2
+
")"
);
System
.
out
.
println
();
return
true
;
return
true
;
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
BLEFPBuilder
blefpBuilder
=
new
BLEFPBuilder
((
LENGTH_X
%
CELL_SIZE_BLE
==
0
)?
LENGTH_X
/
CELL_SIZE_BLE
:
LENGTH_X
/
CELL_SIZE_BLE
+
1
,(
WIDTH_Y
%
CELL_SIZE_BLE
==
0
)?
WIDTH_Y
/
CELL_SIZE_BLE
:
WIDTH_Y
/
CELL_SIZE_BLE
+
1
);
// mFloor
BLEFPBuilder
bleFPBuilder
=
new
BLEFPBuilder
((
LENGTH_X
%
CELL_SIZE_BLE
==
0
)?
LENGTH_X
/
CELL_SIZE_BLE
:
LENGTH_X
/
CELL_SIZE_BLE
+
1
,(
WIDTH_Y
%
CELL_SIZE_BLE
==
0
)?
WIDTH_Y
/
CELL_SIZE_BLE
:
WIDTH_Y
/
CELL_SIZE_BLE
+
1
);
// mFloor
blefpBuilder
.
LoadCellID
();
bleFPBuilder
.
LoadCellID
();
blefpBuilder
.
LoadCellLocation
();
bleFPBuilder
.
LoadCellLocation
();
if
(!
blefpBuilder
.
LoadDBConnectionPool
())
{
if
(!
bleFPBuilder
.
LoadDBConnectionPool
())
{
//exit
//exit
}
}
ble
fp
Builder
.
build
();
ble
FP
Builder
.
build
();
}
}
}
}
src/main/java/com/skt/ehs/mbs/fpbuilder/Floor.java
View file @
d87eef10
...
@@ -8,18 +8,24 @@ package com.skt.ehs.mbs.fpbuilder;
...
@@ -8,18 +8,24 @@ package com.skt.ehs.mbs.fpbuilder;
class
Floor
{
class
Floor
{
private
int
M
;
private
int
M
;
private
int
N
;
private
int
N
;
private
BLECell
[][]
fp
;
// FingerPrint
private
BLECell
[][]
cm
;
// cell matrix
// 수집방향
private
final
int
[]
rssi_dir
=
new
int
[]{
1000000
,
2000000
,
3000000
,
4000000
,
5000000
,
6000000
,
7000000
,
8000000
};
// FingerPrint
public
Floor
(
int
M
,
int
N
)
{
public
Floor
(
int
M
,
int
N
)
{
this
.
M
=
M
;
this
.
M
=
M
;
this
.
N
=
N
;
this
.
N
=
N
;
fp
=
new
BLECell
[
M
][
N
];
cm
=
new
BLECell
[
M
][
N
];
}
}
public
void
showCellID
()
{
public
void
showCellID
()
{
for
(
int
j
=
0
;
j
<
N
;
j
++)
{
for
(
int
j
=
0
;
j
<
N
;
j
++)
{
for
(
int
i
=
0
;
i
<
M
;
i
++)
{
for
(
int
i
=
0
;
i
<
M
;
i
++)
{
System
.
out
.
printf
(
"%9d "
,
fp
[
i
][
j
].
getBle_cell_id
());
System
.
out
.
printf
(
"%9d "
,
cm
[
i
][
j
].
getBle_cell_id
());
}
}
System
.
out
.
println
();
System
.
out
.
println
();
}
}
...
@@ -28,7 +34,7 @@ class Floor {
...
@@ -28,7 +34,7 @@ class Floor {
public
void
showCellLocation
()
{
public
void
showCellLocation
()
{
for
(
int
j
=
0
;
j
<
N
;
j
++)
{
for
(
int
j
=
0
;
j
<
N
;
j
++)
{
for
(
int
i
=
0
;
i
<
M
;
i
++)
{
for
(
int
i
=
0
;
i
<
M
;
i
++)
{
System
.
out
.
printf
(
"("
+
fp
[
i
][
j
].
getLocation_x
()+
","
+
fp
[
i
][
j
].
getLocation_y
()+
")"
);
System
.
out
.
printf
(
"("
+
cm
[
i
][
j
].
getLocation_x
()+
","
+
cm
[
i
][
j
].
getLocation_y
()+
")"
);
}
}
System
.
out
.
println
();
System
.
out
.
println
();
}
}
...
@@ -51,15 +57,16 @@ class Floor {
...
@@ -51,15 +57,16 @@ class Floor {
}
}
public
BLECell
getBLECell
(
int
M
,
int
N
)
{
public
BLECell
getBLECell
(
int
M
,
int
N
)
{
return
fp
[
M
][
N
];
return
cm
[
M
][
N
];
}
}
public
void
setBLECell
(
int
M
,
int
N
,
BLECell
bleCell
)
{
public
void
setBLECell
(
int
M
,
int
N
,
BLECell
bleCell
)
{
fp
[
M
][
N
]
=
bleCell
;
cm
[
M
][
N
]
=
bleCell
;
}
}
public
void
setBLECellLocation
(
int
M
,
int
N
,
int
x
,
int
y
)
{
public
void
setBLECellLocation
(
int
M
,
int
N
,
int
x
,
int
y
)
{
fp
[
M
][
N
].
setLocation_x
(
x
);
cm
[
M
][
N
].
setLocation_x
(
x
);
fp
[
M
][
N
].
setLocation_y
(
y
);
cm
[
M
][
N
].
setLocation_y
(
y
);
}
}
double
map_scale_pixel
;
double
map_scale_pixel
;
...
@@ -81,4 +88,8 @@ class Floor {
...
@@ -81,4 +88,8 @@ class Floor {
public
void
setBle_cell_size
(
int
ble_cell_size
)
{
public
void
setBle_cell_size
(
int
ble_cell_size
)
{
this
.
ble_cell_size
=
ble_cell_size
;
this
.
ble_cell_size
=
ble_cell_size
;
}
}
public
int
[]
loadRSSIDir
()
{
return
rssi_dir
;
}
}
}
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