summaryrefslogtreecommitdiff
path: root/src/BLEDescriptor.cpp
diff options
context:
space:
mode:
authorNeil Kolban <kolban1@kolban.com>2018-01-17 18:16:31 -0600
committerNeil Kolban <kolban1@kolban.com>2018-01-17 18:16:31 -0600
commit3f5005c383540d07dd16ac044c78d7be28d4aa8e (patch)
treec5236ddbe5c8dd99ad7083dd498110152ad0e9be /src/BLEDescriptor.cpp
parentRemoval of unneeded file (diff)
downloadthermostat-3f5005c383540d07dd16ac044c78d7be28d4aa8e.tar.gz
thermostat-3f5005c383540d07dd16ac044c78d7be28d4aa8e.tar.bz2
thermostat-3f5005c383540d07dd16ac044c78d7be28d4aa8e.zip
0.4.8
Diffstat (limited to 'src/BLEDescriptor.cpp')
-rw-r--r--src/BLEDescriptor.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/BLEDescriptor.cpp b/src/BLEDescriptor.cpp
index 054ef42..1a72ef3 100644
--- a/src/BLEDescriptor.cpp
+++ b/src/BLEDescriptor.cpp
@@ -37,12 +37,12 @@ BLEDescriptor::BLEDescriptor(const char* uuid) : BLEDescriptor(BLEUUID(uuid)) {
*/
BLEDescriptor::BLEDescriptor(BLEUUID uuid) {
m_bleUUID = uuid;
- m_value.attr_value = (uint8_t *)malloc(ESP_GATT_MAX_ATTR_LEN); // Allocate storage for the value.
- m_value.attr_len = 0;
- m_value.attr_max_len = ESP_GATT_MAX_ATTR_LEN;
- m_handle = NULL_HANDLE;
- m_pCharacteristic = nullptr; // No initial characteristic.
- m_pCallback = nullptr; // No initial callback.
+ m_value.attr_value = (uint8_t *)malloc(ESP_GATT_MAX_ATTR_LEN); // Allocate storage for the value.
+ m_value.attr_len = 0; // Initial length is 0.
+ m_value.attr_max_len = ESP_GATT_MAX_ATTR_LEN; // Maximum length of the data.
+ m_handle = NULL_HANDLE; // Handle is initially unknown.
+ m_pCharacteristic = nullptr; // No initial characteristic.
+ m_pCallback = nullptr; // No initial callback.
} // BLEDescriptor
@@ -51,7 +51,7 @@ BLEDescriptor::BLEDescriptor(BLEUUID uuid) {
* @brief BLEDescriptor destructor.
*/
BLEDescriptor::~BLEDescriptor() {
- free(m_value.attr_value);
+ free(m_value.attr_value); // Release the storage we created in the constructor.
} // ~BLEDescriptor
@@ -301,6 +301,9 @@ void BLEDescriptor::setValue(std::string value) {
setValue((uint8_t *)value.data(), value.length());
} // setValue
+void BLEDescriptor::setAccessPermissions(esp_gatt_perm_t perm) {
+ m_permissions = perm;
+}
/**
* @brief Return a string representation of the descriptor.