1 /*
2     Copyright 2006 Davide Bettio <davide.bettio@kdemail.net>
3     Copyright 2007 Jeff Mitchell <kde-dev@emailgoeshere.com>
4 
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) version 3, or any
9     later version accepted by the membership of KDE e.V. (or its
10     successor approved by the membership of KDE e.V.), which shall
11     act as a proxy defined in Section 6 of version 3 of the license.
12 
13     This library is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16     Lesser General Public License for more details.
17 
18     You should have received a copy of the GNU Lesser General Public
19     License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include "halportablemediaplayer.h"
23 
24 using namespace Solid::Backends::Hal;
25 
PortableMediaPlayer(HalDevice * device)26 PortableMediaPlayer::PortableMediaPlayer(HalDevice *device)
27     : DeviceInterface(device)
28 {
29 
30 }
31 
~PortableMediaPlayer()32 PortableMediaPlayer::~PortableMediaPlayer()
33 {
34 
35 }
36 
supportedProtocols() const37 QStringList PortableMediaPlayer::supportedProtocols() const
38 {
39     return m_device->prop("portable_audio_player.access_method.protocols").toStringList();
40 }
41 
supportedDrivers(QString protocol) const42 QStringList PortableMediaPlayer::supportedDrivers(QString protocol) const
43 {
44     QStringList drivers = m_device->prop("portable_audio_player.access_method.drivers").toStringList();
45     if(protocol.isNull())
46         return drivers;
47     QStringList returnedDrivers;
48     QString temp;
49     for(int i = 0; i < drivers.size(); i++)
50     {
51         temp = drivers.at(i);
52         if(m_device->prop("portable_audio_player." + temp + ".protocol") == protocol)
53             returnedDrivers << temp;
54     }
55     return returnedDrivers;
56 }
57 
driverHandle(const QString & driver) const58 QVariant PortableMediaPlayer::driverHandle(const QString &driver) const
59 {
60     if (driver=="mtp") {
61         return m_device->prop("usb.serial");
62     }
63     // TODO: Fill in the blank for other drivers
64 
65     return QVariant();
66 }
67 
68 #include "backends/hal/moc_halportablemediaplayer.cpp"
69