TODO cleanup: Add PowerSwitchLocation enum

This commit is contained in:
pixl 2020-07-13 22:42:23 -04:00
parent 944a6419b4
commit 825967b140
No known key found for this signature in database
GPG Key ID: 1866C148CD593B6E
2 changed files with 23 additions and 3 deletions

View File

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

View File

@ -126,11 +126,28 @@ namespace dj
DeviceType::DeviceType deviceType; 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 struct ExtendedPairingInfo
{ {
uint32_t serialNumber; uint32_t serialNumber;
uint8_t reportTypes[4]; uint8_t reportTypes[4];
uint8_t powerSwitchLocation; ///TODO: Make enum PowerSwitchLocation powerSwitchLocation;
}; };
struct PairingInfo getPairingInfo(hidpp::DeviceIndex index); struct PairingInfo getPairingInfo(hidpp::DeviceIndex index);