forked from T-vK/ESP32-BLE-Keyboard
/
BLEComboStats.cpp
61 lines (53 loc) · 1.13 KB
/
BLEComboStats.cpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "BLECombo.h"
#include <HIDTypes.h>
#include <NimBLEDevice.h>
#include <NimBLEHIDDevice.h>
#include <NimBLEServer.h>
#include <NimBLEUtils.h>
#include <driver/adc.h>
#include <sdkconfig.h>
#if defined(CONFIG_ARDUHAL_ESP_LOG)
#include <esp32-hal-log.h>
#define LOG_TAG ""
#else
#include <esp_log.h>
static const char* LOG_TAG = "BLEDevice";
#endif
bool BLECombo::isConnected(void)
{
return _connected;
}
void BLECombo::setBatteryLevel(uint8_t level)
{
_batteryLevel = level;
if (_hid)
_hid->setBatteryLevel(_batteryLevel);
if (_hidMouse)
_hidMouse->setBatteryLevel(_batteryLevel);
}
// must be called before begin in order to set the name
void BLECombo::setName(std::string deviceName)
{
_deviceName = deviceName;
}
/**
* @brief Sets the waiting time (in milliseconds) between multiple keystrokes in NimBLE mode.
*
* @param ms Time in milliseconds
*/
void BLECombo::setDelay(uint32_t ms)
{
_delay_ms = ms;
}
void BLECombo::setVendorId(uint16_t vid)
{
_vid = vid;
}
void BLECombo::setProductId(uint16_t pid)
{
_pid = pid;
}
void BLECombo::setVersion(uint16_t version)
{
_version = version;
}