Skip to content
Browse files

gta04 bluetooth - use rfkill for turn on/off

I am not sure if this is right way to do it. E.g. Marcel recommends
in this thread:

    http://permalink.gmane.org/gmane.linux.bluez.kernel/3763

to use just Powered property. But for GTA04 it might not be enough to
save power, so for let's use rfkill.
  • Loading branch information...
1 parent cca4dc4 commit 202403914072d08e634607a9f82cea959559a0e0 @radekp committed Apr 9, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/libraries/qtopiacomm/bluetooth/qbluetoothlocaldevice.cpp
View
11 src/libraries/qtopiacomm/bluetooth/qbluetoothlocaldevice.cpp
@@ -39,6 +39,7 @@
#include <QDBusArgument>
#include <QSet>
#include <QDebug>
+#include <QProcess>
#include <stdio.h>
#include <string.h>
@@ -1231,7 +1232,11 @@ QBluetoothReply<bool> QBluetoothLocalDevice::discoverable() const
*/
bool QBluetoothLocalDevice::setConnectable()
{
+#ifdef QT_QWS_GTA04
+ return QProcess::execute("rfkill", QStringList() << "unblock" << "bluetooth") == 0;
+#else
return m_data->setPropertyAsync("Powered", true, SLOT(asyncReply(QDBusMessage)));
+#endif
}
/*!
@@ -1257,7 +1262,11 @@ QBluetoothReply<bool> QBluetoothLocalDevice::connectable() const
*/
bool QBluetoothLocalDevice::turnOff()
{
- return m_data->setPropertyAsync("Powered", false, SLOT(asyncReply(QDBusMessage)));
+ #ifdef QT_QWS_GTA04
+ return QProcess::execute("rfkill", QStringList() << "block" << "bluetooth") == 0;
+#else
+ return m_data->setPropertyAsync("Powered", false, SLOT(asyncReply(QDBusMessage)));
+#endif
}
/*!

0 comments on commit 2024039

Please sign in to comment.
Something went wrong with that request. Please try again.