summaryrefslogtreecommitdiff
path: root/src/BLEDescriptor.h
diff options
context:
space:
mode:
authorkolban <kolban1@kolban.com>2017-09-10 13:41:31 -0500
committerkolban <kolban1@kolban.com>2017-09-10 13:41:31 -0500
commit0eecee13a75bf13fd1752d3d9b6bc60709a265d2 (patch)
tree7d1492d47841ffa8b103cc9e111772af77b35481 /src/BLEDescriptor.h
parent0.1.0 release (diff)
downloadthermostat-0eecee13a75bf13fd1752d3d9b6bc60709a265d2.tar.gz
thermostat-0eecee13a75bf13fd1752d3d9b6bc60709a265d2.tar.bz2
thermostat-0eecee13a75bf13fd1752d3d9b6bc60709a265d2.zip
0.2.0
Diffstat (limited to 'src/BLEDescriptor.h')
-rw-r--r--src/BLEDescriptor.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/BLEDescriptor.h b/src/BLEDescriptor.h
new file mode 100644
index 0000000..1d32d50
--- /dev/null
+++ b/src/BLEDescriptor.h
@@ -0,0 +1,54 @@
+/*
+ * BLEDescriptor.h
+ *
+ * Created on: Jun 22, 2017
+ * Author: kolban
+ */
+
+#ifndef COMPONENTS_CPP_UTILS_BLEDESCRIPTOR_H_
+#define COMPONENTS_CPP_UTILS_BLEDESCRIPTOR_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+#include <string>
+#include "BLEUUID.h"
+#include "BLECharacteristic.h"
+#include <esp_gatts_api.h>
+#include "FreeRTOS.h"
+
+class BLEService;
+class BLECharacteristic;
+
+/**
+ * @brief A model of a %BLE descriptor.
+ */
+class BLEDescriptor {
+public:
+ BLEDescriptor(const char* uuid);
+ BLEDescriptor(BLEUUID uuid);
+ virtual ~BLEDescriptor();
+
+ size_t getLength();
+ BLEUUID getUUID();
+ uint8_t* getValue();
+ void handleGATTServerEvent(
+ esp_gatts_cb_event_t event,
+ esp_gatt_if_t gatts_if,
+ esp_ble_gatts_cb_param_t* param);
+ void setValue(uint8_t* data, size_t size);
+ void setValue(std::string value);
+ std::string toString();
+
+private:
+ friend class BLEDescriptorMap;
+ friend class BLECharacteristic;
+ BLEUUID m_bleUUID;
+ esp_attr_value_t m_value;
+ uint16_t m_handle;
+ BLECharacteristic* m_pCharacteristic;
+ void executeCreate(BLECharacteristic* pCharacteristic);
+ uint16_t getHandle();
+ void setHandle(uint16_t handle);
+ FreeRTOS::Semaphore m_semaphoreCreateEvt = FreeRTOS::Semaphore("CreateEvt");
+};
+#endif /* CONFIG_BT_ENABLED */
+#endif /* COMPONENTS_CPP_UTILS_BLEDESCRIPTOR_H_ */