Warning, file /plasma-bigscreen/plasma-remotecontrollers/src/libcec/ceccontroller.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *   SPDX-FileCopyrightText: 2022 Bart Ribbers <bribbers@disroot.org>
0003  *   SPDX-FileCopyrightText: 2022 Aditya Mehra <aix.m@outlook.com>
0004  *
0005  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006  */
0007 
0008 #pragma once
0009 
0010 #include <QDebug>
0011 #include <QObject>
0012 
0013 #include <libcec/cec.h>
0014 
0015 #define LOOPTIME 50 * 1000
0016 
0017 using namespace CEC;
0018 
0019 class CECController : public QObject
0020 {
0021     Q_OBJECT
0022     Q_CLASSINFO("D-Bus Interface", "org.kde.plasma.remotecontrollers.CEC")
0023 
0024 public:
0025     explicit CECController();
0026     ~CECController() override;
0027 
0028     void discoverDevices();
0029 
0030 public Q_SLOTS:
0031     Q_SCRIPTABLE int sendNextKey();
0032     Q_SCRIPTABLE bool hdmiCecSupported();
0033     Q_SCRIPTABLE bool sendKey(uchar, CEC::cec_logical_address address = CECDEVICE_TV);
0034     Q_SCRIPTABLE bool powerOnDevices(CEC::cec_logical_address address = CECDEVICE_TV);
0035     Q_SCRIPTABLE bool powerOffDevices(CEC::cec_logical_address address = CECDEVICE_BROADCAST);
0036     Q_SCRIPTABLE bool makeActiveSource();
0037 
0038 private:
0039     ICECAdapter* m_cecAdapter = nullptr;
0040     ICECCallbacks m_cecCallbacks;
0041     static QHash<int, int> m_keyCodeTranslation;
0042 
0043     static bool m_catchNextInput;
0044     static int m_caughtInput;
0045     static bool m_nativeNavMode;
0046 
0047     static void handleCecKeypress(void* param, const cec_keypress* key);
0048     static void handleCommandReceived(void* param, const cec_command* command);
0049 
0050     static int m_hitcommand;
0051 
0052     static void handleCompleteEvent(const int keycode, const int keyduration, const int opcode);
0053 };
0054 
0055 Q_DECLARE_METATYPE(CEC::cec_logical_address);