Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qbluetoothsocket_android_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
5#ifndef QBLUETOOTHSOCKET_ANDROID_P_H
6#define QBLUETOOTHSOCKET_ANDROID_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
20
21#include <QtCore/QJniObject>
22#include <QtCore/QPointer>
23#include "android/inputstreamthread_p.h"
24#include <jni.h>
25
27
29{
32
33public:
36
37 //On Android we connect using the uuid not the port
38 void connectToServiceHelper(const QBluetoothAddress &address, const QBluetoothUuid &uuid,
39 QIODevice::OpenMode openMode) override;
40
41 void connectToService(const QBluetoothServiceInfo &service,
42 QIODevice::OpenMode openMode) override;
43 void connectToService(const QBluetoothAddress &address, const QBluetoothUuid &uuid,
44 QIODevice::OpenMode openMode) override;
45 void connectToService(const QBluetoothAddress &address, quint16 port,
46 QIODevice::OpenMode openMode) override;
47
48 bool fallBackReversedConnect(const QBluetoothUuid &uuid);
49
50 bool ensureNativeSocket(QBluetoothServiceInfo::Protocol type) override;
51
52 QString localName() const override;
53 QBluetoothAddress localAddress() const override;
54 quint16 localPort() const override;
55
56 QString peerName() const override;
57 QBluetoothAddress peerAddress() const override;
58 quint16 peerPort() const override;
59
60 void abort() override;
61 void close() override;
62
63 qint64 writeData(const char *data, qint64 maxSize) override;
64 qint64 readData(char *data, qint64 maxSize) override;
65
66 bool setSocketDescriptor(const QJniObject &socket, QBluetoothServiceInfo::Protocol socketType,
67 QBluetoothSocket::SocketState socketState = QBluetoothSocket::SocketState::ConnectedState,
68 QBluetoothSocket::OpenMode openMode = QBluetoothSocket::ReadWrite) override;
69
70 bool setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType,
71 QBluetoothSocket::SocketState socketState = QBluetoothSocket::SocketState::ConnectedState,
72 QBluetoothSocket::OpenMode openMode = QBluetoothSocket::ReadWrite) override;
73
74 qint64 bytesAvailable() const override;
75 bool canReadLine() const override;
76 qint64 bytesToWrite() const override;
77
78 static QBluetoothUuid reverseUuid(const QBluetoothUuid &serviceUuid);
79
86
87public slots:
89 void defaultSocketConnectFailed(const QJniObject & socket,
90 const QJniObject &targetUuid,
91 const QBluetoothUuid &qtTargetUuid);
92 void fallbackSocketConnectFailed(const QJniObject &socket,
93 const QJniObject &targetUuid);
94 void inputThreadError(int errorCode);
95
99
100};
101
102// QTBUG-61392 related
103// Private API to disable the silent behavior to reverse a remote service's
104// UUID. In rare cases the workaround behavior might not be desirable as
105// it may lead to connects to incorrect services.
107
108QT_END_NAMESPACE
109
110#endif // QBLUETOOTHSOCKET_ANDROID_P_H
void errorOccurred(int errorCode)
void javaThreadErrorOccurred(int errorCode)
qint64 bytesAvailable() const
qint64 readData(char *data, qint64 maxSize)
void javaReadyRead(jbyteArray buffer, int bufferLength)
bool setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType, QBluetoothSocket::SocketState socketState=QBluetoothSocket::SocketState::ConnectedState, QBluetoothSocket::OpenMode openMode=QBluetoothSocket::ReadWrite) override
void defaultSocketConnectFailed(const QJniObject &socket, const QJniObject &targetUuid, const QBluetoothUuid &qtTargetUuid)
void connectToService(const QBluetoothAddress &address, const QBluetoothUuid &uuid, QIODevice::OpenMode openMode) override
void connectToServiceHelper(const QBluetoothAddress &address, const QBluetoothUuid &uuid, QIODevice::OpenMode openMode) override
static QBluetoothUuid reverseUuid(const QBluetoothUuid &serviceUuid)
bool ensureNativeSocket(QBluetoothServiceInfo::Protocol type) override
QBluetoothAddress peerAddress() const override
void fallbackSocketConnectFailed(const QJniObject &socket, const QJniObject &targetUuid)
bool setSocketDescriptor(const QJniObject &socket, QBluetoothServiceInfo::Protocol socketType, QBluetoothSocket::SocketState socketState=QBluetoothSocket::SocketState::ConnectedState, QBluetoothSocket::OpenMode openMode=QBluetoothSocket::ReadWrite) override
QBluetoothAddress localAddress() const override
void connectToService(const QBluetoothServiceInfo &service, QIODevice::OpenMode openMode) override
qint64 writeData(const char *data, qint64 maxSize) override
void connectToService(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode) override
qint64 readData(char *data, qint64 maxSize) override
bool fallBackReversedConnect(const QBluetoothUuid &uuid)
bool useReverseUuidWorkAroundConnect