Files
OpenRGB/Controllers/SteelSeriesController/SteelSeriesMouseController.cpp
Chris a961bf87b4 Initial commit for the Steelseries Aerox 3 mouse to resolve #2492
+ Adding STEELSERIES_AEROX_3_PID and registering detector
+ Adding Abstract SteelSeriesMouseController class to accomodate new mouse
+ Adding SteelSeriesAerox3Controller class
* Rewrote SteelSeriesRival3Controller to align with abstract class
* Adjusted RGBController_SteelSeriesRival3 class to align with both mice
2022-06-20 11:54:19 +10:00

62 lines
1.6 KiB
C++

/*-------------------------------------------------------------------*\
| SteelSeriesMouseController.cpp |
| |
| OpenRGB abstract driver for SteelSeries Mice |
| |
| Chris M (Dr_No) 9th June 2022 |
\*-------------------------------------------------------------------*/
#include <cstring>
#include "SteelSeriesMouseController.h"
SteelSeriesMouseController::SteelSeriesMouseController(hid_device* dev_handle, steelseries_type proto_type, const char* path)
{
dev = dev_handle;
location = path;
proto = proto_type;
}
SteelSeriesMouseController::~SteelSeriesMouseController()
{
}
std::string SteelSeriesMouseController::GetDeviceLocation()
{
return("HID: " + location);
}
char* SteelSeriesMouseController::GetDeviceName()
{
return device_name;
}
std::string SteelSeriesMouseController::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if (ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
steelseries_type SteelSeriesMouseController::GetMouseType()
{
return proto;
}
void SteelSeriesMouseController::Save()
{
const uint8_t SAVE_BUFFER_SIZE = 10;
uint8_t usb_buf[SAVE_BUFFER_SIZE] = { 0x00, 0x09 };
hid_write(dev, usb_buf, SAVE_BUFFER_SIZE);
}