Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 1 | // 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 | |
| 11 | namespace shill { |
| 12 | |
| 13 | using std::string; |
| 14 | |
| 15 | const char Technology::kUnknownName[] = "Unknown"; |
| 16 | |
Gaurav Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 17 | // static |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 18 | Technology::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 Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 30 | // static |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 31 | std::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 |