summaryrefslogtreecommitdiffstats
path: root/src/libtdebluez/objectmanagerImpl.cpp
blob: 96cb83e50eee0d292b92d653d78632ecd092898e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
/*
 *
 *  Object Manager implementation of bluez5
 *
 *  Copyright (C) 2018  Emanoil Kotsev <deloptes@gmail.com>
 *
 *
 *  This file is part of libtdebluez.
 *
 *  libtdebluez is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  libtdebluez is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with kbluetooth; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#include <tqstringlist.h>

#include <tqdbusmessage.h>
#include <tqdbusobjectpath.h>
#include <tqdbusdatamap.h>
#include <tqdbusdata.h>
#include <tqdbusdatalist.h>
#include <tqdbusvariant.h>

#include "objectmanagerImpl.h"
#include "btuuids.h"

namespace TDEBluetooth
{

ObjectManagerImpl::ObjectManagerImpl(const TQString& service, const TQString& path, TQObject* parent, const char* name) :
        ObjectManagerProxy(service, path, parent, name)
{
    agentManager = 0;
    profileManager = 0;
    healthManager  = 0;
    agentRegisteredStatus = false;
    agentIsDefaultAgent = false;
    // init connection to dbus
    initDBUS();
}

ObjectManagerImpl::~ObjectManagerImpl()
{
    // close D-Bus connection
    close();

    if(agentManager)
        delete agentManager;
    if(profileManager)
        delete profileManager;
    if(healthManager)
        delete healthManager;
}

/*!
 * This function try a reconnect to D-Bus.
 * \return boolean with the result of the operation
 * \retval true if successful reconnected to D-Bus
 * \retval false if unsuccessful
 */
bool ObjectManagerImpl::reconnect()
{
    // close D-Bus connection
    close();
    // init D-Bus conntection
    return (initDBUS());
}

/*!
 * This function return information about connection status to the DBUS daemon.
 * \return boolean with the state of the connection to D-Bus
 * \retval true if connected
 * \retval false if disconnected
 */
bool ObjectManagerImpl::isConnectedToDBUS()
{
    return dBusConn.isConnected();
}

/*!
 * This function returns pointer to connection of the DBUS.
 * \return TQT_DBusConnection* of the connection to D-Bus
 * \retval TQT_DBusConnection*
 */
TQT_DBusConnection* ObjectManagerImpl::getConnection()
{
    return &dBusConn;
}

/*!
 * This function close the connection to manager over the D-Bus daemon.
 * \return boolean with the result of the operation
 * \retval true if successful closed the connection
 * \retval false if any problems
 */
bool ObjectManagerImpl::close()
{
    disconnect(this, SIGNAL(InterfacesAdded(const TQT_DBusObjectPath&, const TQT_DBusDataMap< TQString >&)),
            this, SLOT(slotInterfacesAdded(const TQT_DBusObjectPath&, const TQT_DBusDataMap< TQString >& )));
    disconnect(this, SIGNAL(InterfacesRemoved(const TQT_DBusObjectPath& , const TQStringList& )),
            this, SLOT(slotInterfacesRemoved(const TQT_DBusObjectPath& , const TQStringList& )));

    for (PropertiesMap::iterator it = adapters.begin(); it != adapters.end();
            ++it)
    {
        org::freedesktop::DBus::PropertiesProxy *p;
        p = it.data();
        if (p != NULL)
            delete p;
    }
    for (PropertiesMap::iterator it = devices.begin(); it != devices.end();
            ++it)
    {
        org::freedesktop::DBus::PropertiesProxy *p;
        p = it.data();
        if (p != NULL)
            delete p;
    }
    adapters.clear();
    devices.clear();

    dBusConn.closeConnection(DBUS_CONN_NAME);
    return true;
}

/*!
 * This function initializes the connection to the D-Bus daemon.
 * \return pointer to AgentManager1Proxy
 */
AgentManager1Proxy * ObjectManagerImpl::getAgentManager()
{
    return agentManager;
}

/*!
 * This function initializes the connection to the D-Bus daemon.
 * \return pointer to ProfileManager1Proxy
 */
ProfileManager1Proxy * ObjectManagerImpl::getProfileManager()
{
    return profileManager;
}

/*!
 * This function initializes the connection to the D-Bus daemon.
 * \return pointer to HealthManager1Proxy
 */
HealthManager1Proxy * ObjectManagerImpl::getHealthManager()
{
    return healthManager;
}

