add more spacing
[personal-kdebase.git] / workspace / libs / solid / control / backends / fakenet / fakeaccesspoint.cpp
blobeda6a00c487ab44047a7de567bec42d1a8a5cf4c
1 /*
2 Copyright 2008 Will Stephenson <wstephenson@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) version 3, or any
8 later version accepted by the membership of KDE e.V. (or its
9 successor approved by the membership of KDE e.V.), which shall
10 act as a proxy defined in Section 6 of version 3 of the license.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 #include "fakeaccesspoint.h"
23 FakeAccessPoint::FakeAccessPoint( const QMap<QString, QVariant> & propertyMap,
24 QObject * parent)
25 : Solid::Control::Ifaces::AccessPoint( parent ), mPropertyMap(propertyMap)
29 FakeAccessPoint::~FakeAccessPoint()
34 // PHY stuff
35 QString FakeAccessPoint::uni() const
37 return mPropertyMap["uni"].toString();
41 QString FakeAccessPoint::ssid() const
43 return mPropertyMap["ssid"].toString();
47 uint FakeAccessPoint::frequency() const
49 return mPropertyMap["frequency"].toUInt();
52 QString FakeAccessPoint::hardwareAddress() const
54 return mPropertyMap["hwaddress"].toString();
57 uint FakeAccessPoint::maxBitRate() const
59 return mPropertyMap["maxbitrate"].toUInt();
62 int FakeAccessPoint::signalStrength() const
64 return mPropertyMap["signalstrength"].toInt();
67 Solid::Control::AccessPoint::WpaFlags FakeAccessPoint::wpaFlags() const
69 return wpaPropsToFlags( "wpaflags" );
72 Solid::Control::AccessPoint::WpaFlags FakeAccessPoint::rsnFlags() const
74 return wpaPropsToFlags( "rsnflags" );
77 Solid::Control::AccessPoint::WpaFlags FakeAccessPoint::wpaPropsToFlags( const QString & property ) const
79 QStringList capStrings = mPropertyMap[property].toStringList();
81 Solid::Control::AccessPoint::WpaFlags caps = 0;
82 if (capStrings.contains("pairwep40"))
83 caps |= Solid::Control::AccessPoint::PairWep40;
84 if (capStrings.contains("pairweb104"))
85 caps |= Solid::Control::AccessPoint::PairWep104;
86 if (capStrings.contains("pairtkip"))
87 caps |= Solid::Control::AccessPoint::PairTkip;
88 if (capStrings.contains("pairccmp"))
89 caps |= Solid::Control::AccessPoint::PairCcmp;
90 if (capStrings.contains("groupwep40"))
91 caps |= Solid::Control::AccessPoint::GroupWep40;
92 if (capStrings.contains("groupweb104"))
93 caps |= Solid::Control::AccessPoint::GroupWep104;
94 if (capStrings.contains("grouptkip"))
95 caps |= Solid::Control::AccessPoint::GroupTkip;
96 if (capStrings.contains("groupccmp"))
97 caps |= Solid::Control::AccessPoint::GroupCcmp;
98 if (capStrings.contains("keypsk"))
99 caps |= Solid::Control::AccessPoint::KeyMgmtPsk;
100 if (capStrings.contains("key8021x"))
101 caps |= Solid::Control::AccessPoint::KeyMgmt8021x;
102 return caps;
105 Solid::Control::AccessPoint::Capabilities FakeAccessPoint::capabilities() const
107 //TODO
108 QStringList capStrings = mPropertyMap["capabilities"].toStringList();
110 Solid::Control::AccessPoint::Capabilities caps = 0;
111 if (capStrings.contains("privacy"))
112 caps |= Solid::Control::AccessPoint::Privacy;
113 return caps;
116 Solid::Control::WirelessNetworkInterface::OperationMode FakeAccessPoint::mode() const
118 QString modeName = mPropertyMap["mode"].toString();
120 if (modeName == "adhoc")
121 return Solid::Control::WirelessNetworkInterface::Adhoc;
122 else if (modeName == "managed")
123 return Solid::Control::WirelessNetworkInterface::Managed;
124 else if (modeName == "master")
125 return Solid::Control::WirelessNetworkInterface::Master;
126 else if (modeName == "repeater")
127 return Solid::Control::WirelessNetworkInterface::Repeater;
128 else
129 return Solid::Control::WirelessNetworkInterface::Unassociated;
132 #include "fakeaccesspoint.moc"