hardware interface: add copyFrom

Add a copyFrom method to the hardware window interface and empty
implementations of it within the current lpc handlers.

Change-Id: If2ab6a47763387721edd1a0c451ed8c6087eb475
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/lpc_aspeed.cpp b/lpc_aspeed.cpp
index 62760c5..2001986 100644
--- a/lpc_aspeed.cpp
+++ b/lpc_aspeed.cpp
@@ -96,4 +96,10 @@
     return std::make_pair(offset, length);
 }
 
+std::vector<std::uint8_t> LpcMapperAspeed::copyFrom(std::uint32_t length)
+{
+    /* TODO: Implement this. */
+    return {};
+}
+
 } // namespace blobs
diff --git a/lpc_aspeed.hpp b/lpc_aspeed.hpp
index be872ce..c528c3d 100644
--- a/lpc_aspeed.hpp
+++ b/lpc_aspeed.hpp
@@ -22,6 +22,8 @@
     std::pair<std::uint32_t, std::uint32_t>
         mapWindow(std::uint32_t address, std::uint32_t length) override;
 
+    std::vector<std::uint8_t> copyFrom(std::uint32_t length) override;
+
   private:
     std::size_t regionSize;
     const internal::Sys* sys;
diff --git a/lpc_handler.cpp b/lpc_handler.cpp
index f68a9fa..e5b49a2 100644
--- a/lpc_handler.cpp
+++ b/lpc_handler.cpp
@@ -56,7 +56,7 @@
         return {};
     }
 
-    return {};
+    return mapper->copyFrom(length);
 }
 
 bool LpcDataHandler::writeMeta(const std::vector<std::uint8_t>& configuration)
diff --git a/lpc_nuvoton.cpp b/lpc_nuvoton.cpp
index ce0cf30..ebc210c 100644
--- a/lpc_nuvoton.cpp
+++ b/lpc_nuvoton.cpp
@@ -129,4 +129,10 @@
     return std::make_pair(windowOffset, windowSize);
 }
 
+std::vector<std::uint8_t> LpcMapperNuvoton::copyFrom(std::uint32_t length)
+{
+    /* TODO: implement. */
+    return {};
+}
+
 } // namespace blobs
diff --git a/lpc_nuvoton.hpp b/lpc_nuvoton.hpp
index a5fca08..91b7062 100644
--- a/lpc_nuvoton.hpp
+++ b/lpc_nuvoton.hpp
@@ -4,6 +4,7 @@
 #include "window_hw_interface.hpp"
 
 #include <memory>
+#include <vector>
 
 namespace blobs
 {
@@ -25,6 +26,8 @@
     std::pair<std::uint32_t, std::uint32_t>
         mapWindow(std::uint32_t address, std::uint32_t length) override;
 
+    std::vector<std::uint8_t> copyFrom(std::uint32_t length) override;
+
   private:
     const internal::Sys* sys;
 };
diff --git a/test/lpc_mapper_mock.hpp b/test/lpc_mapper_mock.hpp
index 79f4e50..0bd4b4d 100644
--- a/test/lpc_mapper_mock.hpp
+++ b/test/lpc_mapper_mock.hpp
@@ -15,6 +15,7 @@
     MOCK_METHOD2(mapWindow,
                  std::pair<std::uint32_t, std::uint32_t>(std::uint32_t,
                                                          std::uint32_t));
+    MOCK_METHOD1(copyFrom, std::vector<std::uint8_t>(std::uint32_t));
 };
 
 } // namespace blobs
diff --git a/window_hw_interface.hpp b/window_hw_interface.hpp
index a9de4dd..d00bfcd 100644
--- a/window_hw_interface.hpp
+++ b/window_hw_interface.hpp
@@ -2,6 +2,7 @@
 
 #include <cstdint>
 #include <utility>
+#include <vector>
 
 namespace blobs
 {
@@ -29,6 +30,14 @@
      */
     virtual std::pair<std::uint32_t, std::uint32_t>
         mapWindow(std::uint32_t address, std::uint32_t length) = 0;
+
+    /**
+     * Returns the bytes from the mapped window.
+     *
+     * @param[in] length - the number of bytes to copy.
+     * @return the bytes copied out of the region.
+     */
+    virtual std::vector<std::uint8_t> copyFrom(std::uint32_t length) = 0;
 };
 
 } // namespace blobs