* fix for omx when performing GST build * wireless android auto bluetooth negotation * Grab local bluetooth adapter * Handling ping and voice session * wait for both usb and wifi device ]connections * Make btservice launch with openauto, allows for wireless connection automatically * WiFi hotspot info pulled from openauto config * Install btservice correctly Co-authored-by: Rhys_M <rhys1802@hotmail.co.uk> Co-authored-by: Robert Judka <robertjudka@gmail.com>
69 lines
2.8 KiB
C++
69 lines
2.8 KiB
C++
/*
|
|
* This file is part of openauto project.
|
|
* Copyright (C) 2018 f1x.studio (Michal Szwaj)
|
|
*
|
|
* openauto is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
|
|
* openauto is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "btservice/AndroidBluetoothService.hpp"
|
|
|
|
namespace openauto
|
|
{
|
|
namespace btservice
|
|
{
|
|
|
|
AndroidBluetoothService::AndroidBluetoothService(uint16_t portNumber)
|
|
{
|
|
//"4de17a00-52cb-11e6-bdf4-0800200c9a66";
|
|
//"669a0c20-0008-f4bd-e611-cb52007ae14d";
|
|
const QBluetoothUuid serviceUuid(QLatin1String("4de17a00-52cb-11e6-bdf4-0800200c9a66"));
|
|
|
|
QBluetoothServiceInfo::Sequence classId;
|
|
classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
|
|
serviceInfo_.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList, classId);
|
|
classId.prepend(QVariant::fromValue(serviceUuid));
|
|
serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
|
|
serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceName, "OpenAuto Bluetooth Service");
|
|
serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceDescription, "AndroidAuto WiFi projection automatic setup");
|
|
serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceProvider, "openDsh");
|
|
serviceInfo_.setServiceUuid(serviceUuid);
|
|
|
|
QBluetoothServiceInfo::Sequence publicBrowse;
|
|
publicBrowse << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup));
|
|
serviceInfo_.setAttribute(QBluetoothServiceInfo::BrowseGroupList, publicBrowse);
|
|
|
|
QBluetoothServiceInfo::Sequence protocolDescriptorList;
|
|
QBluetoothServiceInfo::Sequence protocol;
|
|
protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap));
|
|
protocolDescriptorList.append(QVariant::fromValue(protocol));
|
|
protocol.clear();
|
|
protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Rfcomm))
|
|
<< QVariant::fromValue(quint8(portNumber));
|
|
protocolDescriptorList.append(QVariant::fromValue(protocol));
|
|
serviceInfo_.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList);
|
|
}
|
|
|
|
bool AndroidBluetoothService::registerService(const QBluetoothAddress& bluetoothAddress)
|
|
{
|
|
return serviceInfo_.registerService(bluetoothAddress);
|
|
}
|
|
|
|
bool AndroidBluetoothService::unregisterService()
|
|
{
|
|
return serviceInfo_.unregisterService();
|
|
}
|
|
|
|
}
|
|
}
|