2
* Copyright © 2012-2013 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Thomas Voß <thomas.voss@canonical.com>
19
#include <com/ubuntu/location/connectivity/radio_cell.h>
21
namespace location = com::ubuntu::location;
23
bool location::connectivity::operator==(const location::connectivity::RadioCell::Gsm& lhs,
24
const location::connectivity::RadioCell::Gsm& rhs)
26
return lhs.mobile_country_code == rhs.mobile_country_code &&
27
lhs.mobile_network_code == rhs.mobile_network_code &&
28
lhs.location_area_code == rhs.location_area_code &&
30
lhs.strength == rhs.strength;
33
std::ostream& location::connectivity::operator<<(std::ostream& out, const location::connectivity::RadioCell::Gsm& gsm)
36
<< "mcc: " << gsm.mobile_country_code << ", "
37
<< "mnc: " << gsm.mobile_network_code << ", "
38
<< "lac: " << gsm.location_area_code << ", "
39
<< "id: " << gsm.id << ", "
40
<< "asu: " << gsm.strength << ")";
45
bool location::connectivity::operator==(const location::connectivity::RadioCell::Umts& lhs, const location::connectivity::RadioCell::Umts& rhs)
47
return lhs.mobile_country_code == rhs.mobile_country_code &&
48
lhs.mobile_network_code == rhs.mobile_network_code &&
49
lhs.location_area_code == rhs.location_area_code &&
51
lhs.strength == rhs.strength;
54
std::ostream& location::connectivity::operator<<(std::ostream& out, const location::connectivity::RadioCell::Umts& umts)
57
<< "mcc: " << umts.mobile_country_code << ", "
58
<< "mnc: " << umts.mobile_network_code << ", "
59
<< "lac: " << umts.location_area_code << ", "
60
<< "id: " << umts.id << ", "
61
<< "asu: " << umts.strength << ")";
66
bool location::connectivity::operator==(const location::connectivity::RadioCell::Lte& lhs,
67
const location::connectivity::RadioCell::Lte& rhs)
69
return lhs.mobile_country_code == rhs.mobile_country_code &&
70
lhs.mobile_network_code == rhs.mobile_network_code &&
71
lhs.tracking_area_code == rhs.tracking_area_code &&
73
lhs.physical_id == rhs.physical_id &&
74
lhs.strength == rhs.strength;
77
std::ostream& location::connectivity::operator<<(std::ostream& out, const location::connectivity::RadioCell::Lte& lte)
80
<< "mcc: " << lte.mobile_country_code << ", "
81
<< "mnc: " << lte.mobile_network_code << ", "
82
<< "lac: " << lte.tracking_area_code << ", "
83
<< "id: " << lte.id << ", "
84
<< "id: " << lte.physical_id << ", "
85
<< "asu: " << lte.strength << ")";
90
bool location::connectivity::operator==(const location::connectivity::RadioCell& lhs,
91
const location::connectivity::RadioCell& rhs)
93
if (lhs.type() != rhs.type())
98
case location::connectivity::RadioCell::Type::gsm: return lhs.gsm() == rhs.gsm();
99
case location::connectivity::RadioCell::Type::umts: return lhs.umts() == rhs.umts();
100
case location::connectivity::RadioCell::Type::lte: return lhs.lte() == rhs.lte();
101
default: return true;
107
std::ostream& location::connectivity::operator<<(std::ostream& out, const location::connectivity::RadioCell& cell)
111
case location::connectivity::RadioCell::Type::gsm: out << "gsm" << cell.gsm(); break;
112
case location::connectivity::RadioCell::Type::umts: out << "umts" << cell.umts(); break;
113
case location::connectivity::RadioCell::Type::lte: out << "lte" << cell.lte(); break;
114
case location::connectivity::RadioCell::Type::unknown: break;