forked from hyperion-project/hyperion.ng
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/CEC detection (hyperion-project#877)
* Add CEC functionality * Initial commit * removed libCEC from the system skip list Co-authored-by: Paulchen Panther <[email protected]>
- Loading branch information
1 parent
a3ce4fa
commit c124e21
Showing
35 changed files
with
651 additions
and
89 deletions.
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
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
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -24,7 +24,6 @@ macro(DeployUnix TARGET) | |
"libusb-1" | ||
"libutil" | ||
"libX11" | ||
"libz" | ||
) | ||
|
||
if (APPLE) | ||
|
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,19 @@ | ||
# - Try to find CEC | ||
# Once done this will define | ||
# | ||
# CEC_FOUND - system has libcec | ||
# CEC_INCLUDE_DIRS - the libcec include directory | ||
# CEC_LIBRARIES - The libcec libraries | ||
|
||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules (CEC libcec>=3.0.0) | ||
else() | ||
find_path(CEC_INCLUDE_DIRS libcec/cec.h) | ||
find_library(CEC_LIBRARIES cec) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(CEC DEFAULT_MSG CEC_INCLUDE_DIRS CEC_LIBRARIES) | ||
|
||
list(APPEND CEC_DEFINITIONS -DHAVE_LIBCEC=1) | ||
mark_as_advanced(CEC_INCLUDE_DIRS CEC_LIBRARIES CEC_DEFINITIONS) |
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
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
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 |
---|---|---|
|
@@ -406,4 +406,4 @@ private slots: | |
|
||
// current instance index | ||
quint8 _currInstanceIndex; | ||
}; | ||
}; |
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,8 @@ | ||
#pragma once | ||
|
||
enum class CECEvent | ||
{ | ||
On, | ||
Off | ||
}; | ||
|
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,69 @@ | ||
#pragma once | ||
|
||
#include <QObject> | ||
#include <QVector> | ||
|
||
#include <iostream> | ||
|
||
#include <libcec/cec.h> | ||
|
||
#include <cec/CECEvent.h> | ||
|
||
using CECCallbacks = CEC::ICECCallbacks; | ||
using CECAdapter = CEC::ICECAdapter; | ||
using CECAdapterDescriptor = CEC::cec_adapter_descriptor; | ||
using CECLogMessage = CEC::cec_log_message; | ||
using CECKeyPress = CEC::cec_keypress; | ||
using CECCommand = CEC::cec_command; | ||
using CECLogicalAddress = CEC::cec_logical_address; | ||
using CECLogicalAddresses = CEC::cec_logical_addresses; | ||
using CECMenuState = CEC::cec_menu_state; | ||
using CECPowerStatus = CEC::cec_power_status; | ||
using CECVendorId = CEC::cec_vendor_id; | ||
using CECParameter = CEC::libcec_parameter; | ||
using CECConfig = CEC::libcec_configuration; | ||
using CECAlert = CEC::libcec_alert; | ||
|
||
class Logger; | ||
|
||
class CECHandler : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
CECHandler(); | ||
~CECHandler() override; | ||
|
||
QString scan() const; | ||
|
||
public slots: | ||
bool start(); | ||
void stop(); | ||
|
||
signals: | ||
void cecEvent(CECEvent event); | ||
|
||
private: | ||
/* CEC Callbacks */ | ||
static void onCecLogMessage (void * context, const CECLogMessage * message); | ||
static void onCecKeyPress (void * context, const CECKeyPress * key); | ||
static void onCecAlert (void * context, const CECAlert alert, const CECParameter data); | ||
static void onCecConfigurationChanged (void * context, const CECConfig * configuration); | ||
static void onCecCommandReceived (void * context, const CECCommand * command); | ||
static void onCecSourceActivated (void * context, const CECLogicalAddress address, const uint8_t activated); | ||
static int onCecMenuStateChanged (void * context, const CECMenuState state); | ||
|
||
/* CEC Adapter helpers */ | ||
QVector<CECAdapterDescriptor> getAdapters() const; | ||
bool openAdapter(const CECAdapterDescriptor & descriptor); | ||
void printAdapter(const CECAdapterDescriptor & descriptor) const; | ||
|
||
/* CEC Helpers */ | ||
CECCallbacks getCallbacks() const; | ||
CECConfig getConfig() const; | ||
|
||
CECAdapter * _cecAdapter {}; | ||
CECCallbacks _cecCallbacks {}; | ||
CECConfig _cecConfig {}; | ||
|
||
Logger * _logger {}; | ||
}; |
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
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
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
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 |
---|---|---|
|
@@ -550,6 +550,5 @@ private slots: | |
/// Boblight instance | ||
BoblightServer* _boblightServer; | ||
|
||
/// mutex | ||
QMutex _changes; | ||
}; |
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
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
"params": { | ||
"type" : "object", | ||
"required" : false | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |
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
Oops, something went wrong.