Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
m-seker committed Jul 18, 2020
1 parent 76b165e commit 84d3263
Show file tree
Hide file tree
Showing 25 changed files with 139 additions and 211 deletions.
2 changes: 1 addition & 1 deletion CompileHowto.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/

```
sudo apt-get update
sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxcb-util0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite libssl-dev zlib1g-dev
sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-util0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite libssl-dev zlib1g-dev
```

**on RPI you need the videocore IV headers**
Expand Down
4 changes: 2 additions & 2 deletions CrossCompileHowto.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Use a clean Raspbian Stretch Lite (on target) and Ubuntu 18/19 (on host) to exec
## On the Target system (here Raspberry Pi)
Install required additional packages.
```
sudo apt-get install qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxcb-util0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite aptitude qt5-default rsync libssl-dev zlib1g-dev
sudo apt-get install qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-util0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite aptitude qt5-default rsync libssl-dev zlib1g-dev
```
## On the Host system (here Ubuntu)
Update the Ubuntu environment to the latest stage and install required additional packages.
```
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -qq -y install git rsync cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxcb-util0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite libssl-dev zlib1g-dev
sudo apt-get -qq -y install git rsync cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-util0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite libssl-dev zlib1g-dev
```

Refine the target IP or hostname, plus userID as required and set-up cross-compilation environment:
Expand Down
5 changes: 0 additions & 5 deletions assets/webconfig/js/content_grabber.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,5 @@ $(document).ready( function() {
hideEl(["pixelDecimation"]);
});

$(window.hyperion).on("cmd-scan", function(event) {
console.log(event.response);
});
requestCecScan();

removeOverlay();
});
5 changes: 0 additions & 5 deletions assets/webconfig/js/hyperion.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,6 @@ function requestAdjustment(type, value, complete)
sendToHyperion("adjustment", "", '"adjustment": {"'+type+'": '+value+'}');
}

async function requestCecScan()
{
return sendAsyncToHyperion("cec", "scan", "", Math.floor(Math.random() * 1000));
}

async function requestLedDeviceDiscovery(type)
{
let data = { ledDeviceType: type };
Expand Down
2 changes: 1 addition & 1 deletion bin/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CFG="${2:-Release}"
INST="$( [ "${3:-}" = "install" ] && echo true || echo false )"

sudo apt-get update
sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev libturbojpeg0-dev python3-dev libxcb-util0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libssl-dev libjpeg-dev libqt5sql5-sqlite zlib1g-dev || exit 1
sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev libturbojpeg0-dev python3-dev libcec-dev libxcb-util0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libssl-dev libjpeg-dev libqt5sql5-sqlite zlib1g-dev || exit 1

if [ -e /dev/vc-cma -a -e /dev/vc-mem ]
then
Expand Down
31 changes: 0 additions & 31 deletions bin/create_oe_depedencies.sh

This file was deleted.

2 changes: 1 addition & 1 deletion bin/create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if ! [ -d "$builddir" ]; then
echo "Could not find build director"
exit 1
fi

outfile="$repodir/deploy/hyperion_$buildid.tar.gz"
echo create $outfile

Expand Down
1 change: 0 additions & 1 deletion cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ macro(DeployUnix TARGET)
"libusb-1"
"libutil"
"libX11"
"libz"
)

if (APPLE)
Expand Down
19 changes: 19 additions & 0 deletions cmake/FindCEC.cmake
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)
6 changes: 0 additions & 6 deletions include/api/API.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,6 @@ class API : public QObject
///
bool hasHyperionDefaultPw();

///
/// @brief Scan HDMI bus for available CEC devices
/// @return Scan results
///
QString scanCec();

///
/// @brief Logout revokes all authorizations
///
Expand Down
6 changes: 0 additions & 6 deletions include/api/JsonAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,6 @@ private slots:
///
void handleLedDeviceCommand(const QJsonObject &message, const QString &command, const int tan);

/// Handle an incoming JSON Led Device message
///
/// @param message the incoming message
///
void handleCecCommand(const QJsonObject &message, const QString &command, const int tan);

///
/// Handle an incoming JSON message of unknown type
///
Expand Down
19 changes: 5 additions & 14 deletions include/cec/CECHandler.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include <QObject>
#include <QMutex>
#include <QVector>

#include <iostream>
Expand All @@ -19,35 +18,29 @@ 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;
using CECPowerStatus = CEC::cec_power_status;
using CECVendorId = CEC::cec_vendor_id;

