發表文章

目前顯示的是 10月, 2019的文章

[BLE] 不同的 Advertising 種類與用途

圖片
在 BLE 通訊協定中, BLE 裝置透過 Advertising 告知周邊 BLE 裝置自己的存在, 其中, 考慮到 WiFi 的干擾, Advertising 封包在以下 3 個 bluetooth channel 上廣播: channel 37 (2402 MHz), channel 38 (2426 MHz), 和 channel 39 (2480 MHz), 我們可以利用下圖來了解其中干擾的關係: 來自:  https://www.infsoft.com/technology/sensors/bluetooth-low-energy-beacons 對於 connection 之後的資料傳輸, 則使用其他 bluetooth channel 進行通訊, 並藉由展頻通訊 (跳頻) 的方法, 對抗 WiFi 通訊產生的干擾, 透過不同的通訊目標, BLE 設計了 4 種不同的 advertising 的方式, 如下表所示: Advertising PDU Description Max Adv Data Len Max Scan Res Len Allow Connect ADV_IND Used to send connectable undirected advertisement 31 bytes 31 bytes Yes ADV_DIRECT_IND Used to send connectable directed advertisement N/A N/A Yes ADV_SCAN_IND Used to send scannable undirected advertisement 31 bytes 31 bytes No ADV_NONCONN_IND Used to send non-connectable undirected advertisement 31 bytes N/A No (來自:  Bluetooth Low Energy Scanning and Advertising ) Advertising Data (Adv Data) 代表在 advertising 封包中自帶的資訊, 在 BLE 中, 此資料的長度為 31 bytes. 更多的資訊可以透過 Scan

[BLE] State Machine and GAP Roles

圖片
在一般 BLE 裝置中, 不同的連線階段也扮演不同角色, 一般來說, 可以分成這四種 GAP Roles: GAP Role Description BROADCASTER A device that only sends advertising events. OBSERVER A device that only receives advertising events. PERIPHERAL A device that accepts the establishment of an LE physical link using the connection establishment procedure. CENTRAL A device that supports the Central role initiates the establishment of a physical connection. (來自: Bluetooth Low Energy Scanning and Advertising ) 其中, Broadcaster 和 Observer 為一對, 進行 adverting 通訊, Peripheral 和 Central 為一對, 進行資料傳輸, 為了表示此 4 種 GAP 腳色, BLE 可以表示為以下狀態機 (State Machine) 的轉換: 來自:  https://iot.electronicsforu.com/expert-opinion/improving-battery-life-in-bluetooth-low-energy-connected-things-part-2/ 其中, 我們可以看到 Connection 和 Advertising 分屬不同的狀態, 以 one-hot state machine 的概念來說, 在一個時間內應只屬於一個狀態, 至於上述 4 個 GAP Role 則使用了狀態機不同的部分, 如下圖所示: 來自:  https://iot.electronicsforu.com/expert-opinion/improving-battery-life-in-bluetooth-low-energy-connected-thin