4#ifndef QBLUETOOTHSOCKET_OSX_P_H
5#define QBLUETOOTHSOCKET_OSX_P_H
18#ifdef QT_OSX_BLUETOOTH
20#include "qbluetoothsocketbase_p.h"
21#include "qbluetoothserviceinfo.h"
22#include "darwin/btdelegates_p.h"
23#include "qbluetoothsocket.h"
24#include "darwin/btraii_p.h"
26#ifndef QPRIVATELINEARBUFFER_BUFFERSIZE
27#define QPRIVATELINEARBUFFER_BUFFERSIZE Q_INT64_C(16384
)
30#include <QtCore/qbytearray.h>
31#include "qprivatelinearbuffer_p.h"
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>
42class QBluetoothAddress;
44class QBluetoothSocketPrivateDarwin :
public QBluetoothSocketBasePrivate,
public DarwinBluetooth::ChannelDelegate
46 friend class QBluetoothSocket;
47 friend class QBluetoothServer;
50 QBluetoothSocketPrivateDarwin();
51 ~QBluetoothSocketPrivateDarwin();
54 bool ensureNativeSocket(QBluetoothServiceInfo::Protocol type) override;
56 QString localName()
const override;
57 QBluetoothAddress localAddress()
const override;
58 quint16 localPort()
const override;
60 QString peerName()
const override;
61 QBluetoothAddress peerAddress()
const override;
62 quint16 peerPort()
const override;
64 void abort() override;
65 void close() override;
67 qint64 writeData(
const char *data, qint64 maxSize) override;
68 qint64 readData(
char *data, qint64 maxSize) override;
70 qint64 bytesAvailable()
const override;
71 bool canReadLine()
const override;
72 qint64 bytesToWrite()
const override;
74 bool setSocketDescriptor(
int socketDescriptor, QBluetoothServiceInfo::Protocol socketType,
75 QBluetoothSocket::SocketState socketState,
76 QBluetoothSocket::OpenMode openMode) override;
78 void connectToServiceHelper(
const QBluetoothAddress &address, quint16 port,
79 QIODevice::OpenMode openMode) override;
80 void connectToService(
const QBluetoothServiceInfo &service,
81 QIODevice::OpenMode openMode) override;
82 void connectToService(
const QBluetoothAddress &address,
const QBluetoothUuid &uuid,
83 QIODevice::OpenMode openMode) override;
85 void connectToService(
const QBluetoothAddress &address, quint16 port,
86 QIODevice::OpenMode openMode) override;
88 void _q_writeNotify();
92 bool setRFCOMChannel(
void *channel);
93 bool setL2CAPChannel(
void *channel);
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;
102 QList<
char> writeChunk;
104 using L2CAPChannel = DarwinBluetooth::ScopedPointer;
105 L2CAPChannel l2capChannel;
107 using RFCOMMChannel = L2CAPChannel;
108 RFCOMMChannel rfcommChannel;
110 bool isConnecting =
false;
~QBluetoothServerPrivate()
QMap< quint16, QBluetoothServerPrivate * > & busyPSMs()
QMap< quint16, QBluetoothServerPrivate * > & busyChannels()
QMap< quint16, QBluetoothServerPrivate * >::iterator ServerMapIterator