This library allows to parse and work with data sent by the Paradigma pelletti oven.
Embed:
(wiki syntax)
Show/hide line numbers
ParadigmaTemperature.h
00001 #ifndef __PARADIGMATEMPERATURE_H__ 00002 #define __PARADIGMATEMPERATURE_H__ 00003 00004 #include <string> 00005 #include "ParadigmaBase.h" 00006 00007 namespace Paradigma { 00008 00009 typedef enum { 00010 // Temperatures from Monitor Data 1 00011 T_aussen, 00012 T_warm_wasser, 00013 T_kessel_vorlauf, 00014 T_kessel_ruecklauf, 00015 T_HK1_raum, 00016 T_HK2_raum, 00017 T_HK1_vorlauf, 00018 T_HK2_vorlauf, 00019 T_HK1_ruecklauf, 00020 T_HK2_ruecklauf, 00021 T_puffer_oben, 00022 T_puffer_unten, 00023 T_zirkulation, 00024 // Temperatures form Monitor Data 2 00025 T_HK1_raum_soll, 00026 T_HK2_raum_soll, 00027 T_HK1_vorlauf_soll, 00028 T_HK2_vorlauf_soll, 00029 T_warm_wasser_soll, 00030 T_puffer_soll 00031 } ParadigmaTemperatureSelector_t; 00032 00033 00034 __packed class ParadigmaTemperature 00035 { 00036 unsigned short m_temp; 00037 00038 public: 00039 ParadigmaTemperature() : m_temp(0) {} 00040 00041 operator string() const { char Buffer[14]; sprintf(Buffer, "%3d,%1d C", m_temp/10, m_temp%10); return Buffer; } 00042 operator float() const { return ((float)m_temp)/10.0f; } 00043 00044 ParadigmaTemperature& operator=(float f) { m_temp = (int)ceil(f*10.0f); return *this; } 00045 ParadigmaTemperature& operator=(ParadigmaTemperature &p) { m_temp = p.m_temp; return *this; } 00046 00047 public: 00048 00049 /** On the MBED we need to swap the high and lowbytes after reading from stream. 00050 * this function will be called from reading routine. 00051 */ 00052 void adjustEndiness() { m_temp = ((m_temp&0xFF)<<8) | ((m_temp>>8)&0xFF); } 00053 }; 00054 } 00055 #endif
Generated on Wed Jul 13 2022 16:47:28 by 1.7.2