TODO cleanup: Add PowerSwitchLocation enum

master
pixl 4 years ago
parent 944a6419b4
commit 825967b140
No known key found for this signature in database
GPG Key ID: 1866C148CD593B6E
  1. 7
      src/logid/backend/dj/Receiver.cpp
  2. 19
      src/logid/backend/dj/Receiver.h

@ -191,7 +191,11 @@ struct Receiver::ExtendedPairingInfo
for(uint8_t i = 0; i < 4; i++)
info.reportTypes[i] = response[i + 4];
info.powerSwitchLocation = response[8] & 0xf;
uint8_t psl = response[8] & 0xf;
if(psl > 0xc)
info.powerSwitchLocation = PowerSwitchLocation::Reserved;
else
info.powerSwitchLocation = static_cast<PowerSwitchLocation>(psl);
return info;
}
@ -325,7 +329,6 @@ Receiver::ConnectionStatusEvent Receiver::connectionStatusEvent(Report& report)
void Receiver::listen()
{
if(!_raw_device->isListening())
///TODO: Kill RawDevice?
_raw_device->listenAsync();
if(_raw_device->eventHandlers().find("RECV_HIDPP") ==

@ -126,11 +126,28 @@ namespace dj
DeviceType::DeviceType deviceType;
};
enum class PowerSwitchLocation : uint8_t
{
Reserved = 0x0,
Base = 0x1,
TopCase = 0x2,
TopRightEdge = 0x3,
Other = 0x4,
TopLeft = 0x5,
BottomLeft = 0x6,
TopRight = 0x7,
BottomRight = 0x8,
TopEdge = 0x9,
RightEdge = 0xa,
LeftEdge = 0xb,
BottomEdge = 0xc
};
struct ExtendedPairingInfo
{
uint32_t serialNumber;
uint8_t reportTypes[4];
uint8_t powerSwitchLocation; ///TODO: Make enum
PowerSwitchLocation powerSwitchLocation;
};
struct PairingInfo getPairingInfo(hidpp::DeviceIndex index);

Loading…
Cancel
Save