初始化提交
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#include "BleConnectionStatus.h"
|
||||
|
||||
BleConnectionStatus::BleConnectionStatus(void) {
|
||||
}
|
||||
|
||||
void BleConnectionStatus::onConnect(BLEServer* pServer)
|
||||
{
|
||||
this->connected = true;
|
||||
BLE2902* desc = (BLE2902*)this->inputKeyboard->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
|
||||
desc->setNotifications(true);
|
||||
}
|
||||
|
||||
void BleConnectionStatus::onDisconnect(BLEServer* pServer)
|
||||
{
|
||||
this->connected = false;
|
||||
BLE2902* desc = (BLE2902*)this->inputKeyboard->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
|
||||
desc->setNotifications(false);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef ESP32_BLE_CONNECTION_STATUS_H
|
||||
#define ESP32_BLE_CONNECTION_STATUS_H
|
||||
#include "sdkconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
|
||||
#include <BLEServer.h>
|
||||
#include "BLE2902.h"
|
||||
#include "BLECharacteristic.h"
|
||||
|
||||
class BleConnectionStatus : public BLEServerCallbacks
|
||||
{
|
||||
public:
|
||||
BleConnectionStatus(void);
|
||||
bool connected = false;
|
||||
void onConnect(BLEServer* pServer);
|
||||
void onDisconnect(BLEServer* pServer);
|
||||
BLECharacteristic* inputKeyboard;
|
||||
BLECharacteristic* outputKeyboard;
|
||||
};
|
||||
|
||||
#endif // CONFIG_BT_ENABLED
|
||||
#endif // ESP32_BLE_CONNECTION_STATUS_H
|
||||
Reference in New Issue
Block a user