9#include <private/qcore_unix_p.h>
13const char *QQnxNavigatorPps::navigatorControlPath =
"/pps/services/navigator/control";
14const size_t QQnxNavigatorPps::ppsBufferSize = 4096;
29bool QQnxNavigatorPps::openPpsConnection()
38 qWarning(
"QQNX: failed to open navigator pps, errno=%d", errno);
42 qCDebug(lcQpaQnxNavigator) <<
"successfully connected to Navigator. fd=" << m_fd;
49 if (!openPpsConnection())
52 return sendPpsMessage(
"invoke", encodedUrl);
60 ppsMessage +=
"\ndat::" +
data;
64 qCDebug(lcQpaQnxNavigator) <<
"sending PPS message:\n" << ppsMessage;
68 int bytes =
qt_safe_write(m_fd, ppsMessage.constData(), ppsMessage.size());
70 qFatal(
"QQNX: failed to write navigator pps, errno=%d", errno);
73 char buffer[ppsBufferSize];
80 qFatal(
"QQNX: failed to read navigator pps, errno=%d", errno);
86 qCDebug(lcQpaQnxNavigator) <<
"received PPS message:\n" <<
buffer;
90 QHash<QByteArray, QByteArray> responseFields;
91 parsePPS(ppsData, responseFields);
93 if (responseFields.contains(
"res") && responseFields.value(
"res") ==
message) {
94 if (
Q_UNLIKELY(responseFields.contains(
"err"))) {
95 qCritical() <<
"navigator responded with error: " << responseFields.value(
"err");
103void QQnxNavigatorPps::parsePPS(
const QByteArray &ppsData, QHash<QByteArray, QByteArray> &messageFields)
105 qCDebug(lcQpaQnxNavigator) <<
"data=" << ppsData;
108 QList<QByteArray> lines = ppsData.split(
'\n');
111 if (
Q_UNLIKELY(lines.empty() || lines.at(0) !=
"@control"))
112 qFatal(
"QQNX: unrecognized pps object, data=%s", ppsData.constData());
115 for (
int i = 1;
i < lines.size();
i++) {
120 qCDebug(lcQpaQnxNavigator) <<
"attr=" << attr;
122 int firstColon = attr.
indexOf(
':');
123 if (firstColon == -1) {
128 int secondColon = attr.
indexOf(
':', firstColon + 1);
129 if (secondColon == -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 mid(qsizetype index, qsizetype len=-1) const &
bool requestInvokeUrl(const QByteArray &encodedUrl) override
QQnxNavigatorPps(QObject *parent=nullptr)
Combined button and popup list for selecting options.
static qint64 qt_safe_write(int fd, const void *data, qint64 len)
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 qCDebug(category,...)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint GLsizei const GLchar * message