1. 程式人生 > >藍芽BLE主從機中GAP幾種狀態的解釋

藍芽BLE主從機中GAP幾種狀態的解釋

這是在從機上對GAP狀態的描述

typedef enum
{
  GAPROLE_INIT = 0,                       //!< Waiting to be started 等待啟動
  GAPROLE_STARTED,                        //!< Started but not advertising 啟動但是沒有在廣播
  GAPROLE_ADVERTISING,                    //!< Currently Advertising 處於廣播狀態

  GAPROLE_WAITING,      
//裝置啟動但是沒處於廣播狀態,處於再次廣播之前的等待期間,比如關閉了廣播等待再次開啟廣播             
//!< Device is started but not advertising, is in waiting period before advertising again GAPROLE_WAITING_AFTER_TIMEOUT, // 裝置僅僅是從連線中超時但是未廣播,在再次廣播之前處於等待期間 //!< Device just timed out from a connection but is not yet advertising, is in waiting period before advertising again GAPROLE_CONNECTED, //!< In a connection 處於連線狀態
GAPROLE_ERROR //!< Error occurred - invalid state 錯誤發生,無效的狀態 } gaprole_States_t;

主機上對GAP狀態的描述

enum
{
  BLE_STATE_IDLE,        //GAP連線處於空閒狀態,說明我這個主機未和任何從機連線
  BLE_STATE_CONNECTING, //說明當前主機處於建立連線狀態
  BLE_STATE_CONNECTED, //說明當前主機建立了連線狀態
  BLE_STATE_DISCONNECTING //說明當前主機處於斷開狀態
};