summaryrefslogtreecommitdiff
path: root/sensor/patchedBLE/src/BLERemoteDescriptor.h
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2018-08-03 12:23:17 +0100
committerdakkar <dakkar@thenautilus.net>2018-08-03 12:23:17 +0100
commitbb00c2da73b6ab8837f50c9f889ee151f8abc036 (patch)
tree3922eb826386260568ccaa1da7056c141f752a97 /sensor/patchedBLE/src/BLERemoteDescriptor.h
parentdon't print from callback, there's races (diff)
parentUpload of 0.4.16 (diff)
downloadthermostat-bb00c2da73b6ab8837f50c9f889ee151f8abc036.tar.gz
thermostat-bb00c2da73b6ab8837f50c9f889ee151f8abc036.tar.bz2
thermostat-bb00c2da73b6ab8837f50c9f889ee151f8abc036.zip
Add 'sensor/patchedBLE/' from commit '7951347ed68313d75c367e1f2cce763cb56d1eb2'
git-subtree-dir: sensor/patchedBLE git-subtree-mainline: 27e209cf58abeda1dc110777f99a98804a13fdbf git-subtree-split: 7951347ed68313d75c367e1f2cce763cb56d1eb2
Diffstat (limited to 'sensor/patchedBLE/src/BLERemoteDescriptor.h')
-rw-r--r--sensor/patchedBLE/src/BLERemoteDescriptor.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/sensor/patchedBLE/src/BLERemoteDescriptor.h b/sensor/patchedBLE/src/BLERemoteDescriptor.h
new file mode 100644
index 0000000..7bbc48f
--- /dev/null
+++ b/sensor/patchedBLE/src/BLERemoteDescriptor.h
@@ -0,0 +1,55 @@
+/*
+ * BLERemoteDescriptor.h
+ *
+ * Created on: Jul 8, 2017
+ * Author: kolban
+ */
+
+#ifndef COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_
+#define COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+#include <string>
+
+#include <esp_gattc_api.h>
+
+#include "BLERemoteCharacteristic.h"
+#include "BLEUUID.h"
+#include "FreeRTOS.h"
+
+class BLERemoteCharacteristic;
+/**
+ * @brief A model of remote %BLE descriptor.
+ */
+class BLERemoteDescriptor {
+public:
+ uint16_t getHandle();
+ BLERemoteCharacteristic* getRemoteCharacteristic();
+ BLEUUID getUUID();
+ std::string readValue(void);
+ uint8_t readUInt8(void);
+ uint16_t readUInt16(void);
+ uint32_t readUInt32(void);
+ std::string toString(void);
+ void writeValue(uint8_t* data, size_t length, bool response = false);
+ void writeValue(std::string newValue, bool response = false);
+ void writeValue(uint8_t newValue, bool response = false);
+
+
+private:
+ friend class BLERemoteCharacteristic;
+ BLERemoteDescriptor(
+ uint16_t handle,
+ BLEUUID uuid,
+ BLERemoteCharacteristic* pRemoteCharacteristic
+ );
+ uint16_t m_handle; // Server handle of this descriptor.
+ BLEUUID m_uuid; // UUID of this descriptor.
+ std::string m_value; // Last received value of the descriptor.
+ BLERemoteCharacteristic* m_pRemoteCharacteristic; // Reference to the Remote characteristic of which this descriptor is associated.
+ FreeRTOS::Semaphore m_semaphoreReadDescrEvt = FreeRTOS::Semaphore("ReadDescrEvt");
+
+
+};
+#endif /* CONFIG_BT_ENABLED */
+#endif /* COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_ */