8#include <QtCore/QByteArray>
9#include <QtCore/QDebug>
10#include <QtCore/QList>
11#include <QtCore/QSocketNotifier>
12#include <QtCore/private/qcore_unix_p.h>
24const char *QQnxNavigatorEventNotifier::navigatorControlPath =
"/pps/services/navigator/control";
25const size_t QQnxNavigatorEventNotifier::ppsBufferSize = 4096;
31 m_eventHandler(eventHandler)
37 delete m_readNotifier;
43 qCDebug(lcQpaQnxNavigatorEvents) <<
"Navigator event notifier stopped";
48 qCDebug(lcQpaQnxNavigatorEvents) <<
"Navigator event notifier started";
52 m_fd =
open(navigatorControlPath, O_RDWR);
54 qCDebug(lcQpaQnxNavigatorEvents,
"Failed to open navigator pps: %s", strerror(errno));
67 QList<QByteArray> lines = ppsData.split(
'\n');
70 if (
Q_UNLIKELY(lines.empty() || lines.at(0) !=
"@control"))
71 qFatal(
"QQNX: unrecognized pps object, data=%s", ppsData.constData());
74 for (
int i = 1;
i < lines.size(); ++
i) {
80 int firstColon = attr.
indexOf(
':');
81 if (firstColon == -1) {
86 int secondColon = attr.indexOf(
':', firstColon + 1);
87 if (secondColon == -1) {
100 else if (
key ==
"dat")
102 else if (
key ==
"id")
105 qFatal(
"QQNX: unrecognized pps attribute, attr=%s",
key.constData());
116 if (!dat.isEmpty()) {
117 ppsData +=
"\ndat::";
126 int bytes =
write(m_fd, ppsData.constData(), ppsData.size());
128 qFatal(
"QQNX: failed to write navigator pps, errno=%d", errno);
133 qCDebug(lcQpaQnxNavigatorEvents) <<
Q_FUNC_INFO <<
"msg=" << msg <<
", dat=" << dat <<
", id=" <<
id;
136 if (msg ==
"orientationCheck") {
140 replyPPS(msg,
id, response ?
"true" :
"false");
141 }
else if (msg ==
"orientation") {
143 replyPPS(msg,
id,
"");
144 }
else if (msg ==
"SWIPE_DOWN") {
146 }
else if (msg ==
"exit") {
148 }
else if (msg ==
"windowActive") {
150 }
else if (msg ==
"windowInactive") {
155void QQnxNavigatorEventNotifier::readData()
157 qCDebug(lcQpaQnxNavigatorEvents) <<
"Reading navigator data";
160 char buffer[ppsBufferSize];
166 qFatal(
"QQNX: failed to read navigator pps, errno=%d", errno);
179 parsePPS(ppsData, msg, dat,
id);
180 handleMessage(msg, dat,
id);
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 mid(qsizetype index, qsizetype len=-1) const &
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void handleWindowGroupActivated(const QByteArray &id)
void handleWindowGroupDeactivated(const QByteArray &id)
void handleOrientationChange(int angle)
bool handleOrientationCheck(int angle)
~QQnxNavigatorEventNotifier()
QQnxNavigatorEventNotifier(QQnxNavigatorEventHandler *eventHandler, QObject *parent=nullptr)
Combined button and popup list for selecting options.
static qint64 qt_safe_read(int fd, void *data, qint64 maxlen)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qCDebug(category,...)
file open(QIODevice::ReadOnly)
gzip write("uncompressed data")