Log time between network drops -- from online to offline.
Rewrite most of metrics_daemon. Convert to low-level D-Bus API -- this
simplifies the code a little and also allows us to catch the power
state signal. I still suspect we may be abusing D-Bus a little but it
seems to work.
snanda@ -- please review the power state code specifically.
BUG=none
TEST=tested on target platform and arm-generic builds
Review URL: http://codereview.chromium.org/1799001
diff --git a/metrics/power_states.h b/metrics/power_states.h
new file mode 100644
index 0000000..413085e
--- /dev/null
+++ b/metrics/power_states.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// A table of power states, to be included when building tabular things.
+//
+// This file is used to construct two things: an enumerated type in
+// metrics_daemon.h, and a table of structures with state names in
+// metrics_daemon.cc. Including this file ensures that the two tables are
+// always in sync (and saves typing). I don't know of other ways of achieving
+// the same result in C/C++, but it doesn't mean there isn't one.
+
+// Before you include this file, define STATE to do something useful, or else
+// if will be a no-op. STATE will be undefined on exit. Don't worry about
+// collisions for the STATE macro (as long as it's a macro) because the
+// compiler will flag them---in that case, just change the name. If someone is
+// misguided enough to use STATE for something other than a macro, the error
+// messages will be slightly more complicated.
+
+
+#ifndef STATE
+#define STATE(name, capname)
+#endif
+
+STATE(on, On)
+STATE(mem, Mem)
+
+#undef STATE