qtmobility/src/systeminfo/qsysteminfo_mac_p.h
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
--- a/qtmobility/src/systeminfo/qsysteminfo_mac_p.h	Fri Jun 11 14:26:25 2010 +0300
+++ b/qtmobility/src/systeminfo/qsysteminfo_mac_p.h	Wed Jun 23 19:08:38 2010 +0300
@@ -64,7 +64,8 @@
 #include <QTimer>
 #include <QtCore/qthread.h>
 #include <QtCore/qmutex.h>
- #include <QEventLoop>
+#include <QEventLoop>
+#include <IOKit/IOKitLib.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 //#include <CoreFoundation/CoreFoundation.h>
@@ -110,7 +111,7 @@
     static QSystemInfoPrivate *self;
 
 private Q_SLOTS:
- protected:
+protected:
     void connectNotify(const char *signal);
     void disconnectNotify(const char *signal);
 
@@ -213,6 +214,7 @@
 
 };
 
+class QBluetoothListenerThread;
 class QSystemDeviceInfoPrivate : public QObject
 {
     Q_OBJECT
@@ -238,7 +240,9 @@
 
     QSystemDeviceInfo::PowerState currentPowerState();
     void setConnection();
-    static QSystemDeviceInfoPrivate *instance() {return self;}
+    static QSystemDeviceInfoPrivate *instance();
+
+    bool currentBluetoothPowerState();
 
 Q_SIGNALS:
     void batteryLevelChanged(int);
@@ -253,6 +257,12 @@
     QSystemDeviceInfo::PowerState currentPowerStateCache;
     QSystemDeviceInfo::BatteryStatus batteryStatusCache;
     static QSystemDeviceInfoPrivate *self;
+    QBluetoothListenerThread *btThread;
+
+protected:
+    void connectNotify(const char *signal);
+    void disconnectNotify(const char *signal);
+
 };
 
 
@@ -287,7 +297,7 @@
     QRunLoopThread(QObject *parent = 0);
     ~QRunLoopThread();
     bool keepRunning;
-    void quit();
+    void stop();
 
 protected:
     void run();
@@ -316,6 +326,33 @@
 
 private:
     QMutex mutex;
+private Q_SLOTS:
+};
+
+class QBluetoothListenerThread : public QThread
+{
+    Q_OBJECT
+
+public:
+    QBluetoothListenerThread(QObject *parent = 0);
+    ~QBluetoothListenerThread();
+    bool keepRunning;
+
+public Q_SLOTS:
+    void emitBtPower(bool);
+    void stop();
+
+Q_SIGNALS:
+    void bluetoothPower(bool);
+
+protected:
+    void run();
+    IONotificationPortRef port;
+    CFRunLoopRef rl;
+    CFRunLoopSourceRef rls;
+
+private:
+    QMutex mutex;
 
 private Q_SLOTS:
 };