12 QObject::connect(
m_A2F, SIGNAL(newBTSocket(QBluetoothSocket*)),
m_F2A, SLOT(newBTSocket(QBluetoothSocket*)));
23 static const QLatin1String serviceUuid(
"e8e10f95-1a70-4b27-9ccf-02010264e9c8");
25 QBluetoothLocalDevice localDevice;
26 QString localDeviceName;
29 qInfo() <<
"Checking for Bluetooth device";
30 if(localDevice.isValid()) {
33 qInfo() <<
"Turning on Bluetooth device";
34 localDevice.powerOn();
37 qInfo() <<
"Reading Bluetooth device name";
38 localDeviceName = localDevice.name();
41 qInfo() <<
"Making Bluetooth device visible";
42 localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable);
45 qWarning() <<
"No connected Bluetooth device found";
47 rfcommServer =
new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol,
this);
49 qWarning() <<
"Cannot bind Bluetooth device to" << localDevice.address();
54 QBluetoothServiceInfo::Sequence classId;
56 classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
57 serviceInfo.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList, classId);
59 classId.prepend(QVariant::fromValue(QBluetoothUuid(serviceUuid)));
61 serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
63 serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceName, tr(
"DENM BT forwarder"));
64 serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceDescription, tr(
"Forward DENM from and to Android"));
65 serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceProvider, tr(
"URCA"));
67 serviceInfo.setServiceUuid(QBluetoothUuid(serviceUuid));
69 QBluetoothServiceInfo::Sequence publicBrowse;
70 publicBrowse << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup));
71 serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList, publicBrowse);
73 QBluetoothServiceInfo::Sequence protocolDescriptorList;
74 QBluetoothServiceInfo::Sequence protocol;
75 protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap));
76 protocolDescriptorList.append(QVariant::fromValue(protocol));
78 protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Rfcomm))
79 << QVariant::fromValue(quint8(
rfcommServer->serverPort()));
80 protocolDescriptorList.append(QVariant::fromValue(protocol));
81 serviceInfo.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList,
82 protocolDescriptorList);
QBluetoothSocket * btSocket
QBluetoothServer * rfcommServer
QBluetoothServiceInfo serviceInfo
BluetoothBridge(ParameterDENM *denm)