OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/audio_node.h" | 5 #include "chromeos/dbus/audio_node.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 | 10 |
11 namespace chromeos { | 11 namespace chromeos { |
12 | 12 |
13 AudioNode::AudioNode() | 13 AudioNode::AudioNode() |
14 : is_input(false), | 14 : is_input(false), |
15 id(0), | 15 id(0), |
16 active(false), | 16 active(false), |
17 plugged_time(0) { | 17 plugged_time(0) { |
18 } | 18 } |
19 | 19 |
| 20 AudioNode::AudioNode(bool is_input, |
| 21 uint64 id, |
| 22 std::string device_name, |
| 23 std::string type, |
| 24 std::string name, |
| 25 bool active, |
| 26 uint64 plugged_time) |
| 27 : is_input(is_input), |
| 28 id(id), |
| 29 device_name(device_name), |
| 30 type(type), |
| 31 name(name), |
| 32 active(active), |
| 33 plugged_time(plugged_time) { |
| 34 } |
| 35 |
20 std::string AudioNode::ToString() const { | 36 std::string AudioNode::ToString() const { |
21 std::string result; | 37 std::string result; |
22 base::StringAppendF(&result, | 38 base::StringAppendF(&result, |
23 "is_input = %s ", | 39 "is_input = %s ", |
24 is_input ? "true" : "false"); | 40 is_input ? "true" : "false"); |
25 base::StringAppendF(&result, | 41 base::StringAppendF(&result, |
26 "id = 0x%"PRIx64" ", | 42 "id = 0x%"PRIx64" ", |
27 id); | 43 id); |
28 base::StringAppendF(&result, | 44 base::StringAppendF(&result, |
29 "device_name = %s ", | 45 "device_name = %s ", |
30 device_name.c_str()); | 46 device_name.c_str()); |
31 base::StringAppendF(&result, | 47 base::StringAppendF(&result, |
32 "type = %s ", | 48 "type = %s ", |
33 type.c_str()); | 49 type.c_str()); |
34 base::StringAppendF(&result, | 50 base::StringAppendF(&result, |
35 "name = %s ", | 51 "name = %s ", |
36 name.c_str()); | 52 name.c_str()); |
37 base::StringAppendF(&result, | 53 base::StringAppendF(&result, |
38 "active = %s ", | 54 "active = %s ", |
39 active ? "true" : "false"); | 55 active ? "true" : "false"); |
40 base::StringAppendF(&result, | 56 base::StringAppendF(&result, |
41 "plugged_time= %s ", | 57 "plugged_time= %s ", |
42 base::Uint64ToString(plugged_time).c_str()); | 58 base::Uint64ToString(plugged_time).c_str()); |
43 | 59 |
44 return result; | 60 return result; |
45 } | 61 } |
46 | 62 |
47 } // namespace chromeos | 63 } // namespace chromeos |
OLD | NEW |