// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef DEVICE_GAMEPAD_NINTENDO_DATA_FETCHER_H_ #define DEVICE_GAMEPAD_NINTENDO_DATA_FETCHER_H_ #include <memory> #include <string> #include <unordered_map> #include "base/memory/weak_ptr.h" #include "base/task/sequenced_task_runner.h" #include "device/gamepad/gamepad_data_fetcher.h" #include "device/gamepad/nintendo_controller.h" #include "device/gamepad/public/cpp/gamepads.h" #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "services/device/public/mojom/hid.mojom-forward.h" namespace device { // Nintendo controllers are not typical HID gamepads and cannot be easily // supported through the platform data fetchers. However, when they are HID // devices we can use the HID backend to enumerate and initialize them. // // NintendoDataFetcher currently supports only Nintendo Switch devices: // * Switch Joy-Con L // * Switch Joy-Con R // - A pair of matching Joy-Cons may be associated to form a single gamepad. // * Switch Pro Controller // - Supports USB and Bluetooth. // * Switch Joy-Con Charging Grip // - Connects over USB and charges Joy-Cons. // - Can hold a pair of matching Joy-Cons to form a single gamepad. // - One or both Joy-Cons may be disconnected. // // When multiple Joy-Cons are connected, they are automatically associated to // form a composite gamepad if: // * The Joy-Cons form a matching pair (Joy-Con L and Joy-Con R). // * They are connected using the same bus type (both Bluetooth or both USB). // * Neither Joy-Con is already part of a composite gamepad. // The composite gamepad functions identically to a Switch Pro Controller and // exposes the same vendor and device ID but a different product name. class DEVICE_GAMEPAD_EXPORT NintendoDataFetcher : public GamepadDataFetcher, mojom::HidManagerClient { … }; } // namespace device #endif // DEVICE_GAMEPAD_NINTENDO_DATA_FETCHER_H_