forked from jbagg/QtZeroConf
Move Android part to use native Android mDNS API
Signed-off-by: Jonathan Bagg <drwho@infidigm.net>
This commit is contained in:
committed by
Jonathan Bagg
parent
473d8520f9
commit
24debe31b0
65
androidnsd_p.h
Normal file
65
androidnsd_p.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/**************************************************************************************************
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2021 Jonathan Bagg
|
||||
This file is part of QtZeroConf.
|
||||
|
||||
QtZeroConf is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QtZeroConf is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with QtZeroConf. If not, see <http://www.gnu.org/licenses/>.
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Project name : QtZeroConf
|
||||
File name : androidnsd_p.h
|
||||
Created : 10 Spetember 2021
|
||||
Author(s) : Michael Zanetti
|
||||
---------------------------------------------------------------------------------------------------
|
||||
NsdManager wrapper for use on Android devices
|
||||
---------------------------------------------------------------------------------------------------
|
||||
**************************************************************************************************/
|
||||
#include "qzeroconf.h"
|
||||
|
||||
#include <QtAndroid>
|
||||
#include <QtAndroidExtras>
|
||||
#include <QAndroidJniObject>
|
||||
|
||||
class QZeroConfPrivate: QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef QMap<QByteArray, QByteArray> TxtRecordMap;
|
||||
|
||||
QZeroConfPrivate(QZeroConf *parent);
|
||||
~QZeroConfPrivate();
|
||||
void startServicePublish(const char *name, const char *type, quint16 port);
|
||||
void stopServicePublish();
|
||||
void startBrowser(QString type, QAbstractSocket::NetworkLayerProtocol protocol);
|
||||
void stopBrowser();
|
||||
static void onServiceResolvedJNI(JNIEnv */*env*/, jobject /*this*/, jint id, jstring name, jstring type, jstring hostname, jstring address, jint port, jobject txtRecords);
|
||||
static void onServiceRemovedJNI(JNIEnv */*env*/, jobject /*this*/, jint id, jstring name);
|
||||
static void onBrowserStateChangedJNI(JNIEnv */*env*/, jobject /*thiz*/, jint id, jboolean running, jboolean error);
|
||||
static void onPublisherStateChangedJNI(JNIEnv */*env*/, jobject /*thiz*/, jint id, jboolean running, jboolean error);
|
||||
static void onServiceNameChangedJNI(JNIEnv */*env*/, jobject /*thiz*/, jint id, jstring newName);
|
||||
|
||||
QZeroConf *pub;
|
||||
QAndroidJniObject nsdManager;
|
||||
|
||||
bool browserExists = false;
|
||||
bool publisherExists = false;
|
||||
QMap<QByteArray, QByteArray> txtRecords;
|
||||
|
||||
|
||||
private slots:
|
||||
void onServiceResolved(const QString &name, const QString &type, const QString &hostname, const QHostAddress &address, int port, const TxtRecordMap &txtRecords);
|
||||
void onServiceRemoved(const QString &name);
|
||||
void onBrowserStateChanged(bool running, bool error);
|
||||
void onPublisherStateChanged(bool running, bool error);
|
||||
void onServiceNameChanged(const QString &newName);
|
||||
};
|
Reference in New Issue
Block a user