mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-12-18 09:10:47 +01:00
91210b8610
Refactor attributes to reduce code duplication and improve maintainability. * Add attribute base classes to provide common code. * Add const where possible to functions and parameters. * `NimBLECharacteristic::notify` no longer takes a `bool is_notification` parameter, instead `indicate()` should be called to send indications. * `NimBLECharacteristic::indicate` now takes the same parameters as `notify`. * `NimBLECharacteristicCallbacks` and `NimBLEDescriptorCallbacks` methods now take `const NimBLEConnInfo&` instead of non-const. * `NimBLECharacteristic::onNotify` callback removed as unnecessary, the library does not call notify without app input. * `NimBLERemoteCharacteristic::getRemoteService` now returns a `const NimBLERemoteService*` instead of non-const. * Add NimBLEUUID constructor that takes a reference to `ble_uuid_any_t`. * `NimBLERemoteService::getCharacteristics` now returns a `const std::vector<NimBLERemoteCharacteristic*>&` instead of non-const `std::vector<NimBLERemoteCharacteristic*>*` * `NimBLERemoteService::getValue` now returns `NimBLEAttValue` instead of `std::string` * `NimBLEService::getCharacteristics` now returns a `const std::vector<NimBLECharacteristic*>&` instead of a copy of std::vector<NimBLECharacteristic *>. * Remove const requirement for NimBLEConnInfo parameter in callbacks. Const is unnecessary as the data can't be changed by application code. * Change NimBLERemoteCharacteristic::getRemoteService to return const pointer.
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
/*
|
|
* NimBLERemoteDescriptor.h
|
|
*
|
|
* Created: on Jan 27 2020
|
|
* Author H2zero
|
|
*
|
|
* Originally:
|
|
*
|
|
* BLERemoteDescriptor.h
|
|
*
|
|
* Created on: Jul 8, 2017
|
|
* Author: kolban
|
|
*/
|
|
|
|
#ifndef NIMBLE_CPP_REMOTE_DESCRIPTOR_H_
|
|
#define NIMBLE_CPP_REMOTE_DESCRIPTOR_H_
|
|
|
|
#include "nimconfig.h"
|
|
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
|
|
|
# include "NimBLERemoteValueAttribute.h"
|
|
|
|
class NimBLERemoteCharacteristic;
|
|
class NimBLEClient;
|
|
|
|
/**
|
|
* @brief A model of remote BLE descriptor.
|
|
*/
|
|
class NimBLERemoteDescriptor : public NimBLERemoteValueAttribute {
|
|
public:
|
|
NimBLERemoteCharacteristic* getRemoteCharacteristic() const;
|
|
std::string toString(void) const;
|
|
NimBLEClient* getClient() const override;
|
|
|
|
private:
|
|
friend class NimBLERemoteCharacteristic;
|
|
|
|
NimBLERemoteDescriptor(const NimBLERemoteCharacteristic* pRemoteCharacteristic, const ble_gatt_dsc* dsc);
|
|
~NimBLERemoteDescriptor() = default;
|
|
|
|
const NimBLERemoteCharacteristic* m_pRemoteCharacteristic;
|
|
};
|
|
|
|
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
|
#endif /* NIMBLE_CPP_REMOTE_DESCRIPTOR_H_ */
|