/*!
 * This function returns a list of objectpaths
 * \return TQValueList<TQString>
 * \retval TQValueList<TQString>
 */
ObjectManagerImpl::AdapterList ObjectManagerImpl::getAdapters()
{
    return adapters.keys();
}

/*!
 * This function returns a list of objectpaths
 * \return TQValueList<TQString>
 * \retval TQValueList<TQString>
 */
ObjectManagerImpl::DeviceList ObjectManagerImpl::getDevices()
{
    return devices.keys();
}

ObjectManagerImpl::ConnectionList ObjectManagerImpl::listConnections(const TQString &adapter)
{
    ConnectionList list;
    return list;
}

bool ObjectManagerImpl::registerAgent()
{
    if (!agentRegisteredStatus)
    {
        TQT_DBusError dbuserror;
        agentManager->RegisterAgent(
                TQT_DBusObjectPath(TQCString(DBUS_AUTH_SERVICE_PATH)), DEVICE_PIN_CAPABILITY, dbuserror);
        if (dbuserror.isValid())
        {
            tqDebug(i18n("Could not register agent: %1").arg(dbuserror.message()));
            return false;
        }
        agentRegisteredStatus = true;
    }
    return true;
}

bool ObjectManagerImpl::unregisterAgent()
{
    kdDebug() << k_funcinfo << endl;
    if (agentRegisteredStatus)
    {
        TQT_DBusError dbuserror;
        getAgentManager()->UnregisterAgent(
                TQT_DBusObjectPath(TQCString(DBUS_AUTH_SERVICE_PATH)), dbuserror);
        if (dbuserror.isValid())
        {
            tqDebug(i18n("Could not unregister agent"));
            return false;
        }
        agentRegisteredStatus = false;
        agentIsDefaultAgent = false;
    }
    return true;
}

bool ObjectManagerImpl::requestDefaultAgent()
{
    TQT_DBusError dbuserror;
    agentManager->RequestDefaultAgent(
            TQT_DBusObjectPath(TQCString(DBUS_AUTH_SERVICE_PATH)), dbuserror);
    if (dbuserror.isValid())
    {
        tqDebug(i18n("Could not request default agent: %1").arg(dbuserror.message()));
        return false;
    }
    agentIsDefaultAgent = true;
    return true;
}

bool ObjectManagerImpl::isAgentRegistered()
{
    return agentRegisteredStatus;
}

bool ObjectManagerImpl::isAgentDefaultAgent()
{
    return agentIsDefaultAgent;
}

/*!
 * This function initializes the connection to the D-Bus daemon.
 * \return boolean with the result of the operation
 * \retval true if successful initialized D-Bus connection
 * \retval false if unsuccessful
 */
bool ObjectManagerImpl::initDBUS()
{
    dBusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus, DBUS_CONN_NAME);
    if (!dBusConn.isConnected())
    {
        tqDebug(i18n("Failed to open connection to system message bus: %1").arg(dBusConn.lastError().message()));
        TQTimer::singleShot(4000, this, TQT_SLOT(reconnect()));
        return false;
    }
    setConnection(dBusConn);

    TQT_DBusDataMap<TQT_DBusObjectPath> objects;
    TQT_DBusError dbuserror;
    if (!GetManagedObjects(objects, dbuserror))
    {
        tqDebug(i18n("GetManagedObjects(objects,error) failed: %1").arg(dbuserror.message()));
        return false;
    }

    TQT_DBusDataMap<TQT_DBusObjectPath>::const_iterator it = objects.begin();
    for (it; it != objects.end(); ++it)
    {
        bool ok = false;
        slotInterfacesAdded(it.key(), it.data().toStringKeyMap(&ok));
        if (!ok)
            tqWarning(i18n("Failed to convert dbus data to string map: %1").arg(it.key()));
    }

    connect(this, SIGNAL(InterfacesAdded(const TQT_DBusObjectPath&, const TQT_DBusDataMap< TQString >&)),
            this, SLOT(slotInterfacesAdded(const TQT_DBusObjectPath&, const TQT_DBusDataMap< TQString >& )));
    connect(this, SIGNAL(InterfacesRemoved(const TQT_DBusObjectPath& , const TQStringList& )),
            this, SLOT(slotInterfacesRemoved(const TQT_DBusObjectPath& , const TQStringList& )));

    return true;
}

