author | harlekin <harlekin> | 2002-06-19 20:36:50 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-19 20:36:50 (UTC) |
commit | 6afbacb8353e539b9e6d279d20220445614b42c2 (patch) (unidiff) | |
tree | 54f0c631c596c743e793cd25ae548c5bc17827e0 /noncore/net/opietooth | |
parent | dd53a68602f625e02188411d4469f2ec13e1dae8 (diff) | |
download | opie-6afbacb8353e539b9e6d279d20220445614b42c2.zip opie-6afbacb8353e539b9e6d279d20220445614b42c2.tar.gz opie-6afbacb8353e539b9e6d279d20220445614b42c2.tar.bz2 |
update
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 76 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 5 |
2 files changed, 60 insertions, 21 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 22b16d2..c7e1fe4 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -50,11 +50,13 @@ namespace OpieTooth { | |||
50 | 50 | ||
51 | localDevice = new Manager( "hci0" ); | ||
51 | 52 | ||
52 | QObject::connect( (QObject*)PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); | 53 | QObject::connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); |
53 | QObject::connect( (QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); | 54 | QObject::connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); |
54 | QObject::connect( (QObject*)ListView2, SIGNAL( expanded( QListViewItem * item ) ), | 55 | QObject::connect( ListView2, SIGNAL( expanded( QListViewItem * item ) ), |
55 | this, SLOT( addServicesToDevice( QListViewItem * item ) ) ); | 56 | this, SLOT( addServicesToDevice( QListViewItem * item ) ) ); |
56 | QObject::connect( (QObject*)ListView2, SIGNAL( clicked( QListViewItem * )), | 57 | QObject::connect( ListView2, SIGNAL( clicked( QListViewItem * )), |
57 | this, SLOT( startServiceActionClicked( QListViewItem * item ) ) ); | 58 | this, SLOT( startServiceActionClicked( QListViewItem * item ) ) ); |
59 | connect( localDevice, SIGNAL( foundServices( const QString& device, Services::ValueList ) ), | ||
60 | this, SLOT( addServicesToDevice( const QString& device, Services::ValueList ) ) ); | ||
58 | 61 | ||
59 | // | ||
60 | // QObject::connect( (QObject*) Manager, SIGNAL (foundServices( const QString& device, Services::ValueList ), this () ) ); | 62 | // QObject::connect( (QObject*) Manager, SIGNAL (foundServices( const QString& device, Services::ValueList ), this () ) ); |
@@ -142,3 +144,3 @@ namespace OpieTooth { | |||
142 | 144 | ||
143 | Config deviceList( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); | 145 | Config deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); |
144 | 146 | ||
@@ -159,14 +161,7 @@ namespace OpieTooth { | |||
159 | 161 | ||
160 | // one top conf file with all decices (by mac adress) | ||
161 | Config deviceList( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); | ||
162 | |||
163 | for ( ; it.current(); ++it ) { | 162 | for ( ; it.current(); ++it ) { |
164 | 163 | ||
165 | // MAC adress as group | ||
166 | deviceList.setGroup( it.current()->text(1) ); | ||
167 | deviceList.writeEntry("inList", 1); | ||
168 | |||
169 | // seperate config file for each device, to store more information in future. | 164 | // seperate config file for each device, to store more information in future. |
170 | 165 | ||
171 | Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (it.current()->text(1)) + ".conf", Config::File ); | 166 | Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (it.current()->text(3)) + ".conf", Config::File ); |
172 | conf.setGroup("Info"); | 167 | conf.setGroup("Info"); |
@@ -249,8 +244,8 @@ namespace OpieTooth { | |||
249 | if (deviceActive( dev ) ) { | 244 | if (deviceActive( dev ) ) { |
250 | deviceItem->setPixmap(0, onPix); | 245 | deviceItem->setPixmap( 1 , onPix ); |
251 | } else { | 246 | } else { |
252 | deviceItem->setPixmap(0, offPix); | 247 | deviceItem->setPixmap( 1, offPix ); |
253 | } | 248 | } |
254 | 249 | ||
255 | deviceItem->setText(1, dev->mac() ); | 250 | deviceItem->setText( 3, dev->mac() ); |
256 | } | 251 | } |
@@ -280,6 +275,10 @@ namespace OpieTooth { | |||
280 | void BlueBase::addServicesToDevice( QListViewItem * item ) { | 275 | void BlueBase::addServicesToDevice( QListViewItem * item ) { |
276 | |||
281 | // row of mac adress | 277 | // row of mac adress |
282 | RemoteDevice *device = new RemoteDevice(item->text(1), item->text(0)); | 278 | RemoteDevice *device = new RemoteDevice(item->text(3), item->text(0)); |
283 | //dann nen manager und darauf dann searchServises, das liefert nen signal, das wieder connected | 279 | |
284 | // werden muss. | 280 | deviceList.insert( item->text(3) , item ); |
281 | |||
282 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back | ||
283 | localDevice->searchServices( *device ); | ||
285 | 284 | ||
@@ -288,2 +287,37 @@ namespace OpieTooth { | |||
288 | 287 | ||
288 | |||
289 | /** | ||
290 | * Overloaded. This one it the one that is connected to the foundServices signal | ||
291 | * @param device the mac address of the remote device | ||
292 | * @param servicesList the list with the service the device has. | ||
293 | */ | ||
294 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { | ||
295 | |||
296 | qDebug("fill services list"); | ||
297 | |||
298 | |||
299 | QMap<QString,QListViewItem*>::Iterator it; | ||
300 | |||
301 | QListViewItem* deviceItem; | ||
302 | |||
303 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { | ||
304 | if (it.key() == device ) { | ||
305 | deviceItem = it.data(); | ||
306 | } | ||
307 | } | ||
308 | |||
309 | QValueList<OpieTooth::Services>::Iterator it2; | ||
310 | |||
311 | |||
312 | |||
313 | QListViewItem * serviceItem; | ||
314 | |||
315 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { | ||
316 | it2.serviceName() | ||
317 | serviceItem = new QListViewItem( deviceItem , it2.serviceName() ); | ||
318 | } | ||
319 | |||
320 | } | ||
321 | |||
322 | |||
289 | /* | 323 | /* |
@@ -292,3 +326,2 @@ namespace OpieTooth { | |||
292 | bool BlueBase::deviceActive( RemoteDevice *device ) { | 326 | bool BlueBase::deviceActive( RemoteDevice *device ) { |
293 | |||
294 | return true; | 327 | return true; |
@@ -296,2 +329,3 @@ namespace OpieTooth { | |||
296 | 329 | ||
330 | |||
297 | /** | 331 | /** |
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 7b03f82..dcb7681 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -13,3 +13,5 @@ | |||
13 | 13 | ||
14 | |||
14 | #include <remotedevice.h> | 15 | #include <remotedevice.h> |
16 | #include <manager.h> | ||
15 | 17 | ||
@@ -50,2 +52,4 @@ namespace OpieTooth { | |||
50 | void setInfo(); | 52 | void setInfo(); |
53 | Manager *localDevice; | ||
54 | QMap<QString,QListViewItem*> deviceList; | ||
51 | 55 | ||
@@ -66,2 +70,3 @@ namespace OpieTooth { | |||
66 | void addServicesToDevice( QListViewItem * item ); | 70 | void addServicesToDevice( QListViewItem * item ); |
71 | void addServicesToDevice( const QString& device, Services::ValueList ); | ||
67 | void startServiceActionClicked( QListViewItem * item ); | 72 | void startServiceActionClicked( QListViewItem * item ); |