From 340f15d1fa79594dbe12a6e19140ba012751b533 Mon Sep 17 00:00:00 2001 From: german77 Date: Fri, 13 Jan 2023 23:29:05 -0600 Subject: input_common: Address byte review --- .../helpers/joycon_protocol/common_protocol.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/input_common/helpers/joycon_protocol/common_protocol.h') diff --git a/src/input_common/helpers/joycon_protocol/common_protocol.h b/src/input_common/helpers/joycon_protocol/common_protocol.h index 2a3feaf59..903bcf402 100644 --- a/src/input_common/helpers/joycon_protocol/common_protocol.h +++ b/src/input_common/helpers/joycon_protocol/common_protocol.h @@ -74,12 +74,19 @@ public: */ DriverResult SendSubCommand(SubCommand sc, std::span buffer, std::vector& output); + /** + * Sends a sub command to the device and waits for it's reply and ignores the output + * @param sc sub command to be send + * @param buffer data to be send + */ + DriverResult SendSubCommand(SubCommand sc, std::span buffer); + /** * Sends a mcu command to the device * @param sc sub command to be send * @param buffer data to be send */ - DriverResult SendMcuCommand(SubCommand sc, std::span buffer); + DriverResult SendMCUCommand(SubCommand sc, std::span buffer); /** * Sends vibration data to the joycon @@ -150,4 +157,17 @@ private: std::shared_ptr hidapi_handle; }; +class ScopedSetBlocking { +public: + explicit ScopedSetBlocking(JoyconCommonProtocol* self) : m_self{self} { + m_self->SetBlocking(); + } + + ~ScopedSetBlocking() { + m_self->SetNonBlocking(); + } + +private: + JoyconCommonProtocol* m_self{}; +}; } // namespace InputCommon::Joycon -- cgit v1.2.3