void ObjectManagerImpl::adapterPropertiesChanged(TQString path, const TQMap<
        TQString, TQT_DBusVariant>& changed_properties)
{
    TQMap<TQString, TQT_DBusVariant>::const_iterator it;
    for (it = changed_properties.begin(); it != changed_properties.end(); ++it)
    {
        bool ok = false;
        if (it.key() == "Powered")
            emit adapterPowerOnChanged(path, it.data().value.toBool(&ok));
        else if (it.key() == "Class")
            emit adapterClassChanged(path, it.data().value.toUInt32(&ok));
        else if (it.key() == "Name")
            emit adapterNameChanged(path, it.data().value.toString(&ok));
        else if (it.key() == "Alias")
            emit adapterAliasChanged(path, it.data().value.toString(&ok));
        else if (it.key() == "DiscoverableTimeout")
            emit adapterDiscoverableTimeoutChanged(path, it.data().value.toUInt32(&ok));
        else if (it.key() == "Discoverable")
            emit adapterDiscoverableChanged(path, it.data().value.toBool(&ok));
        else if (it.key() == "Discovering")
            emit adapterDiscoveringChanged(path, it.data().value.toBool(&ok));
        else
            continue;
        if (!ok)
            tqDebug(i18n("ObjectManagerImpl::adapterPropertiesChanged conversion failed"));
    }
}

void ObjectManagerImpl::devicePropertiesChanged(TQString path, const TQMap<TQString, TQT_DBusVariant>& changed_properties)
{
    //  https://github.com/r10r/bluez/blob/master/doc/device-api.txt
    TQMap<TQString, TQT_DBusVariant>::const_iterator it;
    for (it = changed_properties.begin(); it != changed_properties.end(); ++it)
    {
        bool ok = false;
        if (it.key() == "Address")
            emit deviceAddressChanged(path, it.data().value.toString(&ok));
        else if (it.key() == "Class")
            emit deviceClassChanged(path, it.data().value.toUInt32(&ok));
        else if (it.key() == "Name")
            emit deviceNameChanged(path, it.data().value.toString(&ok));
        else if (it.key() == "Alias")
            emit deviceAliasChanged(path, it.data().value.toString(&ok));
//      https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml
        else if (it.key() == "Appearance")
            emit deviceAppearanceChanged(path, it.data().value.toUInt16(&ok));
        else if (it.key() == "Icon")
            emit deviceIconChanged(path, it.data().value.toString(&ok));
        else if (it.key() == "Paired")
            emit devicePairedChanged(path, it.data().value.toBool(&ok));
        else if (it.key() == "Trusted")
            emit deviceTrustedChanged(path, it.data().value.toBool(&ok));
        else if (it.key() == "Blocked")
            emit deviceBlockedChanged(path, it.data().value.toBool(&ok));
        else if (it.key() == "LegacyPairing")
            emit deviceLegacyPairingChanged(path, it.data().value.toBool(&ok));
        else if (it.key() == "RSSI")
            emit deviceRSSIChanged(path, it.data().value.toInt16(&ok)); //INT16
        else if (it.key() == "Connected")
            emit deviceConnectedChanged(path, it.data().value.toBool(&ok));
        else if (it.key() == "UUIDs")
        {
            TQT_DBusDataList vl = TQT_DBusDataList(it.data().value.toTQValueList(&ok));
            emit deviceUUIDsChanged(path, vl.toStringList(&ok));
        }
        else if (it.key() == "Adapter")
            emit deviceAdapterChanged(path, it.data().value.toObjectPath(&ok));
        else if (it.key() == "ManufacturerData")
            emit deviceManufacturerDataChanged(path, it.data().value.toUInt16KeyMap(&ok)); //a{qv}
        else if (it.key() == "ServiceData")
            emit deviceServiceDataChanged(path, it.data().value.toStringKeyMap(&ok)); //a{sv}
        else if (it.key() == "TxPower")
            emit deviceTxPowerChanged(path, it.data().value.toInt16(&ok)); //INT16
        else if (it.key() == "ServicesResolved")
            emit deviceServicesResolvedChanged(path, it.data().value.toBool(&ok));
        else
            continue;
        if (!ok)
            tqDebug(i18n("ObjectManagerImpl::devicePropertiesChanged conversion failed"));
    }

}

void ObjectManagerImpl::mediaControlPropertiesChanged(TQString path, const TQMap<TQString, TQT_DBusVariant>& changed_properties)
{
    TQMap<TQString, TQT_DBusVariant>::const_iterator it;
    for (it = changed_properties.begin(); it != changed_properties.end(); ++it)
    {
        bool ok = false;
        if (it.key() == "Connected")
            emit mediaControlConnectedChanged(path, it.data().value.toBool(&ok));
        else if (it.key() == "Player")
            emit mediaControlPlayerChanged(path, it.data().value.toObjectPath(&ok));
        else
            continue;
        if (!ok)
            tqDebug(i18n("ObjectManagerImpl::mediaControlPropertiesChanged conversion failed"));
    }
}

