add monitorRssi() and stopRssi()

This commit is contained in:
hathach committed 2019-01-22 22:53:26 +07:00
1 parent 84f9bfd44c
commit 5d9f0badb8
2 files changed
+14 -2

No files matched your search

@@ -104,6 +104,17 @@ uint8_t BLEConnection::getPeerAddr (uint8_t addr[6])
return _addr.addr_type;
}
bool BLEConnection::monitorRssi(uint8_t threshold, uint8_t skip_count)
{
VERIFY_STATUS(sd_ble_gap_rssi_start(_conn_hdl, threshold, skip_count), false);
return true;
}
void BLEConnection::stopRssi(void)
{
sd_ble_gap_rssi_stop(_conn_hdl);
}
bool BLEConnection::getHvnPacket (void)
{
return xSemaphoreTake(_hvn_sem, ms2tick(BLE_GENERIC_TIMEOUT));
+3 -2
View File
@@ -72,12 +72,14 @@ class BLEConnection
bool connected(void);
bool paired(void);
uint8_t getRole(void);
uint16_t getMtu (void);
ble_gap_addr_t getPeerAddr(void);
uint8_t getPeerAddr(uint8_t addr[6]);
bool monitorRssi(uint8_t threshold = BLE_GAP_RSSI_THRESHOLD_INVALID, uint8_t skip_count = 0);
void stopRssi(void);
bool getHvnPacket(void);
bool getWriteCmdPacket(void);
bool waitForIndicateConfirm(void);
@@ -91,7 +93,6 @@ class BLEConnection
* Although declare as public, it is meant to be invoked by internal code.
*------------------------------------------------------------------*/
void _eventHandler(ble_evt_t* evt);
};