본문 바로가기
💡 work work work/BLE

iOS BLE - CoreBluetooth : APIs

by hanwitjus 2022. 2. 7.

 

https://www.youtube.com/watch?v=YHeCH-OfWY0&list=LL&index=7&t=1356s 

이 강의를 바탕으로 작성한 bluetooth 연결 과정에 따른 iOS coreBluetooth API들에 대해 정리해보았다.

 

 

(1) Device Discovery

CBCentralManager

: 스캐닝, Advertising Peripherals와 같은 GAP Central 절차 초기화를 위한 API 제공

(주변기기 검색, 연결 : CentralManager)

with <<protocol>> CBCentralManagerDelegate

 

 

(2) Connect

CBCentralManager

: 특정 Peripheral과 연결을 초기화 할 수 있도록 해준다.

 

CBCentralManagerDelegate

: 연결 상태 변화를 위한 callback method들을 제공

ex) CentralManagerDidUpdateState : Central 기기의 on/off 상태변화마다 호출

 

 

(3) Service Discovery

CBPeripheral

: 연결된 디바이스에서 서비스 탐색을 초기화 할 수 있게 함.

 

블루투스 주변기기

  • Pending Peripheral: 연결 시도
  • Connected Peripheral: 연결된 기기

 

<<protocol>> CBPeripheralDelegate

: 서비스 탐색이 완료되면 callback을 받는다.

 

CBService

: Peripheral에서 탐색된 서비스 리스트를 담고 있음.

 

 

(4) Discover Characteristics

CBPeripheral

: Service에 속한 Characteristics를 탐색할 수 있게 함

 

<<protocol>> CBPeripheralDelegate

: Characteristic 탐색이 완료되면 callback을 받음

 

CBService --- CBCharacteristic: peripheral에서 발견된 서비스 리스트를 담고있음

 

 

(5) Read a Characteristic

CBPeripheral

: CBCharacteristic argument를 위한 readValue 함수 포함 -> from the remote device (ex. battery level)

 

<<protocol>> CBPeripheralDelegate

: didUpdateValueFor characteristic을 위한 callback을 받음

 

CBCharacteristic

 

 

(6) Write to Characteristic

Read a Characteristic 절차와 거의 똑같다.

Characteristic을 수정할 필요가 있을 때 사용한다.

 

 

(7) Notifications

CBPeripheral

: CBCharacteristic argument를 위한 setNotifyValue(Bool)이라는 메소드 포함

 

<<protocol>> CBPeripheralDelegate

: 수신된 모든 알림(notification)을 위한 didUpdateValueFor characteristic 라는 메소드 사용

 

CBCharacteristic

-> ex. Heart rate measurement notification

 

 

(8) RSSI (Received Signal Strength Indicator)

연결된 디바이스들의 거리 및 연결 세기 측정.

기기의 신호 강도 의미

 

 

< 내가 아이패드로 필기한 내용 >

더보기

내가 아이패드로 필기한 내용 원본

 

 

 

 


Reference

https://staktree.github.io/ios/iOS-Bluetooth-02-search-peripheral/

 

[iOS]Core Bluetooth 활용하기#02 - 블루투스 기기 검색하기

Core Bluetooth를 활용해 BLE기기를 검색해봅시다.

staktree.github.io

 

 

LIST

댓글