MdBluetoothCom::MdBluetoothCom(QObject *parent, QString mdServiceName)
    : MdAbstractCom(parent), sDiscoveryAgent (0), socket (0), sdNeeded(Yes), mdServiceName(mdServiceName)
{

    QBluetoothLocalDevice localDevice;

    // Check if Bluetooth is available on this device
    if (localDevice.isValid()) {

        // Turn Bluetooth on
        localDevice.powerOn();

        // Read local device name
        localDeviceName = localDevice.name();
        qDebug() << "local bluetooth device name: " << localDeviceName;
        // Make it visible to others
        //localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable);

        // Get connected devices
        remotes = localDevice.connectedDevices();

        startServiceDiscovery();

    } else {
        qDebug() << "bluetooth not available!";
        emit showStatusMessage( "Bluetooth: not available!" );
    }
}
void MyClass::localDevice() {
//! [turningon]
QBluetoothLocalDevice localDevice;
QString localDeviceName;

// Check if Bluetooth is available on this device
if (localDevice.isValid()) {

    // Turn Bluetooth on
    localDevice.powerOn();

    // Read local device name
    localDeviceName = localDevice.name();

    // Make it visible to others
    localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable);

    // Get connected devices
    QList<QBluetoothAddress> remotes;
    remotes = localDevice.connectedDevices();
}
//! [turningon]


}
void tst_QBluetoothLocalDevice::tst_name()
{
    if (!QBluetoothLocalDevice::allDevices().count())
        QSKIP("Skipping test due to missing Bluetooth device");

    QBluetoothLocalDevice localDevice;
    QVERIFY(!localDevice.name().isEmpty());
}
void tst_QBluetoothLocalDevice::tst_name()
{
    QBluetoothLocalDevice localDevice;
    QVERIFY(!localDevice.name().isEmpty());
}
QString QBluetoothSocketPrivate::localName() const
{
    QBluetoothLocalDevice ld;
    return ld.name();
}