모바일에서 Ble pxp

14

Click here to load reader

Transcript of 모바일에서 Ble pxp

Page 1: 모바일에서 Ble pxp

BlueTooth Low Energy(BLE)

STG 김진용

Page 2: 모바일에서 Ble pxp

I. Smart Guardian 의 통신 BT Spec 1. Bluetooth 4.02. Ganeral Attribute Profile (GATT)3. Proximity Profile (PXP)

II. iOS 구성 설명1. 사용 API 설명2. Sequence diagram

III.Android 구성 설명1. 사용 API 설명2. Sequence diagram

목차

Page 3: 모바일에서 Ble pxp

I. BT Spec(PXP)Technonia

Page 4: 모바일에서 Ble pxp

1. Bluetooth 4.0

1) 소개

소비전역을 줄인 저에너지 기술에 고속 무선통신을 지원 . 평균 전력과 대기전력을 줄여 동전 크기 배터리로 수 년동안 작동할 수 있도록 했으며 , 전송 속도를 24Mbps 로 확장하여 실시간 대용량 데이터 전송을 쉽고 빠르게 할 수 있다 .

2) 종류

싱글 모드와 듀얼 모드로 분리된다 . 싱글 모드는 통합성이 고도로 높고 크기가 매우 작은 디바이스들을 가능하게 만들었다 .( 예 . Smart Guardian, Smart Nudge) 듀얼 모드는 저에너지 블루투스 기능이 기존 블루투스 기능에 통합한다 .

Page 5: 모바일에서 Ble pxp

2. Generic Attribute Profile (GATT)

.

.

.

Alert Notification Profile(ANP)

Health Thermometer Pro-file(HTP)

Heart Rate Profile(HRP)

Proximity Profile(PXP)

Link Loss Service

Immediate Alert Service

Tx Power Service

GATT Profile

PXP Profile

1) 소개 Genaral Attribute Profile (GATT) 는 Attribute Protocol 을 사용하여 서비스 프레임워크 , 서비스 포맷 및 절차를 정의한다 . 이 절차는 검색 , 읽기 , 쓰기 , 알림 , 지시 특성의 설정을 정의한다 .

2) 캡슐화Smart Guardian 에서 사용하는 Proximity Profile (PXP) 은 GATT Profile 에서 제공하는 서비스들을 캡슐화 한 것으로 , Link Loss Service, Immediate Alert Service, Tx Power Service 가 들어있다 .제공하는 다른 Profile 로는 Heart Rate Profile(HRP) 가 있는데 이 Profile 을 사용하여 심박모니터 기능을 구현할 수 있다 .

Page 6: 모바일에서 Ble pxp

3. Proximity Profile (PXP)

1) 소개 Proximity Profile 은 연결이 해제되거나 또는 경로 손실이 일어났을 때 즉시 경고를 일으킬 수 있는 기능이 가능하게 설계되었다 .

2) Service in profile Proximity Profile 에는 3 가지 서비스가 구성되어 있음 .

3) 추가 Service

Service 용도org.bluetooth.service.link_loss 연결 해제 모니터링 용도org.bluetooth.service.immediate_alert

Find me(Find Phone)

org.bluetooth.service.tx_power 사용 안함 .

Service 용도org.bluetooth.service.battery_service

Device battery

Page 7: 모바일에서 Ble pxp

II. iOS 구성 설명Technonia

Page 8: 모바일에서 Ble pxp

1. 사용 API 설명1) Framework

a. Corebluetooth Framework 사용 .b. Master(Phone) 에서 Slave 에 Trace 기능을 Support 하도록 Service Server 개념 도입 (Phone 단에 Find me Profile 을 Server 개념으로 등록하여 Slave 에서 Find Phone 기능 구현 )

Page 9: 모바일에서 Ble pxp

2. Sequence diagram

Master(Phone) Slave(Device)

new CBCentralManager()

scanForPeripheralsWithService

didDiscoverPeripheral

connectPeripheral

didConnectPeripheral

discoverService

didDiscoverService

discoverCharacteristics

didDiscoverCharacteristicsForService

1

2

3

4

5

6

7

8

9

번호 설명

1 CBCentralManager 생성

2 BLE Device 검색

3 BLE Device 검색 완료

4 Device 에 연결 요청

5 Device 연결 완료

6 Device 에서 제공하는 Service 검색

7 Service 검색 완료 (Proximity Pro-file)

8 각 Service 의 Characteristic 요청

9 Characteristic 검색 완료 .

1) 검색 및 연결

Page 10: 모바일에서 Ble pxp

writeValue

didWriteValueForCharacteristic

1

2

번호 설명

1 Immediate Alert Service 를 이용하여 Device 에 알람 요청

2 Call back 으로 알람 요청 처리 결과 리턴

3Phone 에서 Finde Phone(Find me) 제공할 Service 추가(Immediate Alert Service)

4 Device 에서 버튼을 눌러 Server(Phone) 에 알람 요청

2) Find me

Slave((Device)

didReceiveWriteRequests

3) Find phone(Find me 서비스를 폰단에 등록 하여야 함 )

3

Master(Phone) Slave(Device)

Master(Phone)

addService

4

2. Sequence diagram

Page 11: 모바일에서 Ble pxp

III. Android 구성 설명Technonia

Page 12: 모바일에서 Ble pxp

1. 사용 API 설명

1) Android 4.1.2, Android 4.2.2 ( 삼성 전용 )

a. 삼성에서 제공하는 SDK 사용b. 패키지명 : com.samsung.android.sdk.bt.gatt.*c. 삼성에서 제조한 Device 만 사용 가능 .

2) Android 4.3 이상a. 구글에서 제공하는 API 사용b. 패키지명 : android.bluetooth.*

Page 13: 모바일에서 Ble pxp

2. Sequence diagram

Master(Phone) Slave(Device)

new BluetoothAdapter()

startLeScan()

BluetoothAdpater.LeScanCallback

connectGatt()

BluetoothGattCallback. onConnectionStateChange()

discoverServices()

BluetoothGattCallback .onServicesDiscovered()

getService()

getCharacteristic()

1

2

3

4

5

6

7

8

9

번호 설명

1 BluetoothAdapter 생성

2 BLE Device 검색

3 BLE Device 검색 완료

4 Device 에 연결 요청

5 Device 연결 완료

6 Device 에서 제공하는 Service 검색

7 Service 검색 완료 (Proximity Pro-file)

8 Service 요청 (link_loss, immedi-ate_alert, tx_power)

9 각 Service 의 Characteristic 요청

1) 검색 및 연결

Page 14: 모바일에서 Ble pxp

BluetoothGattCharacteristic.setValue() 1

번호 설명

1 Immediate Alert Service 를 이용하여 Device 에 알람 요청

2 Phone 에서 제공할 Service 추가(Immediate Alert Service)

3 Device 에서 버튼을 눌러 Server(Phone) 에 알람 요청

Slave(Device)

onCharacteristicWriteRequest()

2

Master(Phone) Slave(Device)

Master(Phone)

addService()

3

2) Find me

2) Find phone(Android 4.1.2, 4.3, 4.4 지원 안함 )

2. Sequence diagram