[NimBLEServer] Support duplicate characteristics (#36)

* Add method to get all characteristics of a service

* Added method on NimBLEDescriptor to get the value out as a std::string

* Added methods to get things by handle where UUID could be used already.

* Added helper methods for getting a list of characteristics with a given UUID and service

* Demote the warning log for adding duplicate characteristics to a debug level log.

* Add methods to get services and characteristics using UUID + index
This commit is contained in:
David Robertson
2021-02-08 08:28:32 -07:00
committed by GitHub
parent 28d6492ea4
commit 7dd4d68806
8 changed files with 157 additions and 53 deletions
+9 -6
View File
@@ -44,20 +44,23 @@ class NimBLEDescriptorCallbacks;
class NimBLEDescriptor {
public:
uint16_t getHandle();
size_t getLength();
NimBLEUUID getUUID();
uint8_t* getValue();
void setCallbacks(NimBLEDescriptorCallbacks* pCallbacks);
void setValue(const uint8_t* data, size_t size);
void setValue(const std::string &value);
std::string toString();
void setCallbacks(NimBLEDescriptorCallbacks* pCallbacks);
size_t getLength();
uint8_t* getValue();
std::string getStringValue();
void setValue(const uint8_t* data, size_t size);
void setValue(const std::string &value);
/**
* @brief Convenience template to set the descriptor value to <type\>val.
* @param [in] s The value to set.
*/
template<typename T>
void setValue(const T &s) {
void setValue(const T &s) {
setValue((uint8_t*)&s, sizeof(T));
}