forked from espressif/arduino-esp32
This is very much still work in progress and much more will change before the final 2.0.0 Some APIs have changed. New libraries have been added. LittleFS included. Co-authored-by: Seon Rozenblum <seonr@3sprockets.com> Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com> Co-authored-by: geeksville <kevinh@geeksville.com> Co-authored-by: Mike Dunston <m_dunston@comcast.net> Co-authored-by: Unexpected Maker <seon@unexpectedmaker.com> Co-authored-by: Seon Rozenblum <seonr@3sprockets.com> Co-authored-by: microDev <70126934+microDev1@users.noreply.github.com> Co-authored-by: tobozo <tobozo@users.noreply.github.com> Co-authored-by: bobobo1618 <bobobo1618@users.noreply.github.com> Co-authored-by: lorol <lorolouis@gmail.com> Co-authored-by: geeksville <kevinh@geeksville.com> Co-authored-by: Limor "Ladyada" Fried <limor@ladyada.net> Co-authored-by: Sweety <switi.mhaiske@espressif.com> Co-authored-by: Loick MAHIEUX <loick111@gmail.com> Co-authored-by: Larry Bernstone <lbernstone@gmail.com> Co-authored-by: Valerii Koval <valeros@users.noreply.github.com> Co-authored-by: 快乐的我531 <2302004040@qq.com> Co-authored-by: chegewara <imperiaonline4@gmail.com> Co-authored-by: Clemens Kirchgatterer <clemens@1541.org> Co-authored-by: Aron Rubin <aronrubin@gmail.com> Co-authored-by: Pete Lewis <601236+lewispg228@users.noreply.github.com>
59 lines
2.0 KiB
C++
59 lines
2.0 KiB
C++
/*
|
|
* 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_BLUEDROID_ENABLED)
|
|
#include <string>
|
|
|
|
#include <esp_gattc_api.h>
|
|
|
|
#include "BLERemoteCharacteristic.h"
|
|
#include "BLEUUID.h"
|
|
#include "RTOS.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);
|
|
void setAuth(esp_gatt_auth_req_t auth);
|
|
void gattClientEventHandler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t* evtParam);
|
|
|
|
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");
|
|
FreeRTOS::Semaphore m_semaphoreWriteDescrEvt = FreeRTOS::Semaphore("WriteDescrEvt");
|
|
esp_gatt_auth_req_t m_auth;
|
|
|
|
|
|
};
|
|
#endif /* CONFIG_BLUEDROID_ENABLED */
|
|
#endif /* COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_ */
|