void ObjectManagerImpl::slotInterfacesAdded(const TQT_DBusObjectPath& object, const TQT_DBusDataMap<TQString>& interfaces)
{
    TQT_DBusDataMap<TQString>::const_iterator it1 = interfaces.begin();
    for (it1; it1 != interfaces.end(); it1++)
    {
        TQString interface = it1.key();
        if (interface == "org.bluez.AgentManager1")
        {
            agentManager = new AgentManager1Proxy("org.bluez", object/*, this, "AgentManager1"*/);
            if (agentManager)
                agentManager->setConnection(dBusConn);
        }
        else if (interface == "org.bluez.ProfileManager1")
        {
            profileManager = new ProfileManager1Proxy("org.bluez", object/*, this, "ProfileManager1"*/);
            if (profileManager)
                profileManager->setConnection(dBusConn);
        }
        else if (interface == "org.bluez.HealthManager1")
        {
            healthManager = new HealthManager1Proxy("org.bluez", object/*, this, "HealthManager1"*/);
            if (healthManager)
                healthManager->setConnection(dBusConn);
        }
        else if (interface == "org.bluez.Adapter1")
        {
            org::freedesktop::DBus::PropertiesProxy *properties;
            properties = new org::freedesktop::DBus::PropertiesProxy("org.bluez", object);
            properties->setConnection(dBusConn);
            connect(properties, SIGNAL(PropertiesChanged ( const TQString&, const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& )), this, SLOT(slotPropertiesChanged ( const TQString& , const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& )));
            adapters.insert(TQString(object), properties);
            //notify others
            emit adapterAdded(TQString(object));
        }
        else if (interface == "org.bluez.GattManager1")
        {
            kdDebug() << "Interface not implemented: org.bluez.GattManager1" << endl;
            // TODO: Implement GattManager1
        }
        else if (interface == "org.bluez.Media1")
        {
            kdDebug() << "Interface not implemented: org.bluez.Media1" << endl;
            // TODO: Implement Media1
        }
        else if (interface == "org.bluez.NetworkServer1")
        {
            kdDebug() << "Interface not implemented: org.bluez.NetworkServer1" << endl;
            // TODO: Implement NetworkServer1
        }
        else if (interface == "org.bluez.Device1")
        {
            org::freedesktop::DBus::PropertiesProxy *properties;
            properties = new org::freedesktop::DBus::PropertiesProxy("org.bluez", object);
            properties->setConnection(dBusConn);
            connect(properties, SIGNAL(PropertiesChanged ( const TQString&, const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& )), this, SLOT(slotPropertiesChanged ( const TQString& , const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& )));
            devices.insert(TQString(object), properties);
            //notify others
            emit deviceAdded(TQString(object));
        }
        else if (interface == "org.bluez.MediaControl1")
        {
            kdDebug() << "Interface not implemented: org.bluez.MediaControl1" << endl;
            kdDebug() << "as the media control is triggered via properties changed." << endl;
        }
        else if (interface == "org.bluez.MediaTransport1")
        {
            kdDebug() << "Interface not implemented: org.bluez.MediaTransport1" << endl;
            // TODO: Implement MediaTransport1
        }
        else if (interface == "org.freedesktop.DBus.Introspectable")
        {
            // do nothing
        }
        else if (interface == "org.freedesktop.DBus.Properties")
        {
            // do nothing
        }
        else
        {
            tqWarning(i18n("Interface not implemented: %1").arg(interface));
        }
    }
}

