From 0003e1af6e4feeb1e3286526281304ad74001ad6 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 4 Jan 2018 18:57:41 +0700 Subject: [PATCH] client characteristic rename assign, discoverDescriptor for internal ussage --- libraries/Bluefruit52Lib/src/BLEClientCharacteristic.cpp | 4 ++-- libraries/Bluefruit52Lib/src/BLEClientCharacteristic.h | 7 ++++--- libraries/Bluefruit52Lib/src/BLEDiscovery.cpp | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libraries/Bluefruit52Lib/src/BLEClientCharacteristic.cpp b/libraries/Bluefruit52Lib/src/BLEClientCharacteristic.cpp index 27f7ac66..9a52a22b 100644 --- a/libraries/Bluefruit52Lib/src/BLEClientCharacteristic.cpp +++ b/libraries/Bluefruit52Lib/src/BLEClientCharacteristic.cpp @@ -81,7 +81,7 @@ void BLEClientCharacteristic::begin(BLEClientService* parent_svc) _adamsg.begin(true); } -void BLEClientCharacteristic::assign(ble_gattc_char_t* gattc_chr) +void BLEClientCharacteristic::_assign(ble_gattc_char_t* gattc_chr) { _chr = *gattc_chr; } @@ -141,7 +141,7 @@ BLEClientService& BLEClientCharacteristic::parentService (void) return *_service; } -bool BLEClientCharacteristic::discoverDescriptor(uint16_t conn_handle, ble_gattc_handle_range_t hdl_range) +bool BLEClientCharacteristic::_discoverDescriptor(uint16_t conn_handle, ble_gattc_handle_range_t hdl_range) { enum { MAX_DESCIRPTORS = 8 }; diff --git a/libraries/Bluefruit52Lib/src/BLEClientCharacteristic.h b/libraries/Bluefruit52Lib/src/BLEClientCharacteristic.h index 7dba9868..224d1075 100644 --- a/libraries/Bluefruit52Lib/src/BLEClientCharacteristic.h +++ b/libraries/Bluefruit52Lib/src/BLEClientCharacteristic.h @@ -59,9 +59,6 @@ class BLEClientCharacteristic // Destructor virtual ~BLEClientCharacteristic(); - void assign(ble_gattc_char_t* gattc_chr); - bool discoverDescriptor(uint16_t conn_handle, ble_gattc_handle_range_t hdl_range); - void begin(BLEClientService* parent_svc = NULL); bool discover(void); @@ -97,6 +94,10 @@ class BLEClientCharacteristic void setNotifyCallback(notify_cb_t fp); void useAdaCallback(bool enabled); + /*------------- Internal usage -------------*/ + void _assign(ble_gattc_char_t* gattc_chr); + bool _discoverDescriptor(uint16_t conn_handle, ble_gattc_handle_range_t hdl_range); + private: ble_gattc_char_t _chr; uint16_t _cccd_handle; diff --git a/libraries/Bluefruit52Lib/src/BLEDiscovery.cpp b/libraries/Bluefruit52Lib/src/BLEDiscovery.cpp index 27cf3cfb..9bdc7648 100644 --- a/libraries/Bluefruit52Lib/src/BLEDiscovery.cpp +++ b/libraries/Bluefruit52Lib/src/BLEDiscovery.cpp @@ -135,7 +135,7 @@ uint8_t BLEDiscovery::discoverCharacteristic(uint16_t conn_handle, BLEClientChar LOG_LV2("DISC", "[CHR] Found 0x%04X, handle = %d\n-----------------", disc_chr->chars[d].uuid.uuid, disc_chr->chars[d].handle_value); // characteristic assign overload - chr[i]->assign(&disc_chr->chars[d]); + chr[i]->_assign(&disc_chr->chars[d]); // only discover CCCD descriptor if (disc_chr->chars[d].char_props.notify || disc_chr->chars[d].char_props.indicate ) @@ -145,7 +145,7 @@ uint8_t BLEDiscovery::discoverCharacteristic(uint16_t conn_handle, BLEClientChar if ( range.start_handle <= range.end_handle ) { // skip if reaching end of range (last char has no descriptor)p - chr[i]->discoverDescriptor(conn_handle, range); + chr[i]->_discoverDescriptor(conn_handle, range); } }