From 00ca2823a3901c71e7f179c148ae8fd33d6ef948 Mon Sep 17 00:00:00 2001 From: T-vK Date: Thu, 8 Aug 2019 08:00:00 +0000 Subject: [PATCH] Improve documentation; Change default device info --- BleMouse.cpp | 1 - BleMouse.h | 2 +- README.md | 11 ++++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/BleMouse.cpp b/BleMouse.cpp index 2f07703..96f9a2b 100644 --- a/BleMouse.cpp +++ b/BleMouse.cpp @@ -133,7 +133,6 @@ bool BleMouse::isConnected(void) { void BleMouse::setBatteryLevel(uint8_t level) { this->batteryLevel = level; - this->hid->setBatteryLevel(level); } void BleMouse::taskServer(void* pvParameter) { diff --git a/BleMouse.h b/BleMouse.h index 63e7cc4..b731017 100644 --- a/BleMouse.h +++ b/BleMouse.h @@ -24,7 +24,7 @@ class BleMouse { void rawAction(uint8_t msg[], char msgSize); static void taskServer(void* pvParameter); public: - BleMouse(std::string deviceName = "Espressif", std::string deviceManufacturer = "ESP32 Bluetooth Mouse", uint8_t batteryLevel = 100); + BleMouse(std::string deviceName = "ESP32 Bluetooth Mouse", std::string deviceManufacturer = "Espressif", uint8_t batteryLevel = 100); void begin(void); void end(void); void click(uint8_t b = MOUSE_LEFT); diff --git a/README.md b/README.md index 185c718..5e4f194 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ This library allows you to make the ESP32 act as a Bluetooth Mouse and control w - [x] Move mouse pointer up/down - [x] Scroll up/down - [x] Scroll left/right + - [ ] Report optional battery level to host + - [x] Customize Bluetooth device name/manufacturer - [x] Compatible with Android - [x] Compatible with Windows - [x] Compatible with Linux @@ -59,11 +61,18 @@ Just remember that you have to use `bleMouse` instead of just `Mouse` and you ne BleMouse bleMouse; ``` -This library supports two additional features that the Mouse library does not support at the time of writing: +This library supports a few additional features that the Mouse library does not support at the time of writing: - Scrolling left/right E.g.: `bleMouse.move(0,0,0,1)` (Scroll left) and `bleMouse.move(0,0,0,-1)` (Scroll right) - Using the back and forward buttons E.g.: `bleMouse.click(MOUSE_BACK)` and `bleMouse.click(MOUSE_FORWARD)` +There is also Bluetooth specific information that you can use (optional): + +Instead of `BleMouse bleMouse;` you can do `BleMouse bleMouse("Bluetooth Device Name", "Bluetooth Device Manufacturer", 100);`. +The third parameter is the initial battery level of your device. To adjust the battery level later on you can simply call e.g. `bleMouse.setBatteryLevel(50)` (set battery level to 50%). +By default the battery level will be set to 100%, the device name will be `ESP32 Bluetooth Mouse` and the manufacturer will be `Espressif`. + + ## Credits Credits to [chegewara](https://github.com/chegewara) as this library is based on [this piece of code](https://github.com/nkolban/esp32-snippets/issues/230#issuecomment-473135679) that he provided. \ No newline at end of file