blob: 1be4184c0e2824ff888850ecc44ea8f9ce0ef865 [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
17
18Technology::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
30std::string Technology::NameFromIdentifier(Technology::Identifier id) {
31 if (id == kEthernet) {
32 return flimflam::kTypeEthernet;
33 } else if (id == kWifi) {
34 return flimflam::kTypeWifi;
35 } else if (id == kCellular) {
36 return flimflam::kTypeCellular;
37 } else {
38 return kUnknownName;
39 }
40}
41
42} // namespace shill