~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to solid/modemmanager-0.4/dbus/generic-types.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright 2010 Lamarque Souza <lamarque@gmail.com>
 
3
 
 
4
   This program is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU General Public License as
 
6
   published by the Free Software Foundation; either version 2 of
 
7
   the License or (at your option) version 3 or any later version
 
8
   accepted by the membership of KDE e.V. (or its successor approved
 
9
   by the membership of KDE e.V.), which shall act as a proxy
 
10
   defined in Section 14 of version 3 of the license.
 
11
 
 
12
   This program 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
 
15
   GNU General Public License for more details.
 
16
 
 
17
   You should have received a copy of the GNU General Public License
 
18
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
*/
 
20
 
 
21
#include "generic-types.h"
 
22
 
 
23
// Marshall the Solid::Control::Ip4ConfigType data into a D-BUS argument
 
24
QDBusArgument &operator << (QDBusArgument &arg,
 
25
    const Solid::Control::ModemInterface::Ip4ConfigType &config)
 
26
{
 
27
    arg.beginStructure();
 
28
    arg << config.ip4Address << config.dns1 << config.dns2 << config.dns3;
 
29
    arg.endStructure();
 
30
    return arg;
 
31
}
 
32
 
 
33
// Retrieve the Solid::Control::Ip4ConfigType data from the D-BUS argument
 
34
const QDBusArgument &operator >> (const QDBusArgument &arg,
 
35
    Solid::Control::ModemInterface::Ip4ConfigType &config)
 
36
{
 
37
    arg.beginStructure();
 
38
    arg >> config.ip4Address >> config.dns1 >> config.dns2 >> config.dns3;
 
39
    arg.endStructure();
 
40
 
 
41
    return arg;
 
42
}
 
43
 
 
44
// Marshall the Solid::Control::ModemManager::Modem::InfoType data into a D-BUS argument
 
45
QDBusArgument &operator << (QDBusArgument &arg,
 
46
    const Solid::Control::ModemInterface::InfoType &info)
 
47
{
 
48
    arg.beginStructure();
 
49
    arg << info.manufacturer << info.model << info.version;
 
50
    arg.endStructure();
 
51
    return arg;
 
52
}
 
53
 
 
54
// Retrieve the Solid::Control::ModemManager::Modem::InfoType data from the D-BUS argument
 
55
const QDBusArgument &operator >> (const QDBusArgument &arg,
 
56
    Solid::Control::ModemInterface::InfoType &info)
 
57
{
 
58
    arg.beginStructure();
 
59
    arg >> info.manufacturer >> info.model >> info.version;
 
60
    arg.endStructure();
 
61
    return arg;
 
62
}
 
63
 
 
64
// Marshall the Solid::Control::ModemCdmaInterface::ServingSystemType data into a D-BUS argument
 
65
QDBusArgument &operator << (QDBusArgument &arg,
 
66
    const Solid::Control::ModemCdmaInterface::ServingSystemType &servingSystem)
 
67
{
 
68
    arg.beginStructure();
 
69
    arg << servingSystem.bandClass << servingSystem.band << servingSystem.systemId;
 
70
    arg.endStructure();
 
71
    return arg;
 
72
}
 
73
 
 
74
// Retrieve the Solid::Control::ModemCdmaInterface::ServingSystemType data from the D-BUS argument
 
75
const QDBusArgument &operator >> (const QDBusArgument &arg,
 
76
    Solid::Control::ModemCdmaInterface::ServingSystemType &servingSystem)
 
77
{
 
78
    uint temp;
 
79
    arg.beginStructure();
 
80
    arg >> temp >> servingSystem.band >> servingSystem.systemId;
 
81
    servingSystem.bandClass = (Solid::Control::ModemCdmaInterface::BandClass) temp;
 
82
    arg.endStructure();
 
83
    return arg;
 
84
}
 
85
 
 
86
// Marshall the Solid::Control::ModemGsmContactsInterface::ContactType data into a D-BUS argument
 
87
QDBusArgument &operator << (QDBusArgument &arg,
 
88
    const Solid::Control::ModemGsmContactsInterface::ContactType &contact)
 
89
{
 
90
    arg.beginStructure();
 
91
    arg << contact.index << contact.name << contact.number;
 
92
    arg.endStructure();
 
93
    return arg;
 
94
}
 
95
 
 
96
// Retrieve the Solid::Control::ModemGsmContactsInterface::ContactType data from the D-BUS argument
 
97
const QDBusArgument &operator >> (const QDBusArgument &arg,
 
98
    Solid::Control::ModemGsmContactsInterface::ContactType &contact)
 
99
{
 
100
    arg.beginStructure();
 
101
    arg >> contact.index >> contact.name >> contact.number;
 
102
    arg.endStructure();
 
103
    return arg;
 
104
}
 
105
 
 
106
// Marshall the RegistrationInfoType data into a D-BUS argument
 
107
QDBusArgument &operator << (QDBusArgument &arg,
 
108
    const Solid::Control::ModemGsmNetworkInterface::RegistrationInfoType &info)
 
109
{
 
110
    uint temp;
 
111
 
 
112
    temp = (uint) info.status;
 
113
    arg.beginStructure();
 
114
    arg << temp << info.operatorCode << info.operatorName;
 
115
    arg.endStructure();
 
116
    return arg;
 
117
}
 
118
 
 
119
// Retrieve the RegistrationInfoType data from the D-BUS argument
 
120
const QDBusArgument &operator >> (const QDBusArgument &arg,
 
121
    Solid::Control::ModemGsmNetworkInterface::RegistrationInfoType &info)
 
122
{
 
123
    uint temp;
 
124
 
 
125
    arg.beginStructure();
 
126
    arg >> temp >> info.operatorCode >> info.operatorName;
 
127
    info.status = (Solid::Control::ModemGsmNetworkInterface::RegistrationStatus) temp;
 
128
    arg.endStructure();
 
129
    return arg;
 
130
}