2012-09-24 104 views
2

輪詢RSSI通過hci_read_rssi()我試圖輪詢兩個設備(Android手機和芯片)之間的藍牙連接定期RSSI值。正確的方法來通過hci_read_rssi()

我使用NDK訪問圖書館的BlueZ使用

hci_read_rssi(int dd, uint16_t handle, int8_t *rssi, int to) 

我不知道如何通過正確的參數的長期使用的問題。 什麼是使用該功能的正確方法?

回答

0

這對你可能不同,但在Bluetopia棧,我GAP_LE_Event_Callback功能,當我收到Connection_Complete(GAP連接即是)我這樣做

 case etLE_Connection_Complete: 
     ... 
     Word_t Connection_Handle; 
     if (GAP_LE_Query_Connection_Handle(BluetoothStackID, x->Peer_Address, 
       &Connection_Handle) == 0) { 

      Word_t Connection_HandleResult; 
      SByte_t RSSIResult; 
      Byte_t StatusResult; 

      if (HCI_Read_RSSI(BluetoothStackID,Connection_Handle, &StatusResult, 
       &Connection_HandleResult, &RSSIResult) == 0) { 
       Display(("RSSI: %x %x %d\r\n",StatusResult, 
         Connection_HandleResult,RSSIResult)); 

如果還是不行,那麼您需要手動創建一個ConnectionHandle,並通過調用HCI_LE_Create_Connection

相關問題