update sensor page
diff --git a/boost-dbus/CMakeLists.txt b/boost-dbus/CMakeLists.txt
index 736d030..57bd8bd 100644
--- a/boost-dbus/CMakeLists.txt
+++ b/boost-dbus/CMakeLists.txt
@@ -49,6 +49,6 @@
 target_link_libraries(dbustests ${Boost_LIBRARIES})
 target_link_libraries(dbustests ${DBus_LIBRARIES})
 target_link_libraries(dbustests ${GTEST_BOTH_LIBRARIES} gmock)
-target_link_libraries(dbustests -pthread)
+target_link_libraries(dbustests pthread)
 add_test(dbustests dbustests "--gtest_output=xml:${test_name}.xml")
 
diff --git a/boost-dbus/include/dbus/connection.hpp b/boost-dbus/include/dbus/connection.hpp
index a7185a5..50e0207 100644
--- a/boost-dbus/include/dbus/connection.hpp
+++ b/boost-dbus/include/dbus/connection.hpp
@@ -53,6 +53,33 @@
     this->get_service().open(this->get_implementation(), bus);
   }
 
+
+  /// Request a name on the bus.
+  /**
+ * @param name The name requested on the bus
+ *
+ * @return
+ *
+ * @throws boost::system::system_error When the response timed out or
+ * there was some other error.
+ */
+  void request_name(const string& name) {
+      this->get_implementation().request_name(name);
+  }
+
+  /// Reply to a message.
+  /**
+ * @param m The message from which to create the reply
+ *
+ * @return The new reply message
+ *
+ * @throws boost::system::system_error When the response timed out or
+ * there was some other error.
+ */
+  message reply(message& m) {
+    return this->get_implementation().new_method_return(m);
+  }
+
   /// Send a message.
   /**
  * @param m The message to send.
@@ -125,6 +152,8 @@
   friend class filter;
 };
 
+typedef std::shared_ptr<connection> connection_ptr;
+
 }  // namespace dbus
 
 #endif  // DBUS_CONNECTION_HPP
diff --git a/boost-dbus/include/dbus/endpoint.hpp b/boost-dbus/include/dbus/endpoint.hpp
index a574e8f..2955a34 100644
--- a/boost-dbus/include/dbus/endpoint.hpp
+++ b/boost-dbus/include/dbus/endpoint.hpp
@@ -16,17 +16,32 @@
   string process_name_;
   string path_;
   string interface_;
+  string member_;
 
  public:
   endpoint(const string& process_name, const string& path,
            const string& interface)
       : process_name_(process_name), path_(path), interface_(interface) {}
 
+  endpoint(const string& process_name, const string& path,
+           const string& interface, const string& member)
+      : process_name_(process_name), path_(path),
+        interface_(interface), member_(member) {}
+
   const string& get_path() const { return path_; }
 
   const string& get_interface() const { return interface_; }
 
   const string& get_process_name() const { return process_name_; }
+
+  const string& get_member() const { return member_; }
+
+  const bool operator == (const endpoint &other) const {
+    return (process_name_ == other.process_name_ &&
+            path_ == other.path_ &&
+            interface_ == other.interface_ &&
+            member_ == other.member_);
+  }
 };
 
 }  // namespace dbus
diff --git a/boost-dbus/include/dbus/filter.hpp b/boost-dbus/include/dbus/filter.hpp
index 5d60d33..b0f0db4 100644
--- a/boost-dbus/include/dbus/filter.hpp
+++ b/boost-dbus/include/dbus/filter.hpp
@@ -19,7 +19,7 @@
  * Filters examine incoming messages, demuxing them to multiple queues.
  */
 class filter {
-  connection& connection_;
+  connection_ptr connection_;
   std::function<bool(message&)> predicate_;
   detail::queue<message> queue_;
 
@@ -31,24 +31,25 @@
   }
 
   template <typename MessagePredicate>
