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
1b8504da
Commit
1b8504da
authored
Dec 01, 2016
by
jaehyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restructuring
parent
8d33d5d1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
157 deletions
+112
-157
src/main/java/com/skt/ehs/mbs/conf/Configure.java
src/main/java/com/skt/ehs/mbs/conf/Configure.java
+0
-8
src/main/java/com/skt/ehs/mbs/fpbuilder/BLECell.java
src/main/java/com/skt/ehs/mbs/fpbuilder/BLECell.java
+12
-9
src/main/java/com/skt/ehs/mbs/fpbuilder/BLEFPBuilder.java
src/main/java/com/skt/ehs/mbs/fpbuilder/BLEFPBuilder.java
+57
-47
src/main/java/com/skt/ehs/mbs/fpbuilder/Floor.java
src/main/java/com/skt/ehs/mbs/fpbuilder/Floor.java
+43
-2
src/main/java/com/skt/ehs/mbs/fpbuilder/Initializer.java
src/main/java/com/skt/ehs/mbs/fpbuilder/Initializer.java
+0
-91
No files found.
src/main/java/com/skt/ehs/mbs/conf/Configure.java
View file @
1b8504da
...
...
@@ -31,12 +31,4 @@ public class Configure {
// TODO : 파일을 로딩해야 합니다.
// TODO : 로딩한 값을 변수에 설정해 주어야 합니다.
}
public
static
final
double
CELL_SIZE_BLE
=
300
;
public
static
final
double
CELL_SIZE_MAG
=
50
;
public
static
final
double
LENGTH_PIXEL_X
=
350
;
// 층의 X축방향 길이
public
static
final
double
WIDTH_PIXEL_Y
=
200
;
// 폭
}
src/main/java/com/skt/ehs/mbs/fpbuilder/BLECell.java
View file @
1b8504da
...
...
@@ -5,15 +5,18 @@ package com.skt.ehs.mbs.fpbuilder;
*/
public
class
BLECell
{
int
ble_cell_id
;
double
location_x
;
double
location_y
;
// 실거리 ??
double
rssi_min
;
double
rssi_max
;
double
rssi_avg
;
double
rssi_std_dev
;
int
rssi_dir
;
private
int
ble_cell_id
;
private
double
location_x
;
private
double
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
)
{
ble_cell_id
=
id
;
}
double
mag_angle
;
// 해당 cell의 각 수집방향에 대하여 수집된 지자기방향의 평균값으로 대표
public
int
getBle_cell_id
()
{
...
...
src/main/java/com/skt/ehs/mbs/fpbuilder/BLEFPBuilder.java
View file @
1b8504da
package
com.skt.ehs.mbs.fpbuilder
;
import
com.skt.ehs.mbs.conf.Configure
;
import
com.skt.ehs.mbs.db.maria.DBManager
;
import
com.skt.ehs.mbs.db.maria.MariaConnectionManager
;
import
com.skt.ehs.mbs.db.maria.vo.RawDataTag
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.List
;
/*
이 class 는 Java 8 의 stream API 와 lambda expression 을 사용함으로,
intellj 컴파일에 문제가 있으면 ,
메뉴중, 'Project Structure' -> 'Project' -> 'project language level' 이
'8 - lambda' 로 세팅되어야 합니다.
by jaehyu 2016-11-28
*/
public
class
BLEFPBuilder
{
private
Floor
mFloor
;
public
static
final
int
CELL_SIZE_BLE
=
300
;
public
static
final
int
LENGTH_X
=
8000
;
public
static
final
int
WIDTH_Y
=
4000
;
boolean
build_FP_BLE_CELL
()
{
int
mag_per_ble
=
(
int
)(
Configure
.
CELL_SIZE_BLE
/
Configure
.
CELL_SIZE_MAG
);
Floor
mFloor
;
return
false
;
public
BLEFPBuilder
(
int
M
,
int
N
)
{
mFloor
=
new
Floor
(
M
,
N
);
}
/* Todo
층(floor) 단면에 대하여 x축방향 길이 (Configure.LENGTH_X) 와
폭 (Configure.WIDTH_Y) 을 성분으로 하는 가상 Matrix를 구성한다.
*/
public
void
LoadCellLocation
()
{
int
location_x
=
0
;
int
location_y
=
0
;
for
(
int
x
=
1
;
x
<=
mFloor
.
getM
();
x
++)
{
location_x
=
CELL_SIZE_BLE
*
x
-
CELL_SIZE_BLE
/
2
;
for
(
int
y
=
1
;
y
<=
mFloor
.
getN
();
y
++)
{
location_y
=
CELL_SIZE_BLE
*
y
-
CELL_SIZE_BLE
/
2
;
// Todo calculate x,y
mFloor
.
setBLECellLocation
(
x
-
1
,
y
-
1
,
location_x
,
location_y
);
}
}
mFloor
.
showCellLocation
();
}
public
void
LoadCellID
()
{
for
(
int
x
=
1
;
x
<=
mFloor
.
getM
();
x
++)
{
int
id
=
0
;
int
id_x
=
1000
*
x
;
for
(
int
y
=
1
;
y
<=
mFloor
.
getN
();
y
++)
{
id
=
id_x
+
y
;
BLECell
bleCell
=
new
BLECell
(
id
);
mFloor
.
setBLECell
(
x
-
1
,
y
-
1
,
bleCell
);
}
}
mFloor
.
showCellID
();
}
public
boolean
LoadDBConnectionPool
()
{
if
(!
MariaConnectionManager
.
getInstance
().
makeConnectionPool
())
return
false
;
return
true
;
}
static
boolean
processor
()
{
System
.
out
.
println
(
"Hello processor"
);
private
static
double
readMapScale
()
{
int
iCampusID
=
1
;
// Todo console 에서 받아옴
int
iBuildingID
=
1
;
// Todo console 에서 받아옴
int
iFloorID
=
1
;
// Todo console 에서 받아옴
double
ret
=
0
;
// package-only-list from raw_data_tag
List
<
RawDataTag
>
rawdata
=
Collections
.
emptyList
();
List
<
RawDataTag
>
packNameList
=
Collections
.
emptyList
();
try
{
r
awdata
=
DBManager
.
getRawDataTag
(
DBManager
.
COMMAND_OPTION_GETRAWDATATAG
,
1
,
1
,
1
);
// packNameList = DBManager.getRawDataTag(DBManager.COMMAND_OPTION_GETPACKAGE,1,1,1);
r
et
=
DBManager
.
getMapScale
(
iCampusID
,
iBuildingID
,
iFloorID
);
}
catch
(
Throwable
throwable
)
{
throwable
.
printStackTrace
();
}
System
.
out
.
println
(
rawdata
.
size
());
/*
try {
// 스케일값을 DB에 넣기 위한 임시코드
DBManager.updateMapImage(DBManager.COMMAND_OPTION_UPDATESCALEPIXEL,10.00,2);
} catch (Throwable throwable) {
throwable.printStackTrace();
}*/
return
ret
;
}
public
boolean
build
()
{
double
scale_pixel
=
readMapScale
();
System
.
out
.
println
(
"scale_pixel : "
+
scale_pixel
);
// Todo access DB & calculate factor & build fp.
return
true
;
}
public
static
void
main
(
String
[]
args
)
{
Initializer
.
compose
();
//processor();
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
.
LoadCellLocation
();
if
(!
blefpBuilder
.
LoadDBConnectionPool
())
{
//exit
}
blefpBuilder
.
build
();
}
}
src/main/java/com/skt/ehs/mbs/fpbuilder/Floor.java
View file @
1b8504da
...
...
@@ -6,13 +6,50 @@ package com.skt.ehs.mbs.fpbuilder;
* Matrix의 각 element는 값으로 BLECell 타입의 Object를 가지게 된다
*/
class
Floor
{
BLECell
[][]
fp
;
// FingerPrint
private
int
M
;
private
int
N
;
private
BLECell
[][]
fp
;
// FingerPrint
public
Floor
(
int
M
,
int
N
)
{
this
.
M
=
M
;
this
.
N
=
N
;
fp
=
new
BLECell
[
M
][
N
];
}
public
void
showCellID
()
{
for
(
int
j
=
0
;
j
<
N
;
j
++)
{
for
(
int
i
=
0
;
i
<
M
;
i
++)
{
System
.
out
.
printf
(
"%9d "
,
fp
[
i
][
j
].
getBle_cell_id
());
}
System
.
out
.
println
();
}
}
public
void
showCellLocation
()
{
for
(
int
j
=
0
;
j
<
N
;
j
++)
{
for
(
int
i
=
0
;
i
<
M
;
i
++)
{
System
.
out
.
printf
(
"("
+
fp
[
i
][
j
].
getLocation_x
()+
","
+
fp
[
i
][
j
].
getLocation_y
()+
")"
);
}
System
.
out
.
println
();
}
}
public
int
getM
()
{
return
M
;
}
public
void
setM
(
int
m
)
{
M
=
m
;
}
public
int
getN
()
{
return
N
;
}
public
void
setN
(
int
n
)
{
N
=
n
;
}
public
BLECell
getBLECell
(
int
M
,
int
N
)
{
return
fp
[
M
][
N
];
}
...
...
@@ -20,6 +57,10 @@ class Floor {
public
void
setBLECell
(
int
M
,
int
N
,
BLECell
bleCell
)
{
fp
[
M
][
N
]
=
bleCell
;
}
public
void
setBLECellLocation
(
int
M
,
int
N
,
int
x
,
int
y
)
{
fp
[
M
][
N
].
setLocation_x
(
x
);
fp
[
M
][
N
].
setLocation_y
(
y
);
}
double
map_scale_pixel
;
...
...
src/main/java/com/skt/ehs/mbs/fpbuilder/Initializer.java
deleted
100644 → 0
View file @
8d33d5d1
package
com.skt.ehs.mbs.fpbuilder
;
import
com.skt.ehs.mbs.conf.Configure
;
import
com.skt.ehs.mbs.db.maria.DBManager
;
import
com.skt.ehs.mbs.db.maria.MariaConnectionManager
;
import
com.skt.ehs.mbs.db.maria.dao.RawDataAPDAO
;
import
org.apache.ibatis.session.SqlSession
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
/**
* Created by user on 2016-12-01.
*/
public
class
Initializer
{
// Todo BLECell 을 최소한의 필수 정보로 구성하여
// Floor Matrix 를 만든다
private
static
boolean
generateCellid
()
{
// compose ble-cell-matrix
int
M
=
(
int
)
(
Configure
.
LENGTH_PIXEL_X
/
Configure
.
CELL_SIZE_BLE
);
int
N
=
(
int
)
(
Configure
.
WIDTH_PIXEL_Y
/
Configure
.
CELL_SIZE_BLE
);
System
.
out
.
println
(
"X : "
+
M
+
" Y : "
+
N
);
if
(((
int
)
Configure
.
LENGTH_PIXEL_X
%
(
int
)
Configure
.
CELL_SIZE_BLE
)
!=
0
)
M
++;
if
(((
int
)
Configure
.
WIDTH_PIXEL_Y
%
(
int
)
Configure
.
CELL_SIZE_BLE
)
!=
0
)
N
++;
System
.
out
.
println
(
"M : "
+
M
+
" N : "
+
N
);
// gen cell_id
int
[][]
ble_cell_ids
=
new
int
[
M
][
N
];
for
(
int
x
=
1
;
x
<=
M
;
x
++)
{
int
idx
=
0
;
int
id
=
0
;
int
id_x
=
1000
*
x
;
// id는 6자리, 이 중 앞 3자리는 x(index) 성분 , 뒤 세자리는 y(index) 성분
// index 란 , ble cell 격자에서 좌상 element 에서 1 로 시작해서 오른쪽방향 그리고
// 아래방향(폭, y 방향) 으로 1씩 증가하는 수를 말한다
for
(
int
y
=
1
;
y
<=
N
;
y
++)
{
id
=
id_x
+
y
;
ble_cell_ids
[
x
-
1
][
y
-
1
]
=
id
;
}
}
// assign Floor
CellMatrix
ble_cells
=
new
CellMatrix
(
ble_cell_ids
);
ble_cells
.
show
();
return
true
;
}
private
static
double
readMapScale
()
{
int
iCampusID
=
1
;
// Todo console 에서 받아옴
int
iBuildingID
=
1
;
// Todo console 에서 받아옴
int
iFloorID
=
1
;
// Todo console 에서 받아옴
double
ret
=
0
;
try
{
ret
=
DBManager
.
getMapScale
(
iCampusID
,
iBuildingID
,
iFloorID
);
}
catch
(
Throwable
throwable
)
{
throwable
.
printStackTrace
();
}
return
ret
;
}
private
static
void
initFloor
()
{
double
scale
=
readMapScale
();
System
.
out
.
printf
(
"scale_pixel : %9.4f"
,
scale
);
//Floor floor = new Floor();
}
public
static
boolean
compose
()
{
if
(
MariaConnectionManager
.
getInstance
().
makeConnectionPool
()
==
false
)
{
return
false
;
}
initFloor
();
//boolean t = generateCellid();
return
false
;
}
}
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