void ObjectManagerImpl::slotInterfacesRemoved(const TQT_DBusObjectPath& object, const TQStringList& interfaces)
{
    // TODO: remove interface
    for (TQValueListConstIterator<TQString> it = interfaces.begin();
            it != interfaces.end(); ++it)
    {
        if ((*it) == "org.bluez.AgentManager1")
        {
            kdDebug() << "Remove org.bluez.AgentManager1" << endl;
            // TODO: remove AgentManager1
        }
        else if ((*it) == "org.bluez.ProfileManager1")
        {
            kdDebug() << "Interface not implemented: org.bluez.ProfileManager1" << endl;
            // TODO: remove ProfileManager1
        }
        else if ((*it) == "org.bluez.HealthManager1")
        {
            kdDebug() << "Interface not implemented: org.bluez.HealthManager1" << endl;
            // TODO: remove HealthManager1
        }
        else if ((*it) == "org.bluez.Adapter1")
        {
            kdDebug() << "Remove org.bluez.Adapter1" << endl;
            disconnect(adapters[object], SIGNAL(PropertiesChanged ( const TQString&, const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& )), this, SLOT(slotPropertiesChanged ( const TQString& , const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& )));
            adapters.remove(object);
            emit adapterRemoved(TQString(object));
        }
        else if ((*it) == "org.bluez.GattManager1")
        {
            kdDebug() << "Interface not implemented: org.bluez.GattManager1" << endl;
            // TODO: Implement GattManager1
        }
        else if ((*it) == "org.bluez.Media1")
        {
            kdDebug() << "Interface not implemented: org.bluez.Media1" << endl;
            // TODO: Implement Media1
        }
        else if ((*it) == "org.bluez.NetworkServer1")
        {
            kdDebug() << "Interface not implemented: org.bluez.NetworkServer1" << endl;
            // TODO: Implement NetworkServer1
        }
        else if ((*it) == "org.bluez.Device1")
        {
            kdDebug() << "Remove org.bluez.Device1" << endl;
            disconnect(devices[object], SIGNAL(PropertiesChanged ( const TQString&, const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& )), this, SLOT(slotPropertiesChanged ( const TQString& , const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& )));
            devices.remove(object);
            emit deviceRemoved(TQString(object));
        }
        else if ((*it) == "org.bluez.MediaControl1")
        {
            kdDebug() << "Interface not implemented: org.bluez.MediaControl1" << endl;
            kdDebug() << "as the media control is triggered via properties changed." << endl;
            //    		emit mediaControlRemoved(TQString ( object.data() ));
        }
        else if ((*it) == "org.freedesktop.DBus.Introspectable")
        {
            // do nothing
        }
        else if ((*it) == "org.freedesktop.DBus.Properties")
        {
            // do nothing
        }
        else
        {
            tqWarning(i18n("Interface not implemented: %1").arg((*it)));
        }
    }
}

void ObjectManagerImpl::slotPropertiesChanged(const TQString& interface, const TQMap<TQString, TQT_DBusVariant>& changed_properties, const TQStringList& invalidated_properties)
{
    // who send the signal ?
    const TQObject * o = TQObject::sender();
    org::freedesktop::DBus::PropertiesProxy *obj;
    obj = const_cast<org::freedesktop::DBus::PropertiesProxy*>(reinterpret_cast<const org::freedesktop::DBus::PropertiesProxy*>(o));
    TQString path;

    if (interface == "org.bluez.Adapter1")
    {
        for (PropertiesMap::Iterator it = adapters.begin();
                it != adapters.end(); ++it)
        {
            if (obj == it.data())
                path = it.key();
        }
        if (!path.isEmpty())
            adapterPropertiesChanged(path, changed_properties);
    }
    else if (interface == "org.bluez.Device1")
    {
        for (PropertiesMap::Iterator it = devices.begin(); it != devices.end();
                ++it)
        {
            if (obj == it.data())
                path = it.key();
        }
        if (!path.isEmpty())
            devicePropertiesChanged(path, changed_properties);
    }
    else if (interface == "org.bluez.MediaControl1")
    {
        for (PropertiesMap::Iterator it = devices.begin(); it != devices.end();
                ++it)
        {
            if (obj == it.data())
                path = it.key();
        }
        if (!path.isEmpty())
            mediaControlPropertiesChanged(path, changed_properties);
    }

//			TQStringList::const_iterator it1;
//			for ( it1 = invalidated_properties.begin(); it1 != invalidated_properties.end(); ++it1 )
//			{
//				kdDebug() << "Invalidated Key: " << (*it1) << endl;
////				if ( it.key() == "Powered" )
////					emit powerOnChanged(TQT_DBusData::fromVariant ( it.data() ).toBool());
////				if ( it.key() == "DiscoverableTimeout" )
////					emit discoverableTimeoutChanged(TQT_DBusData::fromVariant ( it.data() ).toUInt32());
////				if ( it.key() == "Discoverable" )
////					emit discoverableTimeoutChanged(TQT_DBusData::fromVariant ( it.data() ).toBool());
//			}

}

}; // namespace TDEBluetooth

#include "objectmanagerImpl.moc"
// End of File