From bd6eb9a015abcbd688f1c412598e901cfb5feb7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Luis=20Rivero=20Partida?= <jrivero@iri.upc.edu>
Date: Thu, 12 May 2011 09:40:38 +0000
Subject: [PATCH] Support to retrieve all status information at one call

get_status() will return an struct of type TSegwayRMP400Status
---
 src/segway_RMP400.cpp | 10 ++++++++++
 src/segway_RMP400.h   | 12 ++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/src/segway_RMP400.cpp b/src/segway_RMP400.cpp
index e33cc09..002f688 100644
--- a/src/segway_RMP400.cpp
+++ b/src/segway_RMP400.cpp
@@ -155,6 +155,16 @@ CSegwayRMP400::set_wheel_radius(const float radius)
     wheel_radius_ = radius;
 }
 
+TSegwayRMP400Status
+CSegwayRMP400::get_status()
+{
+    TSegwayRMP400Status status;
+    status.rmp200[0] = segways_[0]->get_status();
+    status.rmp200[1] = segways_[1]->get_status();
+
+    return status;
+}
+
 float
 CSegwayRMP400::get_forward_displacement()
 {
diff --git a/src/segway_RMP400.h b/src/segway_RMP400.h
index 595f51b..a7ddf7e 100644
--- a/src/segway_RMP400.h
+++ b/src/segway_RMP400.h
@@ -16,6 +16,11 @@ const int NUM_SEGWAY_200 = 2;
 
 enum SegwayRMP400_status { rmp400_off, rmp400_connected };
 
+struct TSegwayRMP400Status
+{
+    TSegwayRMP200Status rmp200[2];
+};
+
 class CSegwayRMP400
 {
   private:
@@ -137,6 +142,13 @@ class CSegwayRMP400
      */
     bool is_connected() const;
 
+    /**
+     * \brief function to return whole platform status
+     *
+     * It will return the two segway internal status
+     */
+    TSegwayRMP400Status get_status(void);
+
     /**
      * \brief function to return the total forward displacement
      *
-- 
GitLab