]> pilppa.com Git - libplp.git/commitdiff
fixes for w1 data read
authorMika Laitio <lamikr@pilppa.org>
Thu, 10 Mar 2011 17:58:19 +0000 (19:58 +0200)
committerMika Laitio <lamikr@pilppa.org>
Thu, 10 Mar 2011 17:58:19 +0000 (19:58 +0200)
Signed-off-by: Mika Laitio <lamikr@pilppa.org>
src/Device.cc
src/Device.hh
src/DeviceData.cc
src/DeviceData.hh
src/Makefile.am
src/SensorDevice.hh

index 8923ff83e4023ff7a3e934a5617b3e02ced7de01..96189bc30fb609901b9e835c9834d7cb344bd109 100644 (file)
@@ -1,19 +1,47 @@
 /*
  * Device.cc
  *
- *  Created on: Mar 5, 2011
+ *  Created on: Mar 4, 2011
  *      Author: lamikr
  */
-#include <string>
-
 #include "Device.hh"
-#include "DeviceConfig.hh"
 
 using namespace std;
 using namespace plp;
 
-Device::Device(string id_param, string type_param) : plp::DeviceData(id_param, type_param) {
+Device::Device(string id_param, string type_param) {
+       id                      = id_param;
+       type                    = type_param;
+       lifecycle_status        = LIFECYCLE_STATUS__UNAVAILABLE;
+}
+
+Device::Device(std::string id_param, std::string type_param, std::string name_param, plp::EnumDeviceLifeCycleStatus status_param) {
+       id                      = id_param;
+       type                    = type_param;
+       name                    = name_param;
+       lifecycle_status        = status_param;
+}
+
+Device::~Device() {
+
+}
+
+string Device::get_id() {
+       return id;
+}
+
+string Device::get_name() {
+       return name;
+}
+
+void Device::set_name(string name_param) {
+       name    = name_param;
+}
+
+EnumDeviceLifeCycleStatus Device::get_lifecycle_state() {
+       return lifecycle_status;
 }
 
-Device::Device(string id_param, string type_param, string name_param, EnumDeviceLifeCycleStatus status_param) : plp::DeviceData(id_param, type_param, name_param, status_param) {
+string Device::get_type() {
+       return type;
 }
index a0984ff3ec1548da458f4445aaabe79e0b444432..c165b1c1156e3c8666adb7cdfebf198349967da2 100644 (file)
@@ -1,25 +1,37 @@
 /*
- * GenericDevice.hh
+ * Device.hh
  *
- *  Created on: Feb 28, 2011
+ *  Created on: Mar 4, 2011
  *      Author: lamikr
  */
 
-#ifndef DEVICE_HH_
-#define DEVICE_HH_
+#ifndef DEVICEINFO_HH_
+#define DEVICEINFO_HH_
 
 #include <string>
 
-#include "DeviceData.hh"
-#include "DataReader.hh"
+using namespace std;
 
 namespace plp {
-       class Device : public DeviceData {
+       enum EnumDeviceLifeCycleStatus {LIFECYCLE_STATUS__UNAVAILABLE, LIFECYCLE_STATUS__AVAILABLE};
+
+       class Device {
                public:
-                       Device(std::string id_param, std::string type_param);
-                       Device(std::string id_param, std::string type_param, std::string name_param, plp::EnumDeviceLifeCycleStatus status_param);
-                       virtual plp::DataReader *get_device_data() = 0;
+                       Device(string id_param, string type_param);
+                       Device(string id_param, string type_param, string name_param, EnumDeviceLifeCycleStatus status_param);
+                       ~Device();
+                       std::string get_id();
+                       std::string get_name();
+                       std::string get_type();
+                       plp::EnumDeviceLifeCycleStatus get_lifecycle_state();
+                       void set_name(std::string name_param);
+                       virtual void printout() = 0;
+               protected:
+                       std::string id;
+                       std::string name;
+                       std::string type;
+                       plp::EnumDeviceLifeCycleStatus lifecycle_status;
        };
 }
 
-#endif /* DEVICE_HH_ */
+#endif /* DEVICEINFO_HH_ */
index 60edf5e3235f7a7c829e03d62ffeb54152881465..1621d054247522c3b175ff925b778c7e9447a3a8 100644 (file)
@@ -1,50 +1,23 @@
 /*
  * DeviceData.cc
  *
- *  Created on: Mar 4, 2011
+ *  Created on: Mar 10, 2011
  *      Author: lamikr
  */
-#include <plp/Device.hh>
+
 #include "DeviceData.hh"
 
 using namespace std;
 using namespace plp;
 
-DeviceData::DeviceData(string id_param, string type_param) {
-       id                      = id_param;
-       type                    = type_param;
-       lifecycle_status        = LIFECYCLE_STATUS__UNAVAILABLE;
-}
-
-DeviceData::DeviceData(std::string id_param, std::string type_param, std::string name_param, plp::EnumDeviceLifeCycleStatus status_param) {
-       id                      = id_param;
-       type                    = type_param;
-       name                    = name_param;
-       lifecycle_status        = status_param;
+DeviceData::DeviceData(string id_param, string type_param) : Device(id_param, type_param) {
 }
 
-DeviceData::~DeviceData() {
+DeviceData::DeviceData(string id_param, string type_param, string name_param, EnumDeviceLifeCycleStatus status_param) : Device(id_param, type_param, name_param, status_param) {
 
 }
 
-string DeviceData::get_id() {
-       return id;
-}
-
-string DeviceData::get_name() {
-       return name;
-}
-
-void DeviceData::set_name(string name_param) {
-       name    = name_param;
-}
-
-EnumDeviceLifeCycleStatus DeviceData::get_lifecycle_state() {
-       return lifecycle_status;
-}
-
-string DeviceData::get_type() {
-       return type;
+DeviceData::~DeviceData() {
 }
 
 void DeviceData::printout() {
index ce0f89a3889fd3c1dc503445b73f06af87bc6f44..5b110476ce138cd0b25a89e2d59338574993f9ca 100644 (file)
@@ -1,37 +1,23 @@
 /*
  * DeviceData.hh
  *
- *  Created on: Mar 4, 2011
+ *  Created on: Mar 10, 2011
  *      Author: lamikr
  */
 
-#ifndef DEVICEINFO_HH_
-#define DEVICEINFO_HH_
+#ifndef DEVICEDATA_HH_
+#define DEVICEDATA_HH_
 
-#include <string>
-
-using namespace std;
+#include "Device.hh"
 
 namespace plp {
-       enum EnumDeviceLifeCycleStatus {LIFECYCLE_STATUS__UNAVAILABLE, LIFECYCLE_STATUS__AVAILABLE};
-
-       class DeviceData {
+       class DeviceData : public Device {
                public:
-                       DeviceData(string id_param, string type_param);
-                       DeviceData(string id_param, string type_param, string name_param, EnumDeviceLifeCycleStatus status_param);
+                       DeviceData(std::string id_param, std::string type_param);
+                       DeviceData(std::string id_param, std::string type_param, std::string name_param, plp::EnumDeviceLifeCycleStatus status_param);
                        ~DeviceData();
-                       std::string get_id();
-                       std::string get_name();
-                       std::string get_type();
-                       plp::EnumDeviceLifeCycleStatus get_lifecycle_state();
-                       void set_name(std::string name_param);
                        void printout();
-               protected:
-                       std::string id;
-                       std::string name;
-                       std::string type;
-                       plp::EnumDeviceLifeCycleStatus lifecycle_status;
        };
 }
 
-#endif /* DEVICEINFO_HH_ */
+#endif /* DEVICEDATA_HH_ */
index 183b03bd68abdeacce5d6f60badf3aa055fb6f7e..b815100f86732d42300ba088fe183f6fd441d777 100644 (file)
@@ -5,8 +5,8 @@ libplp_la_SOURCES = \
        DataReader.hh DataReader.cc \
        Date.hh Date.cc \
        Device.hh Device.cc \
-       DeviceConfig.hh DeviceConfig.cc \
        DeviceData.hh DeviceData.cc \
+       DeviceConfig.hh DeviceConfig.cc \
        DeviceTypes.hh \
        FileUtil.cc FileUtil.hh \
        SensorDevice.hh \
@@ -30,8 +30,8 @@ libplpinclude_HEADERS =   \
         DataReader.hh \
         Date.hh \
         Device.hh \
-        DeviceConfig.hh \
         DeviceData.hh \
+        DeviceConfig.hh \
         DeviceTypes.hh \
         FileUtil.hh \
         SensorDevice.hh \
index 80c02dfbe2d08f0de965c86c48138f5a96bead1c..1eea03165a57f229ab0527b499c114fab99aa0d8 100644 (file)
 
 #include <string>
 
+#include "DataReader.hh"
 #include "Device.hh"
 
+using namespace plp;
+
 namespace plp {
        class SensorDevice : public Device {
                public:
                        SensorDevice(std::string id_param, std::string type_param) : Device(id_param, type_param) {}
-                       virtual std::string get_unit() = 0;
+                       virtual DataReader *get_device_data() = 0;
+                       virtual string get_unit() = 0;
                        virtual plp::Data *get_data() = 0;
        };
 }