Skip to content

Commit

Permalink
extend report protocol methods
Browse files Browse the repository at this point in the history
  • Loading branch information
benedekkupper committed Dec 9, 2023
1 parent 037acfc commit 925052c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions hid-rp/hid/report_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,40 @@ struct report_protocol_properties
{
return std::max(max_input_size, std::max(max_output_size, max_feature_size));
}
constexpr size_type max_report_size(report::type type) const
{
switch (type)
{
case report::type::INPUT:
return max_input_size;
case report::type::OUTPUT:
return max_output_size;
case report::type::FEATURE:
return max_feature_size;
default:
return 0;
}
}

constexpr bool uses_report_ids() const { return max_report_id() >= report::id::min(); }
constexpr report::id::type max_report_id() const
{
return std::max(max_input_id, std::max(max_output_id, max_feature_id));
}
constexpr report::id::type max_report_id(report::type type) const
{
switch (type)
{
case report::type::INPUT:
return max_input_id;
case report::type::OUTPUT:
return max_output_id;
case report::type::FEATURE:
return max_feature_id;
default:
return 0;
}
}

/// @brief Define the report protocol properties, with no report ID use.
/// @param max_input_size: The size of the longest INPUT report in bytes, including the report
Expand Down

0 comments on commit 925052c

Please sign in to comment.