-  filter(connection& c, BOOST_ASIO_MOVE_ARG(MessagePredicate) p)
+  filter(connection_ptr c, BOOST_ASIO_MOVE_ARG(MessagePredicate) p)
       : connection_(c),
         predicate_(BOOST_ASIO_MOVE_CAST(MessagePredicate)(p)),
-        queue_(connection_.get_io_service()) {
-    connection_.new_filter(*this);
+        queue_(connection_->get_io_service()) {
+    connection_->new_filter(*this);
   }
 
-  ~filter() { connection_.delete_filter(*this); }
+  ~filter() { connection_->delete_filter(*this); }
 
   template <typename MessageHandler>
   inline BOOST_ASIO_INITFN_RESULT_TYPE(MessageHandler,
                                        void(boost::system::error_code, message))
       async_dispatch(BOOST_ASIO_MOVE_ARG(MessageHandler) handler) {
     // begin asynchronous operation
-    connection_.get_implementation().start(connection_.get_io_service());
+    connection_->get_implementation().start(connection_->get_io_service());
 
     return queue_.async_pop(BOOST_ASIO_MOVE_CAST(MessageHandler)(handler));
   }
+
 };
 }  // namespace dbus
 
diff --git a/boost-dbus/include/dbus/impl/connection.ipp b/boost-dbus/include/dbus/impl/connection.ipp
index 24a257d..c4c0605 100644
--- a/boost-dbus/include/dbus/impl/connection.ipp
+++ b/boost-dbus/include/dbus/impl/connection.ipp
@@ -44,6 +44,13 @@
     detail::set_watch_timeout_dispatch_functions(conn, io);
   }
 
+  void request_name(const string& name) {
+    error e;
+    dbus_bus_request_name(conn, name.c_str(),
+			 DBUS_NAME_FLAG_DO_NOT_QUEUE | DBUS_NAME_FLAG_REPLACE_EXISTING, e);
+    e.throw_if_set();
+  }
+
   ~connection() {
     if (conn != NULL) {
       dbus_connection_close(conn);
@@ -51,6 +58,10 @@
     }
   }
 
+  message new_method_return(message &m) {
+  	return dbus_message_new_method_return(m);
+  }
+
   operator DBusConnection*() { return conn; }
   operator const DBusConnection*() const { return conn; }
 
diff --git a/boost-dbus/include/dbus/match.hpp b/boost-dbus/include/dbus/match.hpp
index 0488aa0..cdcd169 100644
--- a/boost-dbus/include/dbus/match.hpp
+++ b/boost-dbus/include/dbus/match.hpp
@@ -22,16 +22,16 @@
  * dispose of the object.
  */
 class match {
-  connection& connection_;
+  connection_ptr connection_;
   std::string expression_;
 
  public:
-  match(connection& c, BOOST_ASIO_MOVE_ARG(std::string) e)
+  match(connection_ptr c, BOOST_ASIO_MOVE_ARG(std::string) e)
       : connection_(c), expression_(BOOST_ASIO_MOVE_CAST(std::string)(e)) {
-    connection_.new_match(*this);
+    connection_->new_match(*this);
   }
 
-  ~match() { connection_.delete_match(*this); }
+  ~match() { connection_->delete_match(*this); }
 
   const std::string& get_expression() const { return expression_; }
 
diff --git a/boost-dbus/include/dbus/message.hpp b/boost-dbus/include/dbus/message.hpp
index 695e1fc..e4b0255 100644
--- a/boost-dbus/include/dbus/message.hpp
+++ b/boost-dbus/include/dbus/message.hpp
@@ -77,6 +77,10 @@
         dbus_message_type_to_string(dbus_message_get_type(message_.get())));
   }
 
+  string get_signature() const {
+    return sanitize(dbus_message_get_signature(message_.get()));
+  }
+
   string get_sender() const {
     return sanitize(dbus_message_get_sender(message_.get()));
   }
