Fully implement Root and virutal Feature class

This commit is contained in:
pixl
2020-06-18 02:22:05 -04:00
parent c21a923ab2
commit cc025d3b96
4 changed files with 34 additions and 14 deletions
+14 -3
View File
@@ -4,22 +4,33 @@ using namespace logid::backend::hidpp20;
Root::Root(Device* dev) : Feature(dev, ID)
{
}
feature_info Root::getFeature(uint16_t feature_id)
{
feature_info info;
feature_info info{};
std::vector<uint8_t> params(2);
params[0] = feature_id & 0xff;
params[1] = (feature_id >> 8) & 0xff;
auto response = this->callFunction(Function::Ping, params);
auto response = this->callFunction(Function::GetFeature, params);
info.feature_id = response[0];
if(!info.feature_id)
throw UnsupportedFeature(feature_id);
info.hidden = response[1] & FeatureFlag::Hidden;
info.obsolete = response[1] & FeatureFlag::Obsolete;
info.internal = response[1] & FeatureFlag::Internal;
return info;
}
std::tuple<uint8_t, uint8_t> Root::getVersion()
{
std::vector<uint8_t> params(0);
auto response = this->callFunction(Function::Ping, params);
return std::make_tuple(response[0], response[1]);
}
+1 -1
View File
@@ -23,7 +23,7 @@ namespace hidpp20
Root(Device* device);
feature_info getFeature (uint16_t feature_id);
void ping();
std::tuple<uint8_t, uint8_t> getVersion();
private:
enum FeatureFlag : uint8_t
{