Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qbluetoothsocket_macos_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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#ifndef QBLUETOOTHSOCKET_OSX_P_H
5#define QBLUETOOTHSOCKET_OSX_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#ifdef QT_OSX_BLUETOOTH
19
23#include "qbluetoothsocket.h"
24#include "darwin/btraii_p.h"
25
26#ifndef QPRIVATELINEARBUFFER_BUFFERSIZE
27#define QPRIVATELINEARBUFFER_BUFFERSIZE Q_INT64_C(16384)
28#endif
29// The order is important: bytearray before buffer:
30#include <QtCore/qbytearray.h>
32
33#include <QtCore/qglobal.h>
34#include <QtCore/QIODevice>
35#include <QtCore/QList>
36#include <QtCore/QObject>
37#include <QtCore/QScopedPointer>
38#include <QtCore/QString>
39
41
43
44class QBluetoothSocketPrivateDarwin : public QBluetoothSocketBasePrivate, public DarwinBluetooth::ChannelDelegate
45{
46 friend class QBluetoothSocket;
47 friend class QBluetoothServer;
48
49public:
50 QBluetoothSocketPrivateDarwin();
51 ~QBluetoothSocketPrivateDarwin();
52
53 //
55
56 QString localName() const override;
57 QBluetoothAddress localAddress() const override;
58 quint16 localPort() const override;
59
60 QString peerName() const override;
61 QBluetoothAddress peerAddress() const override;
62 quint16 peerPort() const override;
63
64 void abort() override;
65 void close() override;
66
67 qint64 writeData(const char *data, qint64 maxSize) override;
68 qint64 readData(char *data, qint64 maxSize) override;
69
70 qint64 bytesAvailable() const override;
71 bool canReadLine() const override;
72 qint64 bytesToWrite() const override;
73
76 QBluetoothSocket::OpenMode openMode) override;
77
79 QIODevice::OpenMode openMode) override;
80 void connectToService(const QBluetoothServiceInfo &service,
81 QIODevice::OpenMode openMode) override;
83 QIODevice::OpenMode openMode) override;
84
86 QIODevice::OpenMode openMode) override;
87
88 void _q_writeNotify();
89
90private:
91 // Create a socket from an external source (without connectToService).
92 bool setRFCOMChannel(void *channel);
93 bool setL2CAPChannel(void *channel);
94
95 // L2CAP and RFCOMM delegate
96 void setChannelError(IOReturn errorCode) override;
97 void channelOpenComplete() override;
98 void channelClosed() override;
99 void readChannelData(void *data, std::size_t size) override;
100 void writeComplete() override;
101
102 QList<char> writeChunk;
103
104 using L2CAPChannel = DarwinBluetooth::ScopedPointer;
105 L2CAPChannel l2capChannel;
106
107 using RFCOMMChannel = L2CAPChannel;
108 RFCOMMChannel rfcommChannel;
109 // A trick to deal with channel open too fast (synchronously).
110 bool isConnecting = false;
111};
112
114
115#endif
116
117#endif
IOBluetoothL2CAPChannel * channel
\inmodule QtBluetooth
\inmodule QtBluetooth
\inmodule QtBluetooth
Protocol
This enum describes the socket protocol used by the service.
virtual QString peerName() const =0
virtual QBluetoothAddress peerAddress() const =0
virtual void connectToService(const QBluetoothServiceInfo &service, QIODevice::OpenMode openMode)=0
virtual bool setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType, QBluetoothSocket::SocketState socketState=QBluetoothSocket::SocketState::ConnectedState, QBluetoothSocket::OpenMode openMode=QBluetoothSocket::ReadWrite)=0
virtual qint64 bytesAvailable() const =0
virtual qint64 bytesToWrite() const =0
virtual QString localName() const =0
virtual QBluetoothAddress localAddress() const =0
virtual bool canReadLine() const =0
virtual qint64 writeData(const char *data, qint64 maxSize)=0
virtual quint16 localPort() const =0
virtual void connectToServiceHelper(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode)=0
virtual quint16 peerPort() const =0
virtual bool ensureNativeSocket(QBluetoothServiceInfo::Protocol type)=0
\inmodule QtBluetooth
SocketState
This enum describes the state of the Bluetooth socket.
\inmodule QtBluetooth
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
EGLOutputPortEXT port
static QT_BEGIN_NAMESPACE const char * socketType(QSocketNotifier::Type type)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum type
GLuint GLuint64EXT address
unsigned short quint16
Definition qtypes.h:48
long long qint64
Definition qtypes.h:60
QByteArray readData()