class CECHandler : public QObject
{
Q_OBJECT
public:
CECHandler();
~CECHandler() override;

static CECHandler * getInstance()
{
static CECHandler instance;
return &instance;
}
QString scan() const;

public slots:
bool start();
void stop();
bool running() const { return _cecAdapter != nullptr; }
QString scan() const;

signals:
void cecEvent(CECEvent event);

private:
CECHandler();

/* CEC Callbacks */
static void onCecLogMessage (void * context, const CECLogMessage * message);
static void onCecKeyPress (void * context, const CECKeyPress * key);
Expand All @@ -69,6 +62,4 @@ class CECHandler : public QObject
CECAdapter * _cecAdapter {};
CECCallbacks _cecCallbacks {};
CECConfig _cecConfig {};

mutable QMutex _lock { QMutex::Recursive };
};
8 changes: 0 additions & 8 deletions libsrc/api/API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <QTimer>

// hyperion includes
#include <cec/CECHandler.h>
#include <leddevice/LedDeviceWrapper.h>
#include <hyperion/GrabberWrapper.h>
#include <utils/jsonschema/QJsonFactory.h>
Expand Down Expand Up @@ -528,10 +527,3 @@ void API::checkTokenResponse(const bool &success, QObject *caller, const QString
void API::stopDataConnectionss()
{
}

QString API::scanCec()
{
if (!_adminAuthorized)
return {};
return CECHandler::getInstance()->scan();
}
4 changes: 0 additions & 4 deletions libsrc/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,3 @@ target_link_libraries(hyperion-api
Qt5::Gui
Qt5::Network
)

if (ENABLE_CEC)
target_link_libraries(hyperion-api cechandler)
endif ()
20 changes: 0 additions & 20 deletions libsrc/api/JSONRPC_schema/schema-cec.json

This file was deleted.

2 changes: 1 addition & 1 deletion libsrc/api/JSONRPC_schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"command": {
"type" : "string",
"required" : true,
"enum" : ["cec" , "color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo", "videomode", "authorize", "instance", "leddevice", "transform", "correction" , "temperature"]
"enum" : ["color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo", "videomode", "authorize", "instance", "leddevice", "transform", "correction" , "temperature"]
}
}
}
1 change: 0 additions & 1 deletion libsrc/api/JSONRPC_schemas.qrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<RCC>
<qresource prefix="/">
<file alias="schema">JSONRPC_schema/schema.json</file>
<file alias="schema-cec">JSONRPC_schema/schema-cec.json</file>
<file alias="schema-color">JSONRPC_schema/schema-color.json</file>
<file alias="schema-image">JSONRPC_schema/schema-image.json</file>
<file alias="schema-serverinfo">JSONRPC_schema/schema-serverinfo.json</file>
Expand Down
26 changes: 0 additions & 26 deletions libsrc/api/JsonAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ void JsonAPI::handleMessage(const QString &messageString, const QString &httpAut
handleInstanceCommand(message, command, tan);
else if (command == "leddevice")
handleLedDeviceCommand(message, command, tan);
else if (command == "cec")
handleCecCommand(message, command, tan);

// BEGIN | The following commands are derecated but used to ensure backward compatibility with hyperion Classic remote control
else if (command == "clearall")
Expand Down Expand Up @@ -1466,30 +1464,6 @@ void JsonAPI::handleLedDeviceCommand(const QJsonObject &message, const QString &
}
}


void JsonAPI::handleCecCommand(const QJsonObject &message, const QString &command, const int tan)
{
Debug(_log, "message: [%s]", QString(QJsonDocument(message).toJson(QJsonDocument::Compact)).toUtf8().constData());

const QString &subcommand = message["subcommand"].toString().trimmed();

QString full_command = command + "-" + subcommand;

if (subcommand == "scan")
{
QJsonObject devices;
devices.insert("devices", API::scanCec());
QJsonDocument document(devices);

Debug(_log, "response: [%s]", QString(document.toJson(QJsonDocument::Compact)).toUtf8().constData());
sendSuccessDataReply(document, full_command, tan);
}
else
{
sendErrorReply("Unknown or missing subcommand", full_command, tan);
}
}

void JsonAPI::handleNotImplemented()
{
sendErrorReply("Command not implemented");
Expand Down
Loading

0 comments on commit 84d3263

Please sign in to comment.