当手机和设备连接上后,设备端可以通过获取RSSI来 在一定程度上判断手机离设备的相对距离的远近。比如蓝牙防丢器就是通过RSSI来实现防丢的。
第一步:启动rssi功能
* @param[in] conn_handle Connection handle.
* @param[in] threshold_dbm Minimum change in dBm before triggering the @ref BLE_GAP_EVT_RSSI_CHANGED event. Events are disabled if threshold_dbm equals @ref BLE_GAP_RSSI_THRESHOLD_INVALID.
* @param[in] skip_count Number of RSSI samples with a change of threshold_dbm or more before sending a new @ref BLE_GAP_EVT_RSSI_CHANGED event.
uint32_t sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count)
传入连接句柄、改变阈值和忽略次数。