Move ParseConnection*() to connection_utils.
We don't need real_shill_provider if USE_DBUS is 0, but we still need
these functions, and they have a duplicate copy in connection_manager,
so put them in utils and deduplicate.
Also moved StringForConnectionType() to connection_utils.
Bug: 28800946
Test: mma
Change-Id: If535fdc52bc8fb267921bea02b31d8d6580d5d54
diff --git a/update_manager/boxed_value.cc b/update_manager/boxed_value.cc
index a4aeede..9758d33 100644
--- a/update_manager/boxed_value.cc
+++ b/update_manager/boxed_value.cc
@@ -25,9 +25,13 @@
#include <base/time/time.h>
#include "update_engine/common/utils.h"
+#include "update_engine/connection_utils.h"
#include "update_engine/update_manager/shill_provider.h"
#include "update_engine/update_manager/updater_provider.h"
+using chromeos_update_engine::ConnectionTethering;
+using chromeos_update_engine::ConnectionType;
+using chromeos_update_engine::connection_utils::StringForConnectionType;
using std::set;
using std::string;
@@ -91,29 +95,10 @@
return chromeos_update_engine::utils::FormatTimeDelta(*val);
}
-static string ConnectionTypeToString(ConnectionType type) {
- switch (type) {
- case ConnectionType::kEthernet:
- return "Ethernet";
- case ConnectionType::kWifi:
- return "Wifi";
- case ConnectionType::kWimax:
- return "Wimax";
- case ConnectionType::kBluetooth:
- return "Bluetooth";
- case ConnectionType::kCellular:
- return "Cellular";
- case ConnectionType::kUnknown:
- return "Unknown";
- }
- NOTREACHED();
- return "Unknown";
-}
-
template<>
string BoxedValue::ValuePrinter<ConnectionType>(const void* value) {
const ConnectionType* val = reinterpret_cast<const ConnectionType*>(value);
- return ConnectionTypeToString(*val);
+ return StringForConnectionType(*val);
}
template<>
@@ -125,7 +110,7 @@
ConnectionType type = it;
if (ret.size() > 0)
ret += ",";
- ret += ConnectionTypeToString(type);
+ ret += StringForConnectionType(type);
}
return ret;
}