fixed model deviceCreated/Removed handling
authorKevron Rees <kevron_m_rees@linux.intel.com>
Wed, 8 Sep 2010 22:20:29 +0000 (15:20 -0700)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Wed, 8 Sep 2010 22:20:29 +0000 (15:20 -0700)
agentadaptor.h
audiosink.o [deleted file]
bluetooth-qt.pro
bluetooth-qt.pro.user
devicetypes.h [new file with mode: 0644]
nearbydevicesmodel.cpp
nearbydevicesmodel.h

index 00f662e..a071c8d 100644 (file)
@@ -15,7 +15,7 @@
 #define AGENTADAPTOR_H
 
 #include <QDBusAbstractAdaptor>
-#include "bluetoothagent.h"
+#include "bluetoothbaseagent.h"
 
 class AgentAdaptor : public QDBusAbstractAdaptor
 {
diff --git a/audiosink.o b/audiosink.o
deleted file mode 100644 (file)
index 99056ef..0000000
Binary files a/audiosink.o and /dev/null differ
index c8a3fbc..1416855 100644 (file)
@@ -6,3 +6,51 @@
 !exists(headset.h):system(qdbusxml2cpp -p headset.h:headset.cpp headset.xml)
 include(obex/obex.pri)
 
+TEMPLATE = lib
+TARGET = bluetooth-qt
+QT += dbus
+CONFIG += link_pkgconfig \
+       debug
+OTHER_FILES += McpBluetooth.conf \
+       manager.xml \
+       device.xml \
+       audiosrc.xml \
+       audiosink.xml \
+       adapter.xml \
+       headset.xml
+HEADERS += agentadaptor.h \
+       bluemanager.h \
+       bluedevice.h \
+       blueadapter.h \
+       audiosource.h \
+       audiosink.h \
+       headset.h \
+       btprofiles.h \
+       nearbydevicesmodel.h \
+       bluetoothbaseagent.h \
+       asyncagent.h \
+       devicetypes.h
+SOURCES += agentadaptor.cpp \
+       bluemanager.cpp \
+       bluedevice.cpp \
+       blueadapter.cpp \
+       audiosource.cpp \
+       audiosink.cpp \
+       headset.cpp \
+       nearbydevicesmodel.cpp \
+       bluetoothbaseagent.cpp \
+       asyncagent.cpp
+
+target.path = $$INSTALL_ROOT/usr/lib
+headers.path = $$INSTALL_ROOT/usr/include/bluetooth-qt/
+headers.files = $$HEADERS
+INSTALLS += target \
+       headers
+
+CONFIG += create_pc create_prl
+QMAKE_PKGCONFIG_DESCRIPTION = Qt Bluetooth Library
+QMAKE_PKGCONFIG_INCDIR = $$headers.path
+pkgconfig.path = $$INSTALL_ROOT/usr/lib/pkgconfig
+pkgconfig.files = bluetooth-qt.pc
+
+INSTALLS += pkgconfig
index da080d4..02f4308 100644 (file)
@@ -49,7 +49,7 @@
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/tripzero/src/bluetooth-qt-build-desktop</value>
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
    </valuemap>
    <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
     <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
diff --git a/devicetypes.h b/devicetypes.h
new file mode 100644 (file)
index 0000000..aa0267b
--- /dev/null
@@ -0,0 +1,24 @@
+/*  -*- Mode: C++ -*-
+ *
+ * meego handset bluetooth
+ * Copyright © 2010, Intel Corporation.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+
+
+#ifndef _DEVICETYPES_H_
+#define _DEVICETYPES_H_
+
+#include <QMap>
+
+typedef QMap<uint,QString> UIntStringMap;
+Q_DECLARE_METATYPE(UIntStringMap)
+
+
+
+#endif
index c3b3a73..00d07f5 100644 (file)
@@ -1,5 +1,5 @@
 #include "nearbydevicesmodel.h"
-#include "bluetoothagent.h"
+#include "bluetoothbaseagent.h"
 
 NearbyDevicesModel::NearbyDevicesModel(QObject *parent) :
        QAbstractListModel(parent), adapter(NULL), agent(NULL)
@@ -11,6 +11,11 @@ NearbyDevicesModel::NearbyDevicesModel(QObject *parent) :
        connect(manager,SIGNAL(AdapterAdded(QDBusObjectPath)),this,SLOT(adapterAdded(QDBusObjectPath)));
        connect(manager,SIGNAL(AdapterRemoved(QDBusObjectPath)),this,SLOT(adapterRemoved(QDBusObjectPath)));
        adapterAdded(QDBusObjectPath());
+
+       QHash<int,QByteArray> roles;
+       roles[Qt::DisplayRole]="name";
+
+       setRoleNames(roles);
 }
 
 
@@ -58,9 +63,11 @@ void NearbyDevicesModel::pair(QString hwaddy)
        //qDebug()<<"new object created: "<<object.path();
 }
 
-void NearbyDevicesModel::discover()
+void NearbyDevicesModel::discover(bool start)
 {
-       adapter->StartDiscovery();
+       if(start)
+               adapter->StartDiscovery();
+       else adapter->StopDiscovery();
 }
 
 void NearbyDevicesModel::removeAll(bool)
@@ -100,8 +107,8 @@ void NearbyDevicesModel::deviceCreated(QString hwaddy, QVariantMap properties)
 
        if(!found)
        {
-               beginInsertRows(QModelIndex(), 0, devicepathlist.size());
                devicepathlist.append(hwaddy);
+               beginInsertRows(QModelIndex(), devicepathlist.size(), devicepathlist.size());
                deviceAliasMap[hwaddy] = properties["Alias"].toString();
                emit nearbyDeviceFound(devicepathlist.indexOf(hwaddy));
                endInsertRows();
@@ -113,10 +120,10 @@ void NearbyDevicesModel::deviceRemoved(QString hwaddy)
        int i=-1;
        if((i = devicepathlist.indexOf(hwaddy)) >=0)
        {
-               beginRemoveRows(QModelIndex(),i,i+1);
+               beginRemoveRows(QModelIndex(),i,i);
                devicepathlist.removeAt(i);
                emit nearbyDeviceRemoved(i);
-               endInsertRows();
+               endRemoveRows();
        }
 
 }
index c82f474..9312a9a 100644 (file)
@@ -25,7 +25,7 @@ public slots:
        QString hwAddress(int index) { return devicepathlist[index]; }
        QString alias(int index){ return deviceAliasMap[devicepathlist[index]]; }
        void pair(QString hwaddy);
-       void discover();
+       void discover(bool start);
        void removeAll(bool);
 
        void replyRequestConfirmation(bool confirmed);