6#include <QtGui/QGuiApplication>
7#include <qpa/qwindowsysteminterface.h>
9#include <QtCore/qhash.h>
10#include <QtCore/qbytearray.h>
11#include <QtCore/QDebug>
12#include <QtCore/QMetaEnum>
13#include <QtCore/QSocketNotifier>
14#include <QtCore/private/qcore_unix_p.h>
20const char *QQnxButtonEventNotifier::ppsPath =
"/pps/system/buttons/status";
21const size_t QQnxButtonEventNotifier::ppsBufferSize = 256;
30 int enumeratorIndex = QQnxButtonEventNotifier::staticMetaObject.indexOfEnumerator(
QByteArrayLiteral(
"ButtonId"));
31 QMetaEnum enumerator = QQnxButtonEventNotifier::staticMetaObject.enumerator(enumeratorIndex);
46 qCDebug(lcQpaInputHwButton) <<
"Starting hardware button event processing";
54#if defined (QQNXBUTTON_DEBUG)
55 qWarning(
"QQNX: failed to open buttons pps, errno=%d", errno);
63 qCDebug(lcQpaInputHwButton,
"successfully connected to Navigator. fd = %d", m_fd);
66void QQnxButtonEventNotifier::updateButtonStates()
69 char buffer[ppsBufferSize];
74 qCDebug(lcQpaInputHwButton) <<
"Read" << bytes <<
"bytes of data";
77 qWarning(
"QQNX: failed to read hardware buttons pps object, errno=%d", errno);
88 qCDebug(lcQpaInputHwButton,
"Received PPS message:\n%s",
buffer);
92 QHash<QByteArray, QByteArray> fields;
93 if (!parsePPS(ppsData, &fields))
103 if (m_state[buttonId] !=
newState) {
104 qCDebug(lcQpaInputHwButton) <<
"Hardware button event: button =" <<
key <<
"state =" << fields.value(
key);
130 qCDebug(lcQpaInputHwButton) <<
"Unknown hardware button";
143void QQnxButtonEventNotifier::close()
145 delete m_readNotifier;
154bool QQnxButtonEventNotifier::parsePPS(
const QByteArray &ppsData, QHash<QByteArray, QByteArray> *messageFields)
const
157 QList<QByteArray> lines = ppsData.split(
'\n');
161 qWarning(
"QQNX: unrecognized pps object, data=%s", ppsData.constData());
166 for (
int i = 1;
i < lines.size();
i++) {
174 if (doubleColon == -1) {
QByteArray left(qsizetype n) const &
qsizetype indexOf(char c, qsizetype from=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QByteArray & insert(qsizetype i, QByteArrayView data)
QByteArray mid(qsizetype index, qsizetype len=-1) const &
static QByteArray fromRawData(const char *data, qsizetype size)
Constructs a QByteArray that uses the first size bytes of the data array.
Type
This enum type defines the valid event types in Qt.
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
const_reference at(qsizetype i) const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool handleKeyEvent(QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString &text=QString(), bool autorep=false, ushort count=1)
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
static int qt_safe_open(const char *pathname, int flags, mode_t mode=0777)
static qint64 qt_safe_read(int fd, void *data, qint64 maxlen)
static int qt_safe_close(int fd)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)