forked from T-vK/ESP32-BLE-Mouse
-
Notifications
You must be signed in to change notification settings - Fork 4
/
BleAbsMouse.h
36 lines (33 loc) · 1.02 KB
/
BleAbsMouse.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef ESP32_BLE_ABS_MOUSE_H
#define ESP32_BLE_ABS_MOUSE_H
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include "BleConnectionStatus.h"
#include "BLEHIDDevice.h"
#include "BLECharacteristic.h"
class BleAbsMouse {
private:
BleConnectionStatus* connectionStatus;
BLEHIDDevice* hid;
BLECharacteristic* inputAbsMouse;
void rawAction(uint8_t msg[], char msgSize);
static void taskServer(void* pvParameter);
public:
BleAbsMouse(std::string deviceName = "ESP32 Bluetooth Abs Mouse", std::string deviceManufacturer = "Espressif", uint8_t batteryLevel = 100);
void begin(void);
void end(void);
void click(int16_t x, int16_t y);
void move(int16_t x, int16_t y);
void release(void);
void send(int state, int16_t x, int16_t y);
bool isConnected(void);
void setBatteryLevel(uint8_t level);
uint8_t batteryLevel;
std::string deviceManufacturer;
std::string deviceName;
bool isPressed;
protected:
virtual void onStarted(BLEServer *pServer) { };
};
#endif // CONFIG_BT_ENABLED
#endif // ESP32_BLE_ABS_MOUSE_H