MissionControl/btdrv-mitm/source/controllers/bluetoothcontroller.hpp

48 lines
1.2 KiB
C++

#pragma once
#include <cstring>
#include <switch.h>
#include "../bluetooth/bluetooth_types.hpp"
namespace ams::controller {
struct HardwareID {
uint16_t vid;
uint16_t pid;
};
enum ControllerType {
ControllerType_Unknown,
ControllerType_Joycon,
ControllerType_SwitchPro,
ControllerType_Wiimote,
ControllerType_WiiUPro,
ControllerType_Dualshock4,
ControllerType_XboxOne,
};
class BluetoothController {
public:
const bluetooth::Address& address(void) const;
ControllerType type(void);
bool isSwitchController(void);
virtual Result initialize(void);
virtual void convertReportFormat(const bluetooth::HidReport *inReport, bluetooth::HidReport *outReport) {};
protected:
BluetoothController(ControllerType type, const bluetooth::Address *address);
ControllerType m_type;
bluetooth::Address m_address;
bool m_switchController;
};
inline bool bdcmp(const bluetooth::Address *addr1, const bluetooth::Address *addr2) {
return std::memcmp(addr1, addr2, sizeof(bluetooth::Address)) == 0;
}
}