diff --git a/boost-dbus/test/avahi.cpp b/boost-dbus/test/avahi.cpp
index 8cbb82f..5d2deb8 100644
--- a/boost-dbus/test/avahi.cpp
+++ b/boost-dbus/test/avahi.cpp
@@ -19,11 +19,11 @@
   dbus::endpoint test_daemon("org.freedesktop.Avahi", "/",
                              "org.freedesktop.Avahi.Server");
   boost::asio::io_service io;
-  dbus::connection system_bus(io, dbus::bus::system);
+  auto system_bus = std::make_shared<dbus::connection>(io, dbus::bus::system);
 
   dbus::message m = dbus::message::new_call(test_daemon, "GetHostName");
 
-  system_bus.async_send(
+  system_bus->async_send(
       m, [&](const boost::system::error_code ec, dbus::message r) {
 
         std::string avahi_hostname;
@@ -52,7 +52,7 @@
 
 TEST(AvahiTest, ServiceBrowser) {
   boost::asio::io_service io;
-  dbus::connection system_bus(io, dbus::bus::system);
+  auto system_bus = std::make_shared<dbus::connection>(io, dbus::bus::system);
 
   dbus::endpoint test_daemon("org.freedesktop.Avahi", "/",
                              "org.freedesktop.Avahi.Server");
@@ -64,7 +64,7 @@
       .pack<std::string>("local")
       .pack<uint32_t>(0);
 
-  dbus::message r = system_bus.send(m1);
+  dbus::message r = system_bus->send(m1);
   std::string browser_path;
   r.unpack(browser_path);
   testing::Test::RecordProperty("browserPath", browser_path);
@@ -102,13 +102,13 @@
     FAIL() << "Callback was never called\n";
   });
 
-  dbus::connection system_bus(io, dbus::bus::system);
+  auto system_bus = std::make_shared<dbus::connection>(io, dbus::bus::system);
 
   dbus::endpoint test_daemon("org.freedesktop.DBus", "/",
                              "org.freedesktop.DBus");
   // create new service browser
   dbus::message m = dbus::message::new_call(test_daemon, "ListNames");
-  system_bus.async_send(
+  system_bus->async_send(
       m, [&](const boost::system::error_code ec, dbus::message r) {
         io.stop();
         std::vector<std::string> services;
@@ -123,13 +123,13 @@
   io.run();
 }
 
-void query_interfaces(dbus::connection& system_bus, std::string& service_name,
-                      std::string& object_name) {
+void query_interfaces(dbus::connection_ptr system_bus,
+                      std::string& service_name, std::string& object_name) {
   dbus::endpoint service_daemon(service_name, object_name,
                                 "org.freedestop.DBus.Introspectable");
   dbus::message m = dbus::message::new_call(service_daemon, "Introspect");
   try {
-    auto r = system_bus.send(m);
+    auto r = system_bus->send(m);
     std::vector<std::string> names;
     // Todo(ed) figure out why we're occassionally getting access
     // denied errors
@@ -152,10 +152,12 @@
 
 TEST(BOOST_DBUS, SingleSensorChanged) {
   boost::asio::io_service io;
-  dbus::connection system_bus(io, dbus::bus::system);
+
+  auto system_bus = std::make_shared<dbus::connection>(io, dbus::bus::system);
 
   dbus::match ma(system_bus,
                  "type='signal',path_namespace='/xyz/openbmc_project/sensors'");
+
   dbus::filter f(system_bus, [](dbus::message& m) {
     auto member = m.get_member();
     return member == "PropertiesChanged";
@@ -199,15 +201,15 @@
 
   auto removed = std::vector<uint32_t>();
   m.pack(removed);
-  system_bus.async_send(m,
-                        [&](boost::system::error_code ec, dbus::message s) {});
+  system_bus->async_send(m,
+                         [&](boost::system::error_code ec, dbus::message s) {});
 
   io.run();
 }
 
 TEST(BOOST_DBUS, MultipleSensorChanged) {
   boost::asio::io_service io;
-  dbus::connection system_bus(io, dbus::bus::system);
+  auto system_bus = std::make_shared<dbus::connection>(io, dbus::bus::system);
 
   dbus::match ma(system_bus,
                  "type='signal',path_namespace='/xyz/openbmc_project/sensors'");
@@ -217,7 +219,8 @@
   });
 
   int count = 0;
-  f.async_dispatch([&](boost::system::error_code ec, dbus::message s) {
+  std::function<void(boost::system::error_code, dbus::message)> callback = [&](
+      boost::system::error_code ec, dbus::message s) {
     std::string object_name;
     EXPECT_EQ(s.get_path(),
               "/xyz/openbmc_project/sensors/temperature/LR_Brd_Temp");
@@ -233,9 +236,12 @@
     count++;
     if (count == 2) {
       io.stop();
+    } else {
+      f.async_dispatch(callback);
     }
 
-  });
+  };
+  f.async_dispatch(callback);
 
   dbus::endpoint test_endpoint(
       "org.freedesktop.Avahi",
@@ -255,9 +261,70 @@
 
   auto removed = std::vector<uint32_t>();
   m.pack(removed);
-  system_bus.async_send(m,
-                        [&](boost::system::error_code ec, dbus::message s) {});
-  system_bus.async_send(m,
-                        [&](boost::system::error_code ec, dbus::message s) {});
+  system_bus->async_send(m,
+                         [&](boost::system::error_code ec, dbus::message s) {});
+  system_bus->async_send(m,
+                         [&](boost::system::error_code ec, dbus::message s) {});
   io.run();
-}
\ No newline at end of file
+}
+
+TEST(BOOST_DBUS, MethodCall) {
+  boost::asio::io_service io;
+  boost::asio::deadline_timer t(io, boost::posix_time::seconds(30));
+  t.async_wait([&](const boost::system::error_code& /*e*/) {
+    io.stop();
+    FAIL() << "Callback was never called\n";
+  });
+  std::string requested_name = "xyz.openbmc_project.fwupdate1.server";
+  auto system_bus = std::make_shared<dbus::connection>(io, dbus::bus::system);
+  //system_bus->request_name(requested_name);
+
+  /* not sure we even need to add a match for method calls,
+   * but this is how you might do it .... */
+  dbus::match ma(
+      system_bus,
+      "type='method_call',path_namespace='/xyz/openbmc_project/fwupdate1'");
+
+  dbus::filter f(system_bus, [](dbus::message& m) {
+    // std::cerr << "filter called: " << m << std::endl;
+    return (m.get_member() == "Get" &&
+            m.get_interface() == "org.freedesktop.DBus.Properties" &&
+            m.get_signature() == "ss");
+  });
+
+  std::function<void(boost::system::error_code, dbus::message)> method_handler =
+      [&](boost::system::error_code ec, dbus::message s) {
+        if (ec) {
+          FAIL() << ec;
+        } else {
+          std::string intf_name, prop_name;
+          s.unpack(intf_name).unpack(prop_name);
+
+          EXPECT_EQ(intf_name, "xyz.openbmc_project.fwupdate1");
+          EXPECT_EQ(prop_name, "State");
+
+          // send a reply so dbus doesn't get angry?
+          auto r = system_bus->reply(s);
+          r.pack("IDLE");
+          system_bus->async_send(
+              r, [&](boost::system::error_code ec, dbus::message s) {});
+          io.stop();
+        }
+      };
+  f.async_dispatch(method_handler);
+
+  dbus::endpoint test_endpoint(requested_name, "/xyz/openbmc_project/fwupdate1",
+                               "org.freedesktop.DBus.Properties");
+
+  auto method_name = std::string("Get");
+  auto m = dbus::message::new_call(test_endpoint, method_name);
+
+  m.pack("xyz.openbmc_project.fwupdate1");
+  m.pack("State");
+
+  system_bus->async_send(m, [&](boost::system::error_code ec, dbus::message s) {
+    std::cerr << "received s: " << s << std::endl;
+  });
+
+  io.run();
+}