blob: 9e4261811d244d102b135daf4755d5eb9744c07f [file] [log] [blame]
Paul Stewartfdd16072011-09-16 12:41:35 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "shill/technology.h"
6
7#include <string>
8
9#include <chromeos/dbus/service_constants.h>
10
11namespace shill {
12
13using std::string;
14
15const char Technology::kUnknownName[] = "Unknown";
16
Gaurav Shah435de2c2011-11-17 19:01:07 -080017// static
Paul Stewartfdd16072011-09-16 12:41:35 -070018Technology::Identifier Technology::IdentifierFromName(const std::string &name) {
19 if (name == flimflam::kTypeEthernet) {
20 return kEthernet;
21 } else if (name == flimflam::kTypeWifi) {
22 return kWifi;
23 } else if (name == flimflam::kTypeCellular) {
24 return kCellular;
25 } else {
26 return kUnknown;
27 }
28}
29
Gaurav Shah435de2c2011-11-17 19:01:07 -080030// static
Paul Stewartfdd16072011-09-16 12:41:35 -070031std::string Technology::NameFromIdentifier(Technology::Identifier id) {
32 if (id == kEthernet) {
33 return flimflam::kTypeEthernet;
34 } else if (id == kWifi) {
35 return flimflam::kTypeWifi;
36 } else if (id == kCellular) {
37 return flimflam::kTypeCellular;
38 } else {
39 return kUnknownName;
40 }
41}
42
43} // namespace shill