Start writing an RGBController interface for the Razer Chroma SDK on Windows

This commit is contained in:
Adam Honse 2019-09-03 00:38:56 -05:00
parent b5f687c402
commit 0a61e38ee1
11 changed files with 1697 additions and 5 deletions

View file

@ -438,6 +438,7 @@ void DetectCorsairProControllers(std::vector<i2c_smbus_interface*> &busses, std:
void DetectHyperXControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers);
void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers);
void DetectRazerChromaSDKControllers(std::vector<RGBController*>& rgb_controllers);
/******************************************************************************************\
* *
@ -458,7 +459,9 @@ void DetectRGBControllers(void)
DetectLEDStripControllers(rgb_controllers);
#ifndef WIN32
#ifdef WIN32
DetectRazerChromaSDKControllers(rgb_controllers);
#else
DetectOpenRazerControllers(rgb_controllers);
#endif

View file

@ -98,7 +98,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32_LEAN_AND_MEAN</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\dependencies\razer-chroma-2.9.0\inc;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
@ -120,7 +120,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\dependencies\razer-chroma-2.9.0\inc;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
@ -140,7 +140,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32_LEAN_AND_MEAN</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\dependencies\razer-chroma-2.9.0\inc;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
@ -166,7 +166,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\dependencies\razer-chroma-2.9.0\inc;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
@ -198,6 +198,7 @@
<ClCompile Include="main.cpp" />
<ClCompile Include="net_port\net_port.cpp" />
<ClCompile Include="OpenAuraSDK.cpp" />
<ClCompile Include="RGBController\RazerChromaSDKDetect.cpp" />
<ClCompile Include="RGBController\RGBController_AorusGPU.cpp" />
<ClCompile Include="RGBController\RGBController_Aura.cpp" />
<ClCompile Include="RGBController\RGBController_Corsair.cpp" />
@ -205,6 +206,7 @@
<ClCompile Include="RGBController\RGBController_HuePlus.cpp" />
<ClCompile Include="RGBController\RGBController_HyperX.cpp" />
<ClCompile Include="RGBController\RGBController_LEDStrip.cpp" />
<ClCompile Include="RGBController\RGBController_RazerChromaSDK.cpp" />
<ClCompile Include="serial_port\serial_port.cpp" />
<ClCompile Include="vc\I2CDetectDialog.cpp" />
<ClCompile Include="vc\OpenAuraSDKDialog.cpp" />
@ -234,6 +236,7 @@
<ClInclude Include="RGBController\RGBController_HuePlus.h" />
<ClInclude Include="RGBController\RGBController_HyperX.h" />
<ClInclude Include="RGBController\RGBController_LEDStrip.h" />
<ClInclude Include="RGBController\RGBController_RazerChromaSDK.h" />
<ClInclude Include="serial_port\serial_port.h" />
<ClInclude Include="vc\I2CDetectDialog.h" />
<ClInclude Include="vc\OpenAuraSDKDialog.h" />

View file

@ -126,6 +126,12 @@
<ClCompile Include="RGBController\RGBController_HuePlus.cpp">
<Filter>Source Files\RGBController</Filter>
</ClCompile>
<ClCompile Include="RGBController\RGBController_RazerChromaSDK.cpp">
<Filter>Source Files\RGBController</Filter>
</ClCompile>
<ClCompile Include="RGBController\RazerChromaSDKDetect.cpp">
<Filter>Source Files\RGBController</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="vc\Resource.rc">
@ -208,5 +214,8 @@
<ClInclude Include="RGBController\RGBController_HuePlus.h">
<Filter>Header Files\RGBController</Filter>
</ClInclude>
<ClInclude Include="RGBController\RGBController_RazerChromaSDK.h">
<Filter>Header Files\RGBController</Filter>
</ClInclude>
</ItemGroup>
</Project>

View file

@ -0,0 +1,131 @@
/*-----------------------------------------*\
| RGBController_RazerChromaSDK.h |
| |
| Generic RGB Interface for official Razer |
| Chroma SDK |
| |
| Adam Honse (CalcProgrammer1) 9/2/2019 |
\*-----------------------------------------*/
#include "RGBController_RazerChromaSDK.h"
CREATEEFFECT RGBController_RazerChromaSDK::CreateEffect = NULL;
CREATEKEYBOARDEFFECT RGBController_RazerChromaSDK::CreateKeyboardEffect = NULL;
CREATEMOUSEEFFECT RGBController_RazerChromaSDK::CreateMouseEffect = NULL;
CREATEMOUSEPADEFFECT RGBController_RazerChromaSDK::CreateMousepadEffect = NULL;
CREATEHEADSETEFFECT RGBController_RazerChromaSDK::CreateHeadsetEffect = NULL;
CREATECHROMALINKEFFECT RGBController_RazerChromaSDK::CreateChromaLinkEffect = NULL;
RGBController_RazerChromaSDK::RGBController_RazerChromaSDK(unsigned int device_type, HMODULE* hModule)
{
unsigned int led_count = 0;
for (int i = 0; i < RAZER_NUM_DEVICES; i++)
{
if (device_list[i]->type == device_type)
{
name = device_list[i]->name;
for (int zone_id = 0; zone_id < RAZER_MAX_ZONES; zone_id++)
{
if (device_list[i]->zones[zone_id] != NULL)
{
device = device_list[i];
zone* new_zone = new zone();
new_zone->name = device_list[i]->zones[zone_id]->name;
std::vector<int>* new_zone_map = new std::vector<int>();
for (int led_id = 0; led_id < device_list[i]->zones[zone_id]->leds; led_id++)
{
RGBColor new_color = 0x00000000;
colors.push_back(new_color);
led* new_led = new led();
new_led->name = device_list[i]->zones[zone_id]->name;
leds.push_back(*new_led);
new_zone_map->push_back(led_count);
led_count++;
}
zones.push_back(*new_zone);
}
}
}
}
if(CreateEffect == NULL) CreateEffect = (CREATEEFFECT)GetProcAddress(*hModule, "CreateEffect");
if(CreateKeyboardEffect == NULL) CreateKeyboardEffect = (CREATEKEYBOARDEFFECT)GetProcAddress(*hModule, "CreateKeyboardEffect");
if(CreateMouseEffect == NULL) CreateMouseEffect = (CREATEMOUSEEFFECT)GetProcAddress(*hModule, "CreateMouseEffect");
if(CreateMousepadEffect == NULL) CreateMousepadEffect = (CREATEMOUSEPADEFFECT)GetProcAddress(*hModule, "CreateMousepadEffect");
if(CreateHeadsetEffect == NULL) CreateHeadsetEffect = (CREATEHEADSETEFFECT)GetProcAddress(*hModule, "CreateHeadsetEffect");
if(CreateChromaLinkEffect == NULL) CreateChromaLinkEffect = (CREATECHROMALINKEFFECT)GetProcAddress(*hModule, "CreateChromaLinkEffect");
}
int RGBController_RazerChromaSDK::GetMode()
{
return 0;
}
void RGBController_RazerChromaSDK::SetMode(int mode)
{
}
void RGBController_RazerChromaSDK::SetCustomMode()
{
}
void RGBController_RazerChromaSDK::SetAllLEDs(RGBColor color)
{
for (int i = 0; i < colors.size(); i++)
{
colors[i] = color;
}
UpdateLEDs();
}
void RGBController_RazerChromaSDK::SetAllZoneLEDs(int zone, RGBColor color)
{
for (int x = 0; x < zones[zone].map.size(); x++)
{
for (int y = 0; y < zones[zone].map[x].size(); y++)
{
colors[zones[zone].map[x][y]] = color;
}
}
UpdateLEDs();
}
void RGBController_RazerChromaSDK::SetLED(int led, RGBColor color)
{
colors[led] = color;
UpdateLEDs();
}
void RGBController_RazerChromaSDK::UpdateLEDs()
{
switch (device->type)
{
case RAZER_FIREFLY_CHROMA:
{
//Firefly Chroma
ChromaSDK::Mousepad::CUSTOM_EFFECT_TYPE FireflyEffect = {};
for (int x = 0; x < 15; x++)
{
FireflyEffect.Color[x] = colors[x];
}
CreateMousepadEffect(ChromaSDK::Mousepad::CHROMA_CUSTOM, &FireflyEffect, NULL);
}
break;
}
}

View file

@ -0,0 +1,172 @@
/*-----------------------------------------*\
| RGBController_RazerChromaSDK.h |
| |
| Generic RGB Interface for official Razer |
| Chroma SDK |
| |
| Adam Honse (CalcProgrammer1) 9/2/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include <Windows.h>
#include "RzChromaSDKDefines.h"
#include "RzChromaSDKTypes.h"
#include "RzErrors.h"
using namespace ChromaSDK::Keyboard;
typedef RZRESULT(*INIT)(void);
typedef RZRESULT(*UNINIT)(void);
typedef RZRESULT(*CREATEEFFECT)(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
typedef RZRESULT(*CREATEKEYBOARDEFFECT)(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
typedef RZRESULT(*CREATEMOUSEEFFECT)(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
typedef RZRESULT(*CREATEMOUSEPADEFFECT)(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
typedef RZRESULT(*CREATEHEADSETEFFECT)(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
typedef RZRESULT(*CREATECHROMALINKEFFECT)(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
#define RAZER_MAX_ZONES 4
#define RAZER_NUM_DEVICES 2
enum
{
RAZER_NO_DEVICE,
RAZER_BLACKWIDOW_CHROMA,
RAZER_DEATHSTALKER_CHROMA,
RAZER_ORNATA_CHROMA,
RAZER_BLADE_STEALTH,
RAZER_BLADE_PRO,
RAZER_TARTARUS_CHROMA,
RAZER_DEATHADDER_CHROMA,
RAZER_DEATHADDER_ELITE,
RAZER_NAGA_CHROMA,
RAZER_DIAMONDBACK_CHROMA,
RAZER_MAMBA_TOURNAMENT_EDITION_CHROMA,
RAZER_FIREFLY_CHROMA,
RAZER_GOLIATHUS_EXTENDED_CHROMA,
RAZER_MUG_HOLDER,
RAZER_CORE,
RAZER_KRAKEN_V1,
RAZER_KRAKEN_V2,
RAZER_CHROMA_HDK
};
enum
{
RAZER_MODE_CUSTOM,
RAZER_MODE_OFF,
RAZER_MODE_STATIC,
RAZER_MODE_BREATHING,
RAZER_MODE_SPECTRUM_CYCLE,
RAZER_MODE_WAVE,
RAZER_MODE_REACTIVE,
RAZER_NUM_MODES
};
typedef struct
{
std::string name;
unsigned int type;
unsigned int leds;
} razer_zone;
typedef struct
{
std::string name;
unsigned int type;
const razer_zone* zones[RAZER_MAX_ZONES];
} razer_device;
/*------------------------------------------------------------ *\
| Razer Firefly |
| |
| Zone "LED Strip" |
| Linear |
| 15 LEDs |
\*-------------------------------------------------------------*/
static const razer_zone firefly_zone =
{
"LED Strip",
ZONE_TYPE_LINEAR,
15
};
static const razer_device firefly_device =
{
"Razer Firefly",
RAZER_FIREFLY_CHROMA,
{
&firefly_zone,
NULL,
NULL,
NULL
}
};
/*------------------------------------------------------------ *\
| Razer Chroma HDK |
| |
| Zone "LED Strip" |
| Linear |
| 16 LEDs |
| |
| Zone "LED Strip" |
| Linear |
| 16 LEDs |
| |
| Zone "LED Strip" |
| Linear |
| 16 LEDs |
| |
| Zone "LED Strip" |
| Linear |
| 16 LEDs |
\*-------------------------------------------------------------*/
static const razer_zone chromahdk_zone =
{
"LED Strip",
ZONE_TYPE_LINEAR,
16
};
static const razer_device chromahdk_device =
{
"Razer Chroma HDK",
RAZER_CHROMA_HDK,
{
&chromahdk_zone,
&chromahdk_zone,
&chromahdk_zone,
&chromahdk_zone
}
};
static const razer_device* device_list[RAZER_NUM_DEVICES] =
{
&firefly_device,
&chromahdk_device
};
class RGBController_RazerChromaSDK : public RGBController
{
public:
RGBController_RazerChromaSDK(unsigned int device_type, HMODULE* hModule);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void SetAllLEDs(RGBColor color);
void SetAllZoneLEDs(int zone, RGBColor color);
void SetLED(int led, RGBColor color);
void UpdateLEDs();
private:
const razer_device* device;
static CREATEEFFECT CreateEffect;
static CREATEKEYBOARDEFFECT CreateKeyboardEffect;
static CREATEMOUSEEFFECT CreateMouseEffect;
static CREATEMOUSEPADEFFECT CreateMousepadEffect;
static CREATEHEADSETEFFECT CreateHeadsetEffect;
static CREATECHROMALINKEFFECT CreateChromaLinkEffect;
};

View file

@ -0,0 +1,63 @@
#include "RGBController.h"
#include "RGBController_RazerChromaSDK.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
static HMODULE hModule;
#include "RzChromaSDKDefines.h"
#include "RzChromaSDKTypes.h"
#include "RzErrors.h"
using namespace ChromaSDK::Keyboard;
typedef RZRESULT(*INIT)(void);
typedef RZRESULT(*UNINIT)(void);
typedef RZRESULT(*CREATEEFFECT)(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
typedef RZRESULT(*CREATEKEYBOARDEFFECT)(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
typedef RZRESULT(*CREATEMOUSEEFFECT)(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
typedef RZRESULT(*CREATEMOUSEPADEFFECT)(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
typedef RZRESULT(*CREATEHEADSETEFFECT)(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
typedef RZRESULT(*CREATECHROMALINKEFFECT)(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
#ifdef _WIN64
#define CHROMASDKDLL ("RzChromaSDK64.dll")
#else
#define CHROMASDKDLL ("RzChromaSDK.dll")
#endif
/******************************************************************************************\
* *
* DetectRazerChromaSDKControllers *
* *
* Detect devices supported by the Razer Chroma SDK *
* * *
\******************************************************************************************/
void DetectRazerChromaSDKControllers(std::vector<RGBController*>& rgb_controllers)
{
// Dynamically loads the Chroma SDK library.
hModule = LoadLibrary(CHROMASDKDLL);
if (hModule)
{
INIT Init = (INIT)GetProcAddress(hModule, "Init");
if (Init)
{
//Initialize the SDK
Init();
}
}
RGBController_RazerChromaSDK* razer_rgb = new RGBController_RazerChromaSDK(RAZER_CHROMA_HDK, &hModule);
rgb_controllers.push_back(razer_rgb);
razer_rgb = new RGBController_RazerChromaSDK(RAZER_FIREFLY_CHROMA, &hModule);
rgb_controllers.push_back(razer_rgb);
} /* DetectRazerChromaSDKControllers() */

View file

@ -0,0 +1,62 @@
//! \file RzChromaLinkAPI.h
//! \brief Exported APIs.
#ifndef _RZCHROMALINKAPI_H_
#define _RZCHROMALINKAPI_H_
#pragma once
#include "RzErrors.h"
#include "RzChromaSDKTypes.h"
using namespace ChromaSDK;
// Callback funtion
typedef LONG(*LPCHROMALINKPROC)(ChromaLink::EFFECT_TYPE Effect, PRZPARAM pData);
// Exported functions
#ifdef __cplusplus
extern "C"
{
#endif
/*!
* Initialize Chroma Link API.
* @return <b>RZRESULT_ALREADY_INITIALIZED</b>: Chroma Link API has already been initialized.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT Init(ChromaSDK::APPINFOTYPE AppInfo);
/*!
* UnInitialize Chroma API.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT UnInit(void);
/*!
* Register for Chroma Link effect events.
* @param[in] lpFunc Callback function.
* @return <b>ERROR_INVALID_PARAMETER</b>: lpFunc is invalid.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
* @remark
* - <b>CHROMA_NONE</b> : This event will be sent when there are no more Chroma Link events.
* Clients can resume their own lighting effects.
* - <b>CHROMA_CUSTOM</b> : This event will be sent when there is a ChromaSDK::ChromaLink::CHROMA_CUSTOM effect event.
* pData is casted to ChromaSDK::ChromaLink::CUSTOM_EFFECT_TYPE.
* The colors of each (5) LEDs can be accessed from the array.
* - <b>CHROMA_STATIC</b> : This event will be sent when there is a ChromaSDK::ChromaLink::CHROMA_STATIC effect event.
* pData is casted to ChromaSDK::ChromaLink::STATIC_EFFECT_TYPE.
* The color can be accessed from the structure.
*/
RZRESULT RegisterEventNotification(LPCHROMALINKPROC lpFunc);
/*!
* Register for Chroma Link effect events.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT UnregisterEventNotification(void);
#ifdef __cplusplus
}
#endif
#endif // _RZCHROMALINKAPI_H_

View file

@ -0,0 +1,189 @@
//! \file RzChromaSDK.h
//! \brief Exported APIs.
#ifndef _RZCHROMASDK_H_
#define _RZCHROMASDK_H_
#pragma once
#include "RzErrors.h"
#include "RzChromaSDKDefines.h"
#include "RzChromaSDKTypes.h"
using namespace ChromaSDK;
using namespace ChromaSDK::Keyboard;
using namespace ChromaSDK::Mouse;
using namespace ChromaSDK::Headset;
using namespace ChromaSDK::Mousepad;
using namespace ChromaSDK::Keypad;
using namespace ChromaSDK::ChromaLink;
// Exported functions
#ifdef __cplusplus
extern "C"
{
#endif
/*!
* Initialize Chroma SDK.
* @return <b>RZRESULT_SERVICE_NOT_ACTIVE</b>: Chroma SDK Service not running.
* @return <b>RZRESULT_ALREADY_INITIALIZED</b>: Chroma SDK has already been initialized.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT Init(void);
/*!
* UnInitialize Chroma SDK.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. For every Init() call there should be a corresponding UnInit().
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT UnInit(void);
/*!
* Create generic effect for specific or all devices.
* @param[in] DeviceId Device Id defined in RzChromaSDKDefines.h
* @param[in] Effect Standard effect type.
* @param[in] pParam Pointer to a parameter type specified by Effect.
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
* @return <b>RZRESULT_DEVICE_NOT_AVAILABLE</b>: Device not supported.
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT CreateEffect(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
/*!
* Create keyboard effect.
* @param[in] Effect Keyboard effect type.
* @param[in] pParam Pointer to a parameter type specified by Effect.
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT CreateKeyboardEffect(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
/*!
* Create mouse effect.
* @param[in] Effect Mouse effect type.
* @param[in] pParam Pointer to a parameter type specified by Effect.
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT CreateMouseEffect(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
/*!
* Create headset effect.
* @param[in] Effect Headset effect type.
* @param[in] pParam Pointer to a parameter type specified by Effect defined in RzChromaSDKTypes.h
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT CreateHeadsetEffect(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
/*!
* Create mousepad effect.
* @param[in] Effect Mousemat effect type.
* @param[in] pParam Pointer to a parameter type specified by Effect defined in RzChromaSDKTypes.h
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT CreateMousepadEffect(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
/*!
* Create keypad effect.
* @param[in] Effect Keypad effect type.
* @param[in] pParam Pointer to a parameter type specified by Effect defined in RzChromaSDKTypes.h
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT CreateKeypadEffect(ChromaSDK::Keypad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
/*!
* Create effects on Chroma Linked devices.
* @param[in] Effect Chroma Link effect type.
* @param[in] pParam Pointer to a parameter type specified by Effect defined in RzChromaSDKTypes.h
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT CreateChromaLinkEffect(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
/*!
* Delete effect
* @param[in] EffectId Id of the effect that needs to be deleted.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
* @return <b>RZRESULT_NOT_FOUND</b>: Effect Id not found.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT DeleteEffect(RZEFFECTID EffectId);
/*!
* Set effect.
* @param[in] EffectId Id of the effect that needs to be set.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
* @return <b>RZRESULT_ACCESS_DENIED</b>: No permision to access device.
* @return <b>RZRESULT_NOT_FOUND</b>: Effect Id not found.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT SetEffect(RZEFFECTID EffectId);
/*!
* Register for event notification.
* @param[in] hWnd Application window handle.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
* @return <b>RZRESULT_ALREADY_INITIALIZED</b>: Invalid Windows handle.
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
* @remark <b>WM_CHROMA_EVENT</b> will be sent if there is an event.
* @remark
* - \c <b>wParam</b> = 1 : Chroma SDK support.
* - \c <b>lParam</b> = 1 : Enabled.
* - \c <b>lParam</b> = 0 : Disabled.
* - \c <b>wParam</b> = 2 : Access to device.
* - \c <b>lParam</b> = 1 : Granted accessible.
* - \c <b>lParam</b> = 0 = Access revoked.
* - \c <b>wParam</b> = 3 : Application state.
* - \c <b>lParam</b> = 1 : Enabled.
* - \c <b>lParam</b> = 0 = Disabled.
*/
RZRESULT RegisterEventNotification(HWND hWnd);
/*!
* Un-register for event notification.
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Internal state is not valid. There was no event registered.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT UnregisterEventNotification();
/*!
* Query for device information.
* @param[in] DeviceId Device id found in RzChromaSDKDefines.h
* @param[out] DeviceInfo Contains device information specified by DeviceId.
* @return <b>RZRESULT_DEVICE_NOT_AVAILABLE</b>: Device not supported.
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
*/
RZRESULT QueryDevice(RZDEVICEID DeviceId, DEVICE_INFO_TYPE &DeviceInfo);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,182 @@
//! \file RzChromaSDKDefines.h
//! \brief Definitions of global and static variables.
#ifndef _RZSCHROMADKDEFINES_H_
#define _RZSCHROMADKDEFINES_H_
#pragma once
#ifndef GUID_DEFINED
#include <Guiddef.h>
#endif
namespace ChromaSDK
{
// Keyboards
//! Razer Blackwidow Chroma device.
// {2EA1BB63-CA28-428D-9F06-196B88330BBB}
static const GUID BLACKWIDOW_CHROMA =
{ 0x2ea1bb63, 0xca28, 0x428d, { 0x9f, 0x06, 0x19, 0x6b, 0x88, 0x33, 0x0b, 0xbb } };
//! Razer Blackwidow Chroma Tournament Edition device.
// {ED1C1B82-BFBE-418F-B49D-D03F05B149DF}
static const GUID BLACKWIDOW_CHROMA_TE =
{ 0xed1c1b82, 0xbfbe, 0x418f, { 0xb4, 0x9d, 0xd0, 0x3f, 0x5, 0xb1, 0x49, 0xdf } };
//! Razer Deathstalker device.
// {18C5AD9B-4326-4828-92C4-2669A66D2283}
static const GUID DEATHSTALKER_CHROMA =
{ 0x18c5ad9b, 0x4326, 0x4828, { 0x92, 0xc4, 0x26, 0x69, 0xa6, 0x6d, 0x22, 0x83 } };
//! Overwatch Keyboard.
// {872AB2A9-7959-4478-9FED-15F6186E72E4}
static const GUID OVERWATCH_KEYBOARD =
{ 0x872ab2a9, 0x7959, 0x4478, { 0x9f, 0xed, 0x15, 0xf6, 0x18, 0x6e, 0x72, 0xe4 } };
//! Razer Blackwidow X Chroma device.
// {5AF60076-ADE9-43D4-B574-52599293B554}
static const GUID BLACKWIDOW_X_CHROMA =
{ 0x5af60076, 0xade9, 0x43d4, { 0xb5, 0x74, 0x52, 0x59, 0x92, 0x93, 0xb5, 0x54 } };
//! Razer Blackwidow X TE Chroma device.
// {2D84DD51-3290-4AAC-9A89-D8AFDE38B57C}
static const GUID BLACKWIDOW_X_TE_CHROMA =
{ 0x2d84dd51, 0x3290, 0x4aac, { 0x9a, 0x89, 0xd8, 0xaf, 0xde, 0x38, 0xb5, 0x7c } };
//! Razer Ornata Chroma
// {803378C1-CC48-4970-8539-D828CC1D420A}
static const GUID ORNATA_CHROMA =
{ 0x803378c1, 0xcc48, 0x4970,{ 0x85, 0x39, 0xd8, 0x28, 0xcc, 0x1d, 0x42, 0xa } };
//! Razer Blade Stealth.
// {C83BDFE8-E7FC-40E0-99DB-872E23F19891}
static const GUID BLADE_STEALTH =
{ 0xc83bdfe8, 0xe7fc, 0x40e0, { 0x99, 0xdb, 0x87, 0x2e, 0x23, 0xf1, 0x98, 0x91 } };
//! Razer Blade
// {F2BEDFAF-A0FE-4651-9D41-B6CE603A3DDD}
static const GUID BLADE =
{ 0xf2bedfaf, 0xa0fe, 0x4651, { 0x9d, 0x41, 0xb6, 0xce, 0x60, 0x3a, 0x3d, 0xdd } };
//! Razer Blade Pro
// {A73AC338-F0E5-4BF7-91AE-DD1F7E1737A5}
static const GUID BLADE_PRO =
{ 0xa73ac338, 0xf0e5, 0x4bf7,{ 0x91, 0xae, 0xdd, 0x1f, 0x7e, 0x17, 0x37, 0xa5 } };
// Mice
//! Razer Deathadder Chroma device.
// {AEC50D91-B1F1-452F-8E16-7B73F376FDF3}
static const GUID DEATHADDER_CHROMA =
{ 0xaec50d91, 0xb1f1, 0x452f, { 0x8e, 0x16, 0x7b, 0x73, 0xf3, 0x76, 0xfd, 0xf3 } };
//! Razer Mamba Chroma Tournament Edition device.
// {7EC00450-E0EE-4289-89D5-0D879C19061A}
static const GUID MAMBA_CHROMA_TE =
{ 0x7ec00450, 0xe0ee, 0x4289, { 0x89, 0xd5, 0xd, 0x87, 0x9c, 0x19, 0x6, 0x1a } };
//! Razer Diamondback device.
// {FF8A5929-4512-4257-8D59-C647BF9935D0}
static const GUID DIAMONDBACK_CHROMA =
{ 0xff8a5929, 0x4512, 0x4257, { 0x8d, 0x59, 0xc6, 0x47, 0xbf, 0x99, 0x35, 0xd0 } };
//! Razer Mamba device.
// {D527CBDC-EB0A-483A-9E89-66D50463EC6C}
static const GUID MAMBA_CHROMA =
{ 0xd527cbdc, 0xeb0a, 0x483a, { 0x9e, 0x89, 0x66, 0xd5, 0x4, 0x63, 0xec, 0x6c } };
//! Razer Naga Epic device.
// {D714C50B-7158-4368-B99C-601ACB985E98}
static const GUID NAGA_EPIC_CHROMA =
{ 0xd714c50b, 0x7158, 0x4368, { 0xb9, 0x9c, 0x60, 0x1a, 0xcb, 0x98, 0x5e, 0x98 } };
//! Razer Naga device.
// {F1876328-6CA4-46AE-BE04-BE812B414433}
static const GUID NAGA_CHROMA =
{ 0xf1876328, 0x6ca4, 0x46ae, { 0xbe, 0x4, 0xbe, 0x81, 0x2b, 0x41, 0x44, 0x33 } };
//! Razer Orochi Chroma device.
// {52C15681-4ECE-4DD9-8A52-A1418459EB34}
static const GUID OROCHI_CHROMA =
{ 0x52c15681, 0x4ece, 0x4dd9, { 0x8a, 0x52, 0xa1, 0x41, 0x84, 0x59, 0xeb, 0x34 } };
//! Razer Naga Hex Chroma device.
// {195D70F5-F285-4CFF-99F2-B8C0E9658DB4}
static const GUID NAGA_HEX_CHROMA =
{ 0x195d70f5, 0xf285, 0x4cff, { 0x99, 0xf2, 0xb8, 0xc0, 0xe9, 0x65, 0x8d, 0xb4 } };
//! Razer DeathAdder Elite Chroma device.
// {77834867-3237-4A9F-AD77-4A46C4183003}
static const GUID DEATHADDER_ELITE_CHROMA =
{ 0x77834867, 0x3237, 0x4a9f,{ 0xad, 0x77, 0x4a, 0x46, 0xc4, 0x18, 0x30, 0x3 } };
// Headsets
//! Razer Kraken 7.1 Chroma device.
// {CD1E09A5-D5E6-4A6C-A93B-E6D9BF1D2092}
static const GUID KRAKEN71_CHROMA =
{ 0xcd1e09a5, 0xd5e6, 0x4a6c, { 0xa9, 0x3b, 0xe6, 0xd9, 0xbf, 0x1d, 0x20, 0x92 } };
//! Razer ManO'War device.
// {DF3164D7-5408-4A0E-8A7F-A7412F26BEBF}
static const GUID MANOWAR_CHROMA =
{ 0xdf3164d7, 0x5408, 0x4a0e, { 0x8a, 0x7f, 0xa7, 0x41, 0x2f, 0x26, 0xbe, 0xbf } };
//! Razer Kraken 7.1 Chroma Refresh headset.
// {7FB8A36E-9E74-4BB3-8C86-CAC7F7891EBD}
static const GUID KRAKEN71_REFRESH_CHROMA =
{ 0x7fb8a36e, 0x9e74, 0x4bb3,{ 0x8c, 0x86, 0xca, 0xc7, 0xf7, 0x89, 0x1e, 0xbd } };
// Mouse mat
//! Razer Firefly device.
// {80F95A94-73D2-48CA-AE9A-0986789A9AF2}
static const GUID FIREFLY_CHROMA =
{ 0x80f95a94, 0x73d2, 0x48ca, { 0xae, 0x9a, 0x9, 0x86, 0x78, 0x9a, 0x9a, 0xf2 } };
// Keypads
//! Razer Tartarus device.
// {00F0545C-E180-4AD1-8E8A-419061CE505E}
static const GUID TARTARUS_CHROMA =
{ 0xf0545c, 0xe180, 0x4ad1, { 0x8e, 0x8a, 0x41, 0x90, 0x61, 0xce, 0x50, 0x5e } };
//! Razer Orbweaver device.
// {9D24B0AB-0162-466C-9640-7A924AA4D9FD}
static const GUID ORBWEAVER_CHROMA =
{ 0x9d24b0ab, 0x162, 0x466c, { 0x96, 0x40, 0x7a, 0x92, 0x4a, 0xa4, 0xd9, 0xfd } };
// Chroma Linked devices
// {35F6F18D-1AE5-436C-A575-AB44A127903A}
static const GUID LENOVO_Y900 =
{ 0x35f6f18d, 0x1ae5, 0x436c, { 0xa5, 0x75, 0xab, 0x44, 0xa1, 0x27, 0x90, 0x3a } };
// {47DB1FA7-6B9B-4EE6-B6F4-4071A3B2053B}
static const GUID LENOVO_Y27 =
{ 0x47db1fa7, 0x6b9b, 0x4ee6, { 0xb6, 0xf4, 0x40, 0x71, 0xa3, 0xb2, 0x5, 0x3b } };
// {0201203B-62F3-4C50-83DD-598BABD208E0}
static const GUID CORE_CHROMA =
{ 0x201203b, 0x62f3, 0x4c50, { 0x83, 0xdd, 0x59, 0x8b, 0xab, 0xd2, 0x8, 0xe0 } };
// {BB2E9C9B-B0D2-461A-BA52-230B5D6C3609}
static const GUID CHROMABOX =
{ 0xbb2e9c9b, 0xb0d2, 0x461a,{ 0xba, 0x52, 0x23, 0xb, 0x5d, 0x6c, 0x36, 0x9 } };
// Speakers
//! Razer Nommo
// {45B308F2-CD44-4594-8375-4D5945AD880E}
static const GUID NOMMO_CHROMA =
{ 0x45b308f2, 0xcd44, 0x4594,{ 0x83, 0x75, 0x4d, 0x59, 0x45, 0xad, 0x88, 0xe } };
//! Razer Nommo Pro
// {3017280B-D7F9-4D7B-930E-7B47181B46B5}
static const GUID NOMMO_CHROMA_PRO =
{ 0x3017280b, 0xd7f9, 0x4d7b,{ 0x93, 0xe, 0x7b, 0x47, 0x18, 0x1b, 0x46, 0xb5 } };
}
#endif

View file

@ -0,0 +1,832 @@
//! \file RzChromaSDKTypes.h
//! \brief Data types.
#ifndef _RZCHROMASDKTYPES_H_
#define _RZCHROMASDKTYPES_H_
#pragma once
typedef LONG RZRESULT; //!< Return result.
typedef GUID RZEFFECTID; //!< Effect Id.
typedef GUID RZDEVICEID; //!< Device Id.
typedef unsigned int RZDURATION; //!< Milliseconds.
typedef size_t RZSIZE; //!< Size.
typedef void* PRZPARAM; //!< Context sensitive pointer.
typedef DWORD RZID; //!< Generic data type for Identifier.
typedef DWORD RZCOLOR; //!< Color data. 1st byte = Red; 2nd byte = Green; 3rd byte = Blue; 4th byte = Alpha (if applicable)
namespace ChromaSDK
{
//! Event notification Window message
const UINT WM_CHROMA_EVENT = WM_APP+0x2000;
//! Application information.
typedef struct APPINFOTYPE
{
TCHAR Title[256]; //!< Title of the application.
TCHAR Description[1024]; //!< A short description of the application.
//! Author information
struct Author
{
TCHAR Name[256]; //!< Name of the developer/company.
TCHAR Contact[256]; //!< Contact info.
} Author;
DWORD SupportedDevice;
DWORD Category; //!< 0 = Utility; 1 = Game; 2 = Chroma Link Broadcast
} APPINFOTYPE;
//! Chroma generic effects. Note: Not all devices supported the listed effects.
typedef enum EFFECT_TYPE
{
CHROMA_NONE = 0, //!< No effect.
CHROMA_WAVE, //!< Wave effect (Deprecated and should not be used).
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used).
CHROMA_BLINKING, //!< Blinking effect (Deprecated and should not be used).
CHROMA_REACTIVE, //!< Reactive effect (Deprecated and should not be used).
CHROMA_STATIC, //!< Static single color effect.
CHROMA_CUSTOM, //!< Custom effect. For mice, please see Mouse::CHROMA_CUSTOM2.
CHROMA_RESERVED, //!< Reserved
CHROMA_INVALID //!< Invalid effect.
} EFFECT_TYPE;
//! Device info.
typedef struct DEVICE_INFO_TYPE
{
//! Device types.
enum DeviceType
{
DEVICE_KEYBOARD = 1, //!< Keyboard device.
DEVICE_MOUSE = 2, //!< Mouse device.
DEVICE_HEADSET = 3, //!< Headset device.
DEVICE_MOUSEPAD = 4, //!< Mousepad device.
DEVICE_KEYPAD = 5, //!< Keypad device.
DEVICE_SYSTEM = 6, //!< System device.
DEVICE_SPEAKERS = 7, //!< Speakers.
DEVICE_INVALID //!< Invalid device.
} DeviceType;
DWORD Connected; //!< Number of devices connected.
} DEVICE_INFO_TYPE;
const RZSIZE MAX_ROW = 30; //!< Maximum rows for custom effects.
const RZSIZE MAX_COLUMN = 30; //!< Maximum columns for custom effects.
//! Blinking effect (Deprecated and should not be used).
typedef struct BLINKING_EFFECT_TYPE
{
RZSIZE Size; //!< Size of the structure. Size = sizeof(BLINKING_EFFECT_TYPE)
DWORD Param; //!< Extra parameters.
COLORREF Color; //!< Blinking color
} BLINKING_EFFECT_TYPE;
//! Breathing effect (Deprecated and should not be used).
typedef struct BREATHING_EFFECT_TYPE
{
RZSIZE Size; //!< Size of ths structure. Size = sizeof(BREATHING_EFFECT_TYPE)
DWORD Param; //!< Extra parameters.
//! Breathing effect types.
enum _Type
{
ONE_COLOR = 1, //!< 1 color (Only fill Color1).
TWO_COLORS, //!< 2 colors.
RANDOM_COLORS //!< Random colors
} Type;
COLORREF Color1; //!< First color.
COLORREF Color2; //!< Second color.
} BREATHING_EFFECT_TYPE;
//! Custom effect (Deprecated and should not be used).
typedef struct CUSTOM_EFFECT_TYPE
{
RZSIZE Size; //!< Size of the structure. Size = sizeof(CUSTOM_EFFECT_TYPE)
DWORD Param; //!< Extra parameters.
RZCOLOR Color[MAX_ROW][MAX_COLUMN];
} CUSTOM_EFFECT_TYPE;
//! No effect.
typedef struct NO_EFFECT_TYPE
{
RZSIZE Size; //!< Size of the structure. Size = sizeof(NO_EFFECT_TYPE)
DWORD Param; //!< Extra parameters.
} NO_EFFECT_TYPE;
//! Reactive effect (Deprecated and should not be used).
typedef struct REACTIVE_EFFECT_TYPE
{
RZSIZE Size; //!< Size of the structure. Size = sizeof(REACTIVE_EFFECT_TYPE)
DWORD Param; //!< Extra parameters.
//! Duration of the effect.
enum _Duration
{
DURATION_SHORT = 1, //!< Short duration.
DURATION_MEDIUM, //!< Medium duration.
DURATION_LONG //!< Long duration.
} Duration; //!< The time taken for the effect to fade away.
COLORREF Color; //!< Color of the effect.
} REACTIVE_EFFECT_TYPE;
//! Spectrum cycling effect (Deprecated and should not be used).
typedef struct SPECTRUMCYCLING_EFFECT_TYPE
{
RZSIZE Size; //!< Size of the structure. Size = sizeof(SPECTRUMCYCLING_EFFECT_TYPE)
DWORD Param; //!< Extra parameters.
} SPECTRUMCYCLING_EFFECT_TYPE;
//! Starlight effect (Deprecated and should not be used).
typedef struct STARLIGHT_EFFECT_TYPE
{
RZSIZE Size; //!< Size of the structure. Size = sizeof(SPECTRUMCYCLING_EFFECT_TYPE)
DWORD Param; //!< Extra parameters.
//! Starlight effect types.
enum _Type
{
TWO_COLORS = 1, //!< 2 colors.
RANDOM_COLORS //!< Random colors
} Type;
COLORREF Color1; //!< First color.
COLORREF Color2; //!< Second color.
//! Duration of the effect.
enum _Duration
{
DURATION_SHORT = 1, //!< Short duration.
DURATION_MEDIUM, //!< Medium duration.
DURATION_LONG //!< Long duration.
} Duration; //!< The time taken for the effect to fade away.
} STARLIGHT_EFFECT_TYPE;
//! Static effect (Deprecated and should not be used).
typedef struct STATIC_EFFECT_TYPE
{
RZSIZE Size; //!< Size of the structure. Size = sizeof(STATIC_EFFECT_TYPE)
DWORD Param; //!< Extra parameters.
COLORREF Color; //!< Color of the effect.
} STATIC_EFFECT_TYPE;
//! Wave effect (Deprecated and should not be used).
typedef struct WAVE_EFFECT_TYPE
{
RZSIZE Size; //!< Size of the structure. Size = sizeof(WAVE_EFFECT_TYPE)
DWORD Param; //!< Extra parameters.
//! Direction of effect.
enum _Direction
{
DIRECTION_LEFT_TO_RIGHT = 1, //!< Left to right.
DIRECTION_RIGHT_TO_LEFT, //!< Right to left.
DIRECTION_FRONT_TO_BACK, //!< Front to back
DIRECTION_BACK_TO_FRONT //!< Back top front
} Direction;
} WAVE_EFFECT_TYPE;
//! Keyboards
namespace Keyboard
{
//! Definitions of keys.
typedef enum RZKEY
{
RZKEY_ESC = 0x0001, /*!< Esc (VK_ESCAPE) */
RZKEY_F1 = 0x0003, /*!< F1 (VK_F1) */
RZKEY_F2 = 0x0004, /*!< F2 (VK_F2) */
RZKEY_F3 = 0x0005, /*!< F3 (VK_F3) */
RZKEY_F4 = 0x0006, /*!< F4 (VK_F4) */
RZKEY_F5 = 0x0007, /*!< F5 (VK_F5) */
RZKEY_F6 = 0x0008, /*!< F6 (VK_F6) */
RZKEY_F7 = 0x0009, /*!< F7 (VK_F7) */
RZKEY_F8 = 0x000A, /*!< F8 (VK_F8) */
RZKEY_F9 = 0x000B, /*!< F9 (VK_F9) */
RZKEY_F10 = 0x000C, /*!< F10 (VK_F10) */
RZKEY_F11 = 0x000D, /*!< F11 (VK_F11) */
RZKEY_F12 = 0x000E, /*!< F12 (VK_F12) */
RZKEY_1 = 0x0102, /*!< 1 (VK_1) */
RZKEY_2 = 0x0103, /*!< 2 (VK_2) */
RZKEY_3 = 0x0104, /*!< 3 (VK_3) */
RZKEY_4 = 0x0105, /*!< 4 (VK_4) */
RZKEY_5 = 0x0106, /*!< 5 (VK_5) */
RZKEY_6 = 0x0107, /*!< 6 (VK_6) */
RZKEY_7 = 0x0108, /*!< 7 (VK_7) */
RZKEY_8 = 0x0109, /*!< 8 (VK_8) */
RZKEY_9 = 0x010A, /*!< 9 (VK_9) */
RZKEY_0 = 0x010B, /*!< 0 (VK_0) */
RZKEY_A = 0x0302, /*!< A (VK_A) */
RZKEY_B = 0x0407, /*!< B (VK_B) */
RZKEY_C = 0x0405, /*!< C (VK_C) */
RZKEY_D = 0x0304, /*!< D (VK_D) */
RZKEY_E = 0x0204, /*!< E (VK_E) */
RZKEY_F = 0x0305, /*!< F (VK_F) */
RZKEY_G = 0x0306, /*!< G (VK_G) */
RZKEY_H = 0x0307, /*!< H (VK_H) */
RZKEY_I = 0x0209, /*!< I (VK_I) */
RZKEY_J = 0x0308, /*!< J (VK_J) */
RZKEY_K = 0x0309, /*!< K (VK_K) */
RZKEY_L = 0x030A, /*!< L (VK_L) */
RZKEY_M = 0x0409, /*!< M (VK_M) */
RZKEY_N = 0x0408, /*!< N (VK_N) */
RZKEY_O = 0x020A, /*!< O (VK_O) */
RZKEY_P = 0x020B, /*!< P (VK_P) */
RZKEY_Q = 0x0202, /*!< Q (VK_Q) */
RZKEY_R = 0x0205, /*!< R (VK_R) */
RZKEY_S = 0x0303, /*!< S (VK_S) */
RZKEY_T = 0x0206, /*!< T (VK_T) */
RZKEY_U = 0x0208, /*!< U (VK_U) */
RZKEY_V = 0x0406, /*!< V (VK_V) */
RZKEY_W = 0x0203, /*!< W (VK_W) */
RZKEY_X = 0x0404, /*!< X (VK_X) */
RZKEY_Y = 0x0207, /*!< Y (VK_Y) */
RZKEY_Z = 0x0403, /*!< Z (VK_Z) */
RZKEY_NUMLOCK = 0x0112, /*!< Numlock (VK_NUMLOCK) */
RZKEY_NUMPAD0 = 0x0513, /*!< Numpad 0 (VK_NUMPAD0) */
RZKEY_NUMPAD1 = 0x0412, /*!< Numpad 1 (VK_NUMPAD1) */
RZKEY_NUMPAD2 = 0x0413, /*!< Numpad 2 (VK_NUMPAD2) */
RZKEY_NUMPAD3 = 0x0414, /*!< Numpad 3 (VK_NUMPAD3) */
RZKEY_NUMPAD4 = 0x0312, /*!< Numpad 4 (VK_NUMPAD4) */
RZKEY_NUMPAD5 = 0x0313, /*!< Numpad 5 (VK_NUMPAD5) */
RZKEY_NUMPAD6 = 0x0314, /*!< Numpad 6 (VK_NUMPAD6) */
RZKEY_NUMPAD7 = 0x0212, /*!< Numpad 7 (VK_NUMPAD7) */
RZKEY_NUMPAD8 = 0x0213, /*!< Numpad 8 (VK_NUMPAD8) */
RZKEY_NUMPAD9 = 0x0214, /*!< Numpad 9 (VK_ NUMPAD9*/
RZKEY_NUMPAD_DIVIDE = 0x0113, /*!< Divide (VK_DIVIDE) */
RZKEY_NUMPAD_MULTIPLY = 0x0114, /*!< Multiply (VK_MULTIPLY) */
RZKEY_NUMPAD_SUBTRACT = 0x0115, /*!< Subtract (VK_SUBTRACT) */
RZKEY_NUMPAD_ADD = 0x0215, /*!< Add (VK_ADD) */
RZKEY_NUMPAD_ENTER = 0x0415, /*!< Enter (VK_RETURN - Extended) */
RZKEY_NUMPAD_DECIMAL = 0x0514, /*!< Decimal (VK_DECIMAL) */
RZKEY_PRINTSCREEN = 0x000F, /*!< Print Screen (VK_PRINT) */
RZKEY_SCROLL = 0x0010, /*!< Scroll Lock (VK_SCROLL) */
RZKEY_PAUSE = 0x0011, /*!< Pause (VK_PAUSE) */
RZKEY_INSERT = 0x010F, /*!< Insert (VK_INSERT) */
RZKEY_HOME = 0x0110, /*!< Home (VK_HOME) */
RZKEY_PAGEUP = 0x0111, /*!< Page Up (VK_PRIOR) */
RZKEY_DELETE = 0x020f, /*!< Delete (VK_DELETE) */
RZKEY_END = 0x0210, /*!< End (VK_END) */
RZKEY_PAGEDOWN = 0x0211, /*!< Page Down (VK_NEXT) */
RZKEY_UP = 0x0410, /*!< Up (VK_UP) */
RZKEY_LEFT = 0x050F, /*!< Left (VK_LEFT) */
RZKEY_DOWN = 0x0510, /*!< Down (VK_DOWN) */
RZKEY_RIGHT = 0x0511, /*!< Right (VK_RIGHT) */
RZKEY_TAB = 0x0201, /*!< Tab (VK_TAB) */
RZKEY_CAPSLOCK = 0x0301, /*!< Caps Lock(VK_CAPITAL) */
RZKEY_BACKSPACE = 0x010E, /*!< Backspace (VK_BACK) */
RZKEY_ENTER = 0x030E, /*!< Enter (VK_RETURN) */
RZKEY_LCTRL = 0x0501, /*!< Left Control(VK_LCONTROL) */
RZKEY_LWIN = 0x0502, /*!< Left Window (VK_LWIN) */
RZKEY_LALT = 0x0503, /*!< Left Alt (VK_LMENU) */
RZKEY_SPACE = 0x0507, /*!< Spacebar (VK_SPACE) */
RZKEY_RALT = 0x050B, /*!< Right Alt (VK_RMENU) */
RZKEY_FN = 0x050C, /*!< Function key. */
RZKEY_RMENU = 0x050D, /*!< Right Menu (VK_APPS) */
RZKEY_RCTRL = 0x050E, /*!< Right Control (VK_RCONTROL) */
RZKEY_LSHIFT = 0x0401, /*!< Left Shift (VK_LSHIFT) */
RZKEY_RSHIFT = 0x040E, /*!< Right Shift (VK_RSHIFT) */
RZKEY_MACRO1 = 0x0100, /*!< Macro Key 1 */
RZKEY_MACRO2 = 0x0200, /*!< Macro Key 2 */
RZKEY_MACRO3 = 0x0300, /*!< Macro Key 3 */
RZKEY_MACRO4 = 0x0400, /*!< Macro Key 4 */
RZKEY_MACRO5 = 0x0500, /*!< Macro Key 5 */
RZKEY_OEM_1 = 0x0101, /*!< ~ (tilde/半角/全角) (VK_OEM_3) */
RZKEY_OEM_2 = 0x010C, /*!< -- (minus) (VK_OEM_MINUS) */
RZKEY_OEM_3 = 0x010D, /*!< = (equal) (VK_OEM_PLUS) */
RZKEY_OEM_4 = 0x020C, /*!< [ (left sqaure bracket) (VK_OEM_4) */
RZKEY_OEM_5 = 0x020D, /*!< ] (right square bracket) (VK_OEM_6) */
RZKEY_OEM_6 = 0x020E, /*!< \ (backslash) (VK_OEM_5) */
RZKEY_OEM_7 = 0x030B, /*!< ; (semi-colon) (VK_OEM_1) */
RZKEY_OEM_8 = 0x030C, /*!< ' (apostrophe) (VK_OEM_7) */
RZKEY_OEM_9 = 0x040A, /*!< , (comma) (VK_OEM_COMMA) */
RZKEY_OEM_10 = 0x040B, /*!< . (period) (VK_OEM_PERIOD) */
RZKEY_OEM_11 = 0x040C, /*!< / (forward slash) (VK_OEM_2) */
RZKEY_EUR_1 = 0x030D, /*!< "#" (VK_OEM_5) */
RZKEY_EUR_2 = 0x0402, /*!< \ (VK_OEM_102) */
RZKEY_JPN_1 = 0x0015, /*!< ¥ (0xFF) */
RZKEY_JPN_2 = 0x040D, /*!< \ (0xC1) */
RZKEY_JPN_3 = 0x0504, /*!< 無変換 (VK_OEM_PA1) */
RZKEY_JPN_4 = 0x0509, /*!< 変換 (0xFF) */
RZKEY_JPN_5 = 0x050A, /*!< ひらがな/カタカナ (0xFF) */
RZKEY_KOR_1 = 0x0015, /*!< | (0xFF) */
RZKEY_KOR_2 = 0x030D, /*!< (VK_OEM_5) */
RZKEY_KOR_3 = 0x0402, /*!< (VK_OEM_102) */
RZKEY_KOR_4 = 0x040D, /*!< (0xC1) */
RZKEY_KOR_5 = 0x0504, /*!< (VK_OEM_PA1) */
RZKEY_KOR_6 = 0x0509, /*!< 한/영 (0xFF) */
RZKEY_KOR_7 = 0x050A, /*!< (0xFF) */
RZKEY_INVALID = 0xFFFF /*!< Invalid keys. */
} RZKEY;
//! Definition of LEDs.
typedef enum RZLED
{
RZLED_LOGO = 0x0014 /*!< Razer logo */
} RZLED;
//! Maximum number of rows in a keyboard.
const RZSIZE MAX_ROW = 6;
//! Maximum number of columns in a keyboard.
const RZSIZE MAX_COLUMN = 22;
//! Maximum number of keys.
const RZSIZE MAX_KEYS = MAX_ROW * MAX_COLUMN;
//! Maximum number of custom effects.
const RZSIZE MAX_CUSTOM_EFFECTS = MAX_KEYS;
//! Keyboard LED layout.
const COLORREF RZKEY_LAYOUT[MAX_ROW][MAX_COLUMN] = {};
//! Chroma keyboard effect types
typedef enum EFFECT_TYPE
{
CHROMA_NONE = 0, //!< No effect.
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used.).
CHROMA_CUSTOM, //!< Custom effect.
CHROMA_REACTIVE, //!< Reactive effect (Deprecated and should not be used).
CHROMA_STATIC, //!< Static single color effect.
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
CHROMA_WAVE, //!< Wave effect (Deprecated and should not be used).
CHROMA_RESERVED, //!< Reserved.
CHROMA_CUSTOM_KEY, //!< Custom effects with keys.
CHROMA_INVALID //!< Invalid effect.
} EFFECT_TYPE;
// Chroma keyboard effects
//! Breathing effect type (Deprecated and should not be used).
typedef struct BREATHING_EFFECT_TYPE
{
//! Breathing effects.
enum Type
{
TWO_COLORS = 1, //!< 2 colors
RANDOM_COLORS, //!< Random colors
INVALID //!< Invalid type
} Type;
COLORREF Color1; //!< First color.
COLORREF Color2; //!< Second color.
} BREATHING_EFFECT_TYPE;
//! Custom effect using a matrix type.
typedef struct CUSTOM_EFFECT_TYPE
{
COLORREF Color[MAX_ROW][MAX_COLUMN]; //!< Grid layout. 6 rows by 22 columns.
} CUSTOM_EFFECT_TYPE;
//! Custom effect with keys.
typedef struct CUSTOM_KEY_EFFECT_TYPE
{
COLORREF Color[MAX_ROW][MAX_COLUMN]; //!< Grid layout. 6 rows by 22 columns.
COLORREF Key[MAX_ROW][MAX_COLUMN]; //!< Keys information. 6 rows by 22 columns. To indidate there is a key effect, OR with 0x01000000. i.e. Key[0][1] = 0x01000000 | Color;
} CUSTOM_KEY_EFFECT_TYPE;
//! Reactive effect type (Deprecated and should not be used).
typedef struct REACTIVE_EFFECT_TYPE
{
//! Duration of the effect.
enum Duration
{
DURATION_NONE=0, //!< No duration.
DURATION_SHORT, //!< Short duration.
DURATION_MEDIUM, //!< Medium duration.
DURATION_LONG, //!< Long duration.
DURATION_INVALID //!< Invalid duration.
} Duration; //!< The time taken for the effect to fade away.
COLORREF Color; //!< Color of the effect
} REACTIVE_EFFECT_TYPE;
//! Starlight effect (Deprecated and should not be used).
typedef struct STARLIGHT_EFFECT_TYPE
{
//! Starlight effect types.
enum _Type
{
TWO_COLORS = 1, //!< 2 colors.
RANDOM_COLORS //!< Random colors
} Type;
COLORREF Color1; //!< First color.
COLORREF Color2; //!< Second color.
//! Duration of the effect.
enum _Duration
{
DURATION_SHORT = 1, //!< Short duration.
DURATION_MEDIUM, //!< Medium duration.
DURATION_LONG //!< Long duration.
} Duration; //!< The time taken for the effect to fade away.
} STARLIGHT_EFFECT_TYPE;
//! Static effect type
typedef struct STATIC_EFFECT_TYPE
{
COLORREF Color; //!< Color of the effect
} STATIC_EFFECT_TYPE;
//! Wave effect type (Deprecated and should not be used).
typedef struct WAVE_EFFECT_TYPE
{
//! Direction of the wave effect.
enum Direction
{
DIRECTION_NONE=0, //!< No direction.
DIRECTION_LEFT_TO_RIGHT, //!< Left to right.
DIRECTION_RIGHT_TO_LEFT, //!< Right to left.
DIRECTION_INVALID //!< Invalid direction.
} Direction; //!< Direction of the wave.
} WAVE_EFFECT_TYPE;
}
//! Mice
namespace Mouse
{
//! Maximum number of custom LEDs (old definition to maintain backward compatibility).
const RZSIZE MAX_LEDS = 30;
//! Mice LED layout (old definition to maintain backward compatibility).
const RZCOLOR RZLED_LAYOUT[MAX_LEDS] = {};
//! Maximum number of rows of the virtual grid.
const RZSIZE MAX_ROW = 9;
//! Maximum number of columns of the virtual grid.
const RZSIZE MAX_COLUMN = 7;
//! Maximum number of LEDs of the virtual grid.
const RZSIZE MAX_LEDS2 = MAX_ROW * MAX_COLUMN;
//! Mice LED virtual grid layout.
const RZCOLOR RZLED_LAYOUT2[MAX_ROW][MAX_COLUMN] = {};
//! Mouse LED Id defintion (Deprecated and should not be used).
typedef enum RZLED
{
RZLED_NONE = 0, //!< No LED.
RZLED_SCROLLWHEEL = 1, //!< Scroll Wheel LED.
RZLED_LOGO = 2, //!< Logo LED.
RZLED_BACKLIGHT = 3, //!< Backlight or numpad.
RZLED_SIDE_STRIP1 = 4, //!< Side strip LED 1. (For Mamba TE, starts from top left hand)
RZLED_SIDE_STRIP2 = 5, //!< Side strip LED 2. (For Mamba TE)
RZLED_SIDE_STRIP3 = 6, //!< Side strip LED 3. (For Mamba TE)
RZLED_SIDE_STRIP4 = 7, //!< Side strip LED 4. (For Mamba TE)
RZLED_SIDE_STRIP5 = 8, //!< Side strip LED 5. (For Mamba TE)
RZLED_SIDE_STRIP6 = 9, //!< Side strip LED 6. (For Mamba TE)
RZLED_SIDE_STRIP7 = 10, //!< Side strip LED 7. (For Mamba TE)
RZLED_SIDE_STRIP8 = 11, //!< Side strip LED 8. (For Mamba TE)
RZLED_SIDE_STRIP9 = 12, //!< Side strip LED 9. (For Mamba TE)
RZLED_SIDE_STRIP10 = 13, //!< Side strip LED 10. (For Mamba TE)
RZLED_SIDE_STRIP11 = 14, //!< Side strip LED 11. (For Mamba TE)
RZLED_SIDE_STRIP12 = 15, //!< Side strip LED 12. (For Mamba TE)
RZLED_SIDE_STRIP13 = 16, //!< Side strip LED 13. (For Mamba TE)
RZLED_SIDE_STRIP14 = 17, //!< Side strip LED 14. (For Mamba TE)
RZLED_ALL = 0xFFFF
} RZLED;
//! Mouse LED Id defintion for the virtual grid.
typedef enum RZLED2
{
RZLED2_SCROLLWHEEL = 0x0203, //!< Scroll Wheel LED.
RZLED2_LOGO = 0x0703, //!< Logo LED.
RZLED2_BACKLIGHT = 0x0403, //!< Backlight LED.
RZLED2_LEFT_SIDE1 = 0x0100, //!< Left LED 1.
RZLED2_LEFT_SIDE2 = 0x0200, //!< Left LED 2.
RZLED2_LEFT_SIDE3 = 0x0300, //!< Left LED 3.
RZLED2_LEFT_SIDE4 = 0x0400, //!< Left LED 4.
RZLED2_LEFT_SIDE5 = 0x0500, //!< Left LED 5.
RZLED2_LEFT_SIDE6 = 0x0600, //!< Left LED 6.
RZLED2_LEFT_SIDE7 = 0x0700, //!< Left LED 7.
RZLED2_BOTTOM1 = 0x0801, //!< Bottom LED 1.
RZLED2_BOTTOM2 = 0x0802, //!< Bottom LED 2.
RZLED2_BOTTOM3 = 0x0803, //!< Bottom LED 3.
RZLED2_BOTTOM4 = 0x0804, //!< Bottom LED 4.
RZLED2_BOTTOM5 = 0x0805, //!< Bottom LED 5.
RZLED2_RIGHT_SIDE1 = 0x0106, //!< Right LED 1.
RZLED2_RIGHT_SIDE2 = 0x0206, //!< Right LED 2.
RZLED2_RIGHT_SIDE3 = 0x0306, //!< Right LED 3.
RZLED2_RIGHT_SIDE4 = 0x0406, //!< Right LED 4.
RZLED2_RIGHT_SIDE5 = 0x0506, //!< Right LED 5.
RZLED2_RIGHT_SIDE6 = 0x0606, //!< Right LED 6.
RZLED2_RIGHT_SIDE7 = 0x0706 //!< Right LED 7.
} RZLED2;
//! Chroma mouse effect types
typedef enum EFFECT_TYPE
{
CHROMA_NONE = 0, //!< No effect.
CHROMA_BLINKING, //!< Blinking effect (Deprecated and should not be used).
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used).
CHROMA_CUSTOM, //!< Custom effect (Deprecated and should not be used).
CHROMA_REACTIVE, //!< Reactive effect (Deprecated and should not be used).
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
CHROMA_STATIC, //!< Static single color effect.
CHROMA_WAVE, //!< Wave effect (Deprecated and should not be used).
CHROMA_CUSTOM2, //!< Custom effects using a virtual grid.
CHROMA_INVALID //!< Invalid effect.
} EFFECT_TYPE;
//! Static effect type
typedef struct STATIC_EFFECT_TYPE
{
RZLED LEDId; //!< LED Id
COLORREF Color; //!< Color of the effect.
} STATIC_EFFECT_TYPE;
//! Blinking effect type (Deprecated and should not be used).
typedef struct BLINKING_EFFECT_TYPE
{
RZLED LEDId; //!< LED Id
COLORREF Color; //!< Color.
} BLINKING_EFFECT_TYPE;
//! Breathing effect (Deprecated and should not be used).
typedef struct BREATHING_EFFECT_TYPE
{
RZLED LEDId; //!< LED Id
//! Breathing type.
enum Type
{
ONE_COLOR = 1, //!< 1 color (Only fill Color1).
TWO_COLORS, //!< 2 colors.
RANDOM_COLORS, //!< Random colors
INVALID //!< Invalid type
} Type;
COLORREF Color1; //!< First color.
COLORREF Color2; //!< Second color.
} BREATHING_EFFECT_TYPE;
//! Custom effect (Deprecated and should not be used).
typedef struct CUSTOM_EFFECT_TYPE
{
RZCOLOR Color[MAX_LEDS]; //!< Array of colors.
} CUSTOM_EFFECT_TYPE;
//! Custom effect using virtual grid.
//! Indexes of the LED are defined in RZLED2.i.e. Row = HIBYTE(RZLED2_SCROLLWHEEL), Column = LOBYTE(RZLED2_SCROLLWHEEL)
typedef struct CUSTOM_EFFECT_TYPE2
{
RZCOLOR Color[MAX_ROW][MAX_COLUMN]; //!< Array of colors.
} CUSTOM_EFFECT_TYPE2;
//! Reactive effect (Deprecated and should not be used).
typedef struct REACTIVE_EFFECT_TYPE
{
RZLED LEDId; //!< LED Id
//! Duration of the effect.
enum Duration
{
DURATION_NONE=0, //!< No duration.
DURATION_SHORT, //!< Short duration.
DURATION_MEDIUM, //!< Medium duration.
DURATION_LONG //!< Long duration.
} Duration;
RZCOLOR Color; //!< Color of the effect.
} REACTIVE_EFFECT_TYPE;
//! No effect (Deprecated and should not be used).
typedef struct NO_EFFECT_TYPE
{
RZLED LEDId; //!< LED Id
} NO_EFFECT_TYPE;
//! Spectrum cycling (Deprecated and should not be used).
typedef struct SPECTRUMCYCLING_EFFECT_TYPE
{
RZLED LEDId; //!< LED id.
} SPECTRUMCYCLING_EFFECT_TYPE;
//! Wave effect (Deprecated and should not be used).
typedef struct WAVE_EFFECT_TYPE
{
//! Direction of the wave effect.
enum Direction
{
FRONT_TO_BACK, //!< Front to back
BACK_TO_FRONT //!< Back to front
} Direction;
} WAVE_EFFECT_TYPE;
}
//! Headsets
namespace Headset
{
//! Maximum number of LEDs
const RZSIZE MAX_LEDS = 5;
//! Chroma headset effect types
typedef enum EFFECT_TYPE
{
CHROMA_NONE = 0, //!< No effect.
CHROMA_STATIC, //!< Static single color effect.
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used).
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
CHROMA_CUSTOM, //!< Custom effects.
CHROMA_INVALID //!< Invalid effect.
} EFFECT_TYPE;
//! Static effect type
typedef struct STATIC_EFFECT_TYPE
{
COLORREF Color; //!< Color of the effect.
} STATIC_EFFECT_TYPE;
//! Breathing effect type (Deprecated and should not be used).
typedef struct BREATHING_EFFECT_TYPE
{
COLORREF Color; //!< Color.
} BREATHING_EFFECT_TYPE;
//! Custom effect type.
typedef struct CUSTOM_EFFECT_TYPE
{
RZCOLOR Color[MAX_LEDS]; //!< Array of colors.
} CUSTOM_EFFECT_TYPE;
}
//! Mousepads
namespace Mousepad
{
//! Maximum number of LEDs
const RZSIZE MAX_LEDS = 15;
//! Chroma mousepad effect types
typedef enum EFFECT_TYPE
{
CHROMA_NONE = 0, //!< No effect.
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used).
CHROMA_CUSTOM, //!< Custom effect.
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
CHROMA_STATIC, //!< Static single color effect.
CHROMA_WAVE, //!< Wave effect (Deprecated and should not be used).
CHROMA_INVALID //!< Invalid effect.
} EFFECT_TYPE;
// Chroma mousepad effects
//! Breathing effect type (Deprecated and should not be used).
typedef struct BREATHING_EFFECT_TYPE
{
//! Breathing effects.
enum Type
{
TWO_COLORS = 1, //!< 2 colors
RANDOM_COLORS, //!< Random colors
INVALID
} Type;
COLORREF Color1; //!< First color.
COLORREF Color2; //!< Second color.
} BREATHING_EFFECT_TYPE;
//! Custom effect type.
typedef struct CUSTOM_EFFECT_TYPE
{
RZCOLOR Color[MAX_LEDS]; //!< An array of colors for all the sides of the mousepad. First LED starts from top-right corner.
//!< LED 0-4 right side, 5-9 bottom side, 10-14 left side.
} CUSTOM_EFFECT_TYPE;
//! Static effect type
typedef struct STATIC_EFFECT_TYPE
{
COLORREF Color; //!< Color of the effect
} STATIC_EFFECT_TYPE;
//! Wave effect type
typedef struct WAVE_EFFECT_TYPE
{
//! Direction of the wave effect.
enum Direction
{
DIRECTION_NONE=0, //!< No direction.
DIRECTION_LEFT_TO_RIGHT, //!< Left to right.
DIRECTION_RIGHT_TO_LEFT, //!< Right to left.
DIRECTION_INVALID //!< Invalid direction.
} Direction; //!< Direction of the wave.
} WAVE_EFFECT_TYPE;
}
//! Keypads
namespace Keypad
{
//! Maximum number of rows.
const RZSIZE MAX_ROW = 4;
//! Maximum number of columns.
const RZSIZE MAX_COLUMN = 5;
//! Total number of keys.
const RZSIZE MAX_KEYS = MAX_ROW * MAX_COLUMN;
//! Chroma keypad effect types
typedef enum EFFECT_TYPE
{
CHROMA_NONE = 0, //!< No effect.
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used).
CHROMA_CUSTOM, //!< Custom effect.
CHROMA_REACTIVE, //!< Reactive effect (Deprecated and should not be used).
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
CHROMA_STATIC, //!< Static single color effect.
CHROMA_WAVE, //!< Wave effect (Deprecated and should not be used).
CHROMA_INVALID //!< Invalid effect.
} EFFECT_TYPE;
// Chroma keypad effects
//! Breathing effect type (Deprecated and should not be used).
typedef struct BREATHING_EFFECT_TYPE
{
//! Breathing effects.
enum Type
{
TWO_COLORS = 1, //!< 2 colors
RANDOM_COLORS, //!< Random colors
INVALID //!< Invalid type
} Type;
COLORREF Color1; //!< First color.
COLORREF Color2; //!< Second color.
} BREATHING_EFFECT_TYPE;
//! Custom effect type
typedef struct CUSTOM_EFFECT_TYPE
{
RZCOLOR Color[MAX_ROW][MAX_COLUMN]; //!< Custom effect.
//!< For Razer Tartarus Chroma only Color[0] is valid. Use index '0' to change the keypad color.
} CUSTOM_EFFECT_TYPE;
//! Reactive effect type (Deprecated and should not be used).
typedef struct REACTIVE_EFFECT_TYPE
{
//! Duration of the effect.
enum Duration
{
DURATION_NONE=0, //!< No duration.
DURATION_SHORT, //!< Short duration.
DURATION_MEDIUM, //!< Medium duration.
DURATION_LONG, //!< Long duration.
DURATION_INVALID //!< Invalid duration.
} Duration; //!< The time taken for the effect to fade away.
COLORREF Color; //!< Color of the effect
} REACTIVE_EFFECT_TYPE;
//! Static effect type
typedef struct STATIC_EFFECT_TYPE
{
RZCOLOR Color; //!< Color of the effect.
} STATIC_EFFECT_TYPE;
//! Wave effect type (Deprecated and should not be used).
typedef struct WAVE_EFFECT_TYPE
{
//! Direction of the wave effect.
enum Direction
{
DIRECTION_NONE=0, //!< No direction.
DIRECTION_LEFT_TO_RIGHT, //!< Left to right.
DIRECTION_RIGHT_TO_LEFT, //!< Right to left.
DIRECTION_INVALID //!< Invalid direction.
} Direction; //!< Direction of the wave.
} WAVE_EFFECT_TYPE;
}
//! Chroma Link
namespace ChromaLink
{
//! Maximum number of elements/LEDs
const RZSIZE MAX_LEDS = 5;
//! Chroma Link effect types
typedef enum EFFECT_TYPE
{
CHROMA_NONE = 0, //!< No effect.
CHROMA_CUSTOM, //!< Custom effect.
CHROMA_STATIC, //!< Static single color effect.
CHROMA_INVALID //!< Invalid effect.
} EFFECT_TYPE;
//! Custom effect type.\n
//! Use Custom type to create a sequence of animated effects.\n
//! [ChromaLinkL#1|ChromaLinkL#2|ChromaLinkL#3|ChromaLinkL#4|ChromaLinkL#5].\n
typedef struct CUSTOM_EFFECT_TYPE
{
RZCOLOR Color[MAX_LEDS]; //!< Array of colors.
} CUSTOM_EFFECT_TYPE;
//! Static effect type.\n
//! Use Static type to create effects for all LEDs (ChromaLinkL#1).
typedef struct STATIC_EFFECT_TYPE
{
RZCOLOR Color; //!< Color of the effect.
} STATIC_EFFECT_TYPE;
}
}
#endif

View file

@ -0,0 +1,46 @@
//! \file RzErrors.h
//! \brief Error codes for Chroma SDK. If the error is not defined here, refer to WinError.h from the Windows SDK.
#ifndef _RZERRORS_H_
#define _RZERRORS_H_
#pragma once
// Error codes
//! Invalid
#define RZRESULT_INVALID -1L
//! Success
#define RZRESULT_SUCCESS 0L
//! Access denied
#define RZRESULT_ACCESS_DENIED 5L
//! Invalid handle
#define RZRESULT_INVALID_HANDLE 6L
//! Not supported
#define RZRESULT_NOT_SUPPORTED 50L
//! Invalid parameter.
#define RZRESULT_INVALID_PARAMETER 87L
//! The service has not been started
#define RZRESULT_SERVICE_NOT_ACTIVE 1062L
//! Cannot start more than one instance of the specified program.
#define RZRESULT_SINGLE_INSTANCE_APP 1152L
//! Device not connected
#define RZRESULT_DEVICE_NOT_CONNECTED 1167L
//! Element not found.
#define RZRESULT_NOT_FOUND 1168L
//! Request aborted.
#define RZRESULT_REQUEST_ABORTED 1235L
//! An attempt was made to perform an initialization operation when initialization has already been completed.
#define RZRESULT_ALREADY_INITIALIZED 1247L
//! Resource not available or disabled
#define RZRESULT_RESOURCE_DISABLED 4309L
//! Device not available or supported
#define RZRESULT_DEVICE_NOT_AVAILABLE 4319L
//! The group or resource is not in the correct state to perform the requested operation.
#define RZRESULT_NOT_VALID_STATE 5023L
//! No more items
#define RZRESULT_NO_MORE_ITEMS 259L
//! General failure.
#define RZRESULT_FAILED 2147500037L
#endif