-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexandre Colucci
committed
Jan 8, 2019
0 parents
commit 6d543a3
Showing
4,702 changed files
with
565,034 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License | ||
|
||
Copyright 2018 Corsair Memory, Inc | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
`CPU` is a sample plugin demonstrating the [Stream Deck SDK](https://developer.elgato.com/documentation/stream-deck/). | ||
|
||
|
||
# Description | ||
|
||
`CPU` is a plugin that displays the CPU usage on a key. | ||
|
||
Features: | ||
|
||
- code written in C++ | ||
- cross-platform (macOS, Windows) | ||
- localized | ||
|
||
|
||
# Installation | ||
|
||
In the Release folder, you can find the file `com.elgato.cpu.streamDeckPlugin`. If you double-click this file on your machine, Stream Deck will install the plugin. | ||
|
||
|
||
# Source code | ||
|
||
The Sources folder contains the source code of the plugin. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
//============================================================================== | ||
/** | ||
@file EPLJSONUtils.h | ||
@brief Utility methods for JSON parser from N.Lohmann | ||
https://github.com/nlohmann/json | ||
@copyright (c) 2018, Corsair Memory, Inc. | ||
This source code is licensed under the MIT-style license found in the LICENSE file. | ||
**/ | ||
//============================================================================== | ||
|
||
#pragma once | ||
|
||
//------------------------------------------------------------------------------ | ||
// Includes | ||
//------------------------------------------------------------------------------ | ||
|
||
#include "../Vendor/json/src/json.hpp" | ||
using json = nlohmann::json; | ||
|
||
class EPLJSONUtils | ||
{ | ||
|
||
public: | ||
|
||
//! Get object by name | ||
static bool GetObjectByName(const json& inJSON, const std::string& inName, json& outObject) | ||
{ | ||
// Check desired value exists | ||
json::const_iterator iter(inJSON.find(inName)); | ||
if (iter == inJSON.end()) | ||
return false; | ||
|
||
// Check value is an array | ||
if (!iter->is_object()) | ||
return false; | ||
|
||
// Assign value | ||
outObject = *iter; | ||
|
||
return true; | ||
} | ||
|
||
//! Get array by name | ||
static bool GetArrayByName(const json& inJSON, const std::string& inName, json& outArray) | ||
{ | ||
// Check desired value exists | ||
json::const_iterator iter(inJSON.find(inName)); | ||
if (iter == inJSON.end()) | ||
return false; | ||
|
||
// Check value is an array | ||
if (!iter->is_array()) | ||
return false; | ||
|
||
// Assign value | ||
outArray = *iter; | ||
|
||
return true; | ||
} | ||
|
||
//! Get string by name | ||
static std::string GetStringByName(const json& inJSON, const std::string& inName, const std::string& defaultValue = "") | ||
{ | ||
// Check desired value exists | ||
json::const_iterator iter(inJSON.find(inName)); | ||
if (iter == inJSON.end()) | ||
return defaultValue; | ||
|
||
// Check value is a string | ||
if (!iter->is_string()) | ||
return defaultValue; | ||
|
||
// Return value | ||
return *iter; | ||
} | ||
|
||
//! Get string | ||
static std::string GetString(const json& j, const std::string& defaultString = "") | ||
{ | ||
// Check value is a string | ||
if (!j.is_string()) | ||
return defaultString; | ||
|
||
return j; | ||
} | ||
|
||
//! Get bool by name | ||
static bool GetBoolByName(const json& inJSON, const std::string& inName, bool defaultValue = false) | ||
{ | ||
// Check desired value exists | ||
json::const_iterator iter(inJSON.find(inName)); | ||
if (iter == inJSON.end()) | ||
return defaultValue; | ||
|
||
// Check value is a bool | ||
if (!iter->is_boolean()) | ||
return defaultValue; | ||
|
||
// Return value | ||
return *iter; | ||
} | ||
|
||
//! Get integer by name | ||
static int GetIntByName(const json& inJSON, const std::string& inName, int defaultValue = 0) | ||
{ | ||
// Check desired value exists | ||
json::const_iterator iter(inJSON.find(inName)); | ||
if (iter == inJSON.end()) | ||
return defaultValue; | ||
|
||
// Check value is an integer | ||
if (!iter->is_number_integer()) | ||
return defaultValue; | ||
|
||
// Return value | ||
return *iter; | ||
} | ||
|
||
//! Get unsigned integer by name | ||
static unsigned int GetUnsignedIntByName(const json& inJSON, const std::string& inName, unsigned int defaultValue = 0) | ||
{ | ||
// Check desired value exists | ||
json::const_iterator iter(inJSON.find(inName)); | ||
if (iter == inJSON.end()) | ||
return defaultValue; | ||
|
||
// Check value is an unsigned integer | ||
if (!iter->is_number_unsigned()) | ||
return defaultValue; | ||
|
||
// Return value | ||
return *iter; | ||
} | ||
|
||
//! Get float by name | ||
static float GetFloatByName(const json& inJSON, const std::string& inName, float defaultValue = 0.0) | ||
{ | ||
// Check desired value exists | ||
json::const_iterator iter(inJSON.find(inName)); | ||
if (iter == inJSON.end()) | ||
return defaultValue; | ||
|
||
// Check value is an integer | ||
if (!iter->is_number_float() && !iter->is_number_integer()) | ||
return defaultValue; | ||
|
||
// Return value | ||
return *iter; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//============================================================================== | ||
/** | ||
@file ESDBasePlugin.h | ||
@brief Plugin base class | ||
@copyright (c) 2018, Corsair Memory, Inc. | ||
This source code is licensed under the MIT-style license found in the LICENSE file. | ||
**/ | ||
//============================================================================== | ||
|
||
#pragma once | ||
|
||
class ESDConnectionManager; | ||
|
||
class ESDBasePlugin | ||
{ | ||
public: | ||
ESDBasePlugin() { } | ||
virtual ~ESDBasePlugin() { } | ||
|
||
void SetConnectionManager(ESDConnectionManager * inConnectionManager) { mConnectionManager = inConnectionManager; } | ||
|
||
virtual void KeyDownForAction(const std::string& inAction, const std::string& inContext, const json &inPayload, const std::string& inDeviceID) = 0; | ||
virtual void KeyUpForAction(const std::string& inAction, const std::string& inContext, const json &inPayload, const std::string& inDeviceID) = 0; | ||
|
||
virtual void WillAppearForAction(const std::string& inAction, const std::string& inContext, const json &inPayload, const std::string& inDeviceID) = 0; | ||
virtual void WillDisappearForAction(const std::string& inAction, const std::string& inContext, const json &inPayload, const std::string& inDeviceID) = 0; | ||
|
||
virtual void DeviceDidConnect(const std::string& inDeviceID, const json &inDeviceInfo) = 0; | ||
virtual void DeviceDidDisconnect(const std::string& inDeviceID) = 0; | ||
|
||
protected: | ||
ESDConnectionManager *mConnectionManager = nullptr; | ||
|
||
}; |
Oops, something went wrong.