Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / chromeos / dbus / audio_node.cc
blob38b21094e3886244f44020451603288ecff8c8fb
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
3 // found in the LICENSE file.
5 #include "chromeos/dbus/audio_node.h"
7 #include "base/format_macros.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h"
11 namespace chromeos {
13 AudioNode::AudioNode()
14 : is_input(false),
15 id(0),
16 active(false),
17 plugged_time(0) {
20 std::string AudioNode::ToString() const {
21 std::string result;
22 base::StringAppendF(&result,
23 "is_input = %s ",
24 is_input ? "true" : "false");
25 base::StringAppendF(&result,
26 "id = %s ",
27 base::Uint64ToString(id).c_str());
28 base::StringAppendF(&result,
29 "device_name = %s ",
30 device_name.c_str());
31 base::StringAppendF(&result,
32 "type = %s ",
33 type.c_str());
34 base::StringAppendF(&result,
35 "name = %s ",
36 name.c_str());
37 base::StringAppendF(&result,
38 "active = %s ",
39 active ? "true" : "false");
40 base::StringAppendF(&result,
41 "plugged_time= %s ",
42 base::Uint64ToString(plugged_time).c_str());
44 return result;
47 } // namespace chromeos