-
Notifications
You must be signed in to change notification settings - Fork 2
/
Laptop.h
65 lines (53 loc) · 2.19 KB
/
Laptop.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
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
62
63
64
65
//
// Created by alex on 09/01/2022.
//
#ifndef LIBRAZERBLADE_LAPTOP_H
#define LIBRAZERBLADE_LAPTOP_H
#include "BladeStructs.h"
#include "LaptopDescription.h"
#include "Usb/UsbInterface.h"
#include "Packets/PacketFactory.h"
#include "Packets/PacketUtil.h"
#include "mutex"
typedef std::lock_guard<std::mutex> LockGuard;
namespace librazerblade {
class DllExport Laptop
{
public:
Laptop(LaptopDescription description, UsbHandle usbHandle, UsbDevice device);
~Laptop();
UsbDevice getDevice() const;
UsbHandle getUsbHandle() const;
void setUsbHandle(UsbHandle handle);
uint8_t clampFan(int32_t v) const;
BladeCapabilities getCapabilities() const;
LaptopDescription getDescription();
LaptopState getState();
//Unsafe.
LaptopState* getStatePtrUnsafe();
UsbPacketResult queryFanSpeed(int numRetries = 0);
UsbPacketResult queryPowerMode(int numRetries = 0);
UsbPacketResult queryBrightness(int numRetries = 0);
UsbPacketResult queryChromaRow(int rowId, int numRetries = 0);
UsbPacketResult queryBoost(int numRetries);
LaptopQueryResult query(BladeQuery query, int numRetries = 0);
LaptopQueryResult queryRows(BladeQueryRows rows, int numRetries = 0);
UsbPacketResult setFanSpeed(int32_t speed, int numRetries = 0, int fanId = 1, bool clampSpeed = true);
UsbPacketResult setPowerMode(uint8_t powerMode, bool autoFanSpeed, int numRetries = 0);
UsbPacketResult setBrightness(uint8_t brightness, int numRetries = 0);
UsbPacketResult applyChroma(int numRetries = 0);
UsbPacketResult sendKeyboardRow(KeyboardRow row, int numRetries = 0);
UsbPacketResult
sendPacketWithRetry(RazerPacket* packet, RazerPacket* output, int numRetries = 0, int retryIntervalMs = 250);
UsbPacketResult setBoost(BladeBoostId boostId, uint8_t value, int numRetries);
static int getArrayIndex(int32_t q);
protected:
std::mutex queryMutex;
std::mutex laptopMutex;
LaptopDescription description;
LaptopState state;
UsbHandle usbHandle;
UsbDevice device;
};
}
#endif //LIBRAZERBLADE_LAPTOP_H