diff options
author | Ari Salmi <snowgrains@snowgrains.com> | 2017-07-15 00:37:31 +0300 |
---|---|---|
committer | Samuli Piippo <samuli.piippo@qt.io> | 2017-11-30 09:58:46 +0000 |
commit | d683d8b556f924a67aaa0012c417f9346b46ec1a (patch) | |
tree | 02936aa4c1d890299d7787de683b584c16f4d259 /src/cloudmessagingembeddedkaltiot/qcloudmessagingembeddedkaltiotclient.h | |
parent | 8737866cee70b782ce862a450d0f8db1917be0df (diff) |
Initial import
Change-Id: I6a868ab4b9f418114e52f57c5b9db2b54f350a4f
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Diffstat (limited to 'src/cloudmessagingembeddedkaltiot/qcloudmessagingembeddedkaltiotclient.h')
-rw-r--r-- | src/cloudmessagingembeddedkaltiot/qcloudmessagingembeddedkaltiotclient.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/cloudmessagingembeddedkaltiot/qcloudmessagingembeddedkaltiotclient.h b/src/cloudmessagingembeddedkaltiot/qcloudmessagingembeddedkaltiotclient.h new file mode 100644 index 0000000..e592efa --- /dev/null +++ b/src/cloudmessagingembeddedkaltiot/qcloudmessagingembeddedkaltiotclient.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtCloudMessaging module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3-COMM$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCloudMessagingEmbeddedKaltiotClient_H +#define QCloudMessagingEmbeddedKaltiotClient_H + +#include <QtCloudMessaging/QtCloudMessaging> +#include <QtCloudMessaging/qtcloudmessagingglobal.h> + +#include <QObject> +#include <QVariantMap> +#include <QString> +#include <QScopedPointer> + +#ifndef ANDROID_OS +#include "ks_gw_client.h" +#else +#include "ks_gw_client_android.h" +#endif + +QT_BEGIN_NAMESPACE + +class QCloudMessagingEmbeddedKaltiotClientPrivate; + +class Q_CLOUDMESSAGING_EXPORT QCloudMessagingEmbeddedKaltiotClient : public QCloudMessagingClient +{ + Q_OBJECT +public: + + explicit QCloudMessagingEmbeddedKaltiotClient(QObject *parent = nullptr); + ~QCloudMessagingEmbeddedKaltiotClient(); + + // Qt Cloud messaging client virtual functions + virtual QString connectClient(const QString &clientId, + const QVariantMap ¶meters = QVariantMap()) override; + + virtual void disconnectClient() override; + + virtual void cloudMessageReceived(const QString &client, const QByteArray &message) override; + + virtual QString clientToken() override; + + virtual void setClientToken(const QString &token) override; + + virtual bool sendMessage(const QByteArray &msg, + const QString &clientToken = QString(), + const QString &channel = QString()) override; + + + virtual bool flushMessageQueue() override; + + virtual bool subscribeToChannel(const QString &channel) override; + + virtual bool unsubscribeFromChannel(const QString &channel) override; + + void kaltiotMessageReceived(const QString &client, const QString &message); + + ks_gw_client_instance_t *getKaltiotEngineInstance(); + +private: + void make_kaltiot_client_registration(); + void runBackgroundThread(); + + QScopedPointer<QCloudMessagingEmbeddedKaltiotClientPrivate> d; + +}; + +QT_END_NAMESPACE + +#endif // QCloudMessagingEmbeddedKaltiotClient_H |