| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 AudioNode::AudioNode() | 15 AudioNode::AudioNode() |
| 16 : is_input(false), | 16 : is_input(false), |
| 17 id(0), | 17 id(0), |
| 18 active(false), | 18 active(false), |
| 19 plugged_time(0) { | 19 plugged_time(0) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 AudioNode::AudioNode(bool is_input, | 22 AudioNode::AudioNode(bool is_input, |
| 23 uint64_t id, | 23 uint64_t id, |
| 24 uint64_t stable_device_id, |
| 24 std::string device_name, | 25 std::string device_name, |
| 25 std::string type, | 26 std::string type, |
| 26 std::string name, | 27 std::string name, |
| 27 bool active, | 28 bool active, |
| 28 uint64_t plugged_time) | 29 uint64_t plugged_time) |
| 29 : is_input(is_input), | 30 : is_input(is_input), |
| 30 id(id), | 31 id(id), |
| 32 stable_device_id(stable_device_id), |
| 31 device_name(device_name), | 33 device_name(device_name), |
| 32 type(type), | 34 type(type), |
| 33 name(name), | 35 name(name), |
| 34 active(active), | 36 active(active), |
| 35 plugged_time(plugged_time) {} | 37 plugged_time(plugged_time) {} |
| 36 | 38 |
| 37 AudioNode::~AudioNode() {} | 39 AudioNode::~AudioNode() {} |
| 38 | 40 |
| 39 std::string AudioNode::ToString() const { | 41 std::string AudioNode::ToString() const { |
| 40 std::string result; | 42 std::string result; |
| 41 base::StringAppendF(&result, | 43 base::StringAppendF(&result, |
| 42 "is_input = %s ", | 44 "is_input = %s ", |
| 43 is_input ? "true" : "false"); | 45 is_input ? "true" : "false"); |
| 44 base::StringAppendF(&result, | 46 base::StringAppendF(&result, |
| 45 "id = 0x%" PRIx64 " ", | 47 "id = 0x%" PRIx64 " ", |
| 46 id); | 48 id); |
| 47 base::StringAppendF(&result, | 49 base::StringAppendF(&result, |
| 50 "stable_device_id = 0x%" PRIx64 " ", |
| 51 stable_device_id); |
| 52 base::StringAppendF(&result, |
| 48 "device_name = %s ", | 53 "device_name = %s ", |
| 49 device_name.c_str()); | 54 device_name.c_str()); |
| 50 base::StringAppendF(&result, | 55 base::StringAppendF(&result, |
| 51 "type = %s ", | 56 "type = %s ", |
| 52 type.c_str()); | 57 type.c_str()); |
| 53 base::StringAppendF(&result, | 58 base::StringAppendF(&result, |
| 54 "name = %s ", | 59 "name = %s ", |
| 55 name.c_str()); | 60 name.c_str()); |
| 56 base::StringAppendF(&result, | 61 base::StringAppendF(&result, |
| 57 "active = %s ", | 62 "active = %s ", |
| 58 active ? "true" : "false"); | 63 active ? "true" : "false"); |
| 59 base::StringAppendF(&result, | 64 base::StringAppendF(&result, |
| 60 "plugged_time= %s ", | 65 "plugged_time= %s ", |
| 61 base::Uint64ToString(plugged_time).c_str()); | 66 base::Uint64ToString(plugged_time).c_str()); |
| 62 | 67 |
| 63 return result; | 68 return result; |
| 64 } | 69 } |
| 65 | 70 |
| 66 } // namespace chromeos | 71 } // namespace chromeos |
| OLD | NEW |