Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions SerialPrograms/Source/Integrations/PybindSwitchController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ std::string PybindSwitchProController::current_status() const{
PybindSwitchProControllerInternal* internal = (PybindSwitchProControllerInternal*)m_internals;
return internal->m_connection->raw_status_text();
}
std::string PybindSwitchProController::controller_name() const{
PybindSwitchProControllerInternal* internal = (PybindSwitchProControllerInternal*)m_internals;
ProController* controller = internal->controller_if_ready();
return controller == nullptr ? "" : controller->name();
}


void PybindSwitchProController::wait_for_all_requests(){
Expand Down
6 changes: 6 additions & 0 deletions SerialPrograms/Source/Integrations/PybindSwitchController.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace NintendoSwitch{
// Button bitfields use `NintendoSwitch::Button` values, and d-pad positions use
// `NintendoSwitch::DpadPosition` values (0 = up, clockwise to 7 = up-left, 8 = none).
// Joystick coordinates are in [-1.0, 1.0] with +x = right and +y = up.
//
// Thread safety: all methods can be called from any thread.
class PybindSwitchProController{
PybindSwitchProController(const PybindSwitchProController&) = delete;
void operator=(const PybindSwitchProController&) = delete;
Expand All @@ -58,6 +60,10 @@ class PybindSwitchProController{
// or the error message if the connection failed.
std::string current_status() const;

// Name of the active controller implementation, e.g. "Nintendo Switch: Pro Controller".
// Empty if not ready.
std::string controller_name() const;

// Block until every command queued so far has been executed by the device.
// Returns immediately if the controller is not ready.
void wait_for_all_requests();
Expand Down
Loading