|
|
@ -430,7 +430,7 @@ std::list<FBSmartHomeDevice> *FBSmartHome::GetDevices() {
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* read data from device and fill out FBSmartHomeHZR structure
|
|
|
|
* read data from device and fill out FBSmartHomeHZR structure
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int FBSmartHome::GetHZR(std::string ain, FBSmartHomeHZR *hzr) {
|
|
|
|
int FBSmartHome::GetHKR(std::string ain, FBSmartHomeHKR *hkr) {
|
|
|
|
std::string s;
|
|
|
|
std::string s;
|
|
|
|
FBSmartHomeDevice smd;
|
|
|
|
FBSmartHomeDevice smd;
|
|
|
|
xmlDocPtr xmldoc;
|
|
|
|
xmlDocPtr xmldoc;
|
|
|
@ -438,7 +438,7 @@ int FBSmartHome::GetHZR(std::string ain, FBSmartHomeHZR *hzr) {
|
|
|
|
xmlAttrPtr xmlattr;
|
|
|
|
xmlAttrPtr xmlattr;
|
|
|
|
int len, i;
|
|
|
|
int len, i;
|
|
|
|
|
|
|
|
|
|
|
|
if (hzr == NULL) return -1;
|
|
|
|
if (hkr == NULL) return -1;
|
|
|
|
for (s = "", i = 0; i < (int)ain.length(); i++) {
|
|
|
|
for (s = "", i = 0; i < (int)ain.length(); i++) {
|
|
|
|
if (ain[i] == ' ') s += "%20";
|
|
|
|
if (ain[i] == ' ') s += "%20";
|
|
|
|
else s += ain[i];
|
|
|
|
else s += ain[i];
|
|
|
@ -469,49 +469,49 @@ int FBSmartHome::GetHZR(std::string ain, FBSmartHomeHZR *hzr) {
|
|
|
|
xmlattr = xmlnode->properties;
|
|
|
|
xmlattr = xmlnode->properties;
|
|
|
|
while (xmlattr) {
|
|
|
|
while (xmlattr) {
|
|
|
|
if (!xmlStrcmp(xmlattr->name, (const xmlChar *)"identifier"))
|
|
|
|
if (!xmlStrcmp(xmlattr->name, (const xmlChar *)"identifier"))
|
|
|
|
hzr->id = (char *) xmlNodeListGetString(xmldoc, xmlattr->children, 1);
|
|
|
|
hkr->id = (char *) xmlNodeListGetString(xmldoc, xmlattr->children, 1);
|
|
|
|
xmlattr = xmlattr->next;
|
|
|
|
xmlattr = xmlattr->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (xmlchild) {
|
|
|
|
while (xmlchild) {
|
|
|
|
|
|
|
|
|
|
|
|
// name
|
|
|
|
// name
|
|
|
|
if (!xmlStrcmp(xmlchild->name, (const xmlChar *)"name"))
|
|
|
|
if (!xmlStrcmp(xmlchild->name, (const xmlChar *)"name"))
|
|
|
|
hzr->name = (char *) xmlNodeListGetString(xmldoc, xmlchild->children, 1);
|
|
|
|
hkr->name = (char *) xmlNodeListGetString(xmldoc, xmlchild->children, 1);
|
|
|
|
|
|
|
|
|
|
|
|
// temperatur
|
|
|
|
// temperatur
|
|
|
|
else if (!xmlStrcmp(xmlchild->name, (const xmlChar *)"temperature")) {
|
|
|
|
else if (!xmlStrcmp(xmlchild->name, (const xmlChar *)"temperature")) {
|
|
|
|
xmlNodePtr xmlc = xmlchild->children;
|
|
|
|
xmlNodePtr xmlc = xmlchild->children;
|
|
|
|
while(xmlc) {
|
|
|
|
while(xmlc) {
|
|
|
|
if (!xmlStrcmp(xmlc->name, (const xmlChar *)"celsius")) {
|
|
|
|
if (!xmlStrcmp(xmlc->name, (const xmlChar *)"celsius")) {
|
|
|
|
hzr->temp = (atof ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1))) / 10.0;
|
|
|
|
hkr->temp = (atof ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1))) / 10.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!xmlStrcmp(xmlc->name, (const xmlChar *)"offset")) {
|
|
|
|
else if (!xmlStrcmp(xmlc->name, (const xmlChar *)"offset")) {
|
|
|
|
hzr->offset = atoi ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
hkr->offset = atoi ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
xmlc = xmlc->next;
|
|
|
|
xmlc = xmlc->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// hzr
|
|
|
|
// hkr
|
|
|
|
else if (!xmlStrcmp(xmlchild->name, (const xmlChar *)"hkr")) {
|
|
|
|
else if (!xmlStrcmp(xmlchild->name, (const xmlChar *)"hkr")) {
|
|
|
|
xmlNodePtr xmlc = xmlchild->children;
|
|
|
|
xmlNodePtr xmlc = xmlchild->children;
|
|
|
|
while(xmlc) {
|
|
|
|
while(xmlc) {
|
|
|
|
if (!xmlStrcmp(xmlc->name, (const xmlChar *)"tist")) {
|
|
|
|
if (!xmlStrcmp(xmlc->name, (const xmlChar *)"tist")) {
|
|
|
|
hzr->temp_cur = atof ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
hkr->temp_cur = atof ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
hzr->temp_cur = hzr->temp_cur / 2.0;
|
|
|
|
hkr->temp_cur = hkr->temp_cur / 2.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!xmlStrcmp(xmlc->name, (const xmlChar *)"tsoll")) {
|
|
|
|
else if (!xmlStrcmp(xmlc->name, (const xmlChar *)"tsoll")) {
|
|
|
|
hzr->temp_set = atof ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
hkr->temp_set = atof ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
hzr->temp_set = hzr->temp_set / 2.0;
|
|
|
|
hkr->temp_set = hkr->temp_set / 2.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!xmlStrcmp(xmlc->name, (const xmlChar *)"absenk")) {
|
|
|
|
else if (!xmlStrcmp(xmlc->name, (const xmlChar *)"absenk")) {
|
|
|
|
hzr->temp_l = atof ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
hkr->temp_l = atof ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
hzr->temp_l = hzr->temp_l / 2.0;
|
|
|
|
hkr->temp_l = hkr->temp_l / 2.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!xmlStrcmp(xmlc->name, (const xmlChar *)"komfort")) {
|
|
|
|
else if (!xmlStrcmp(xmlc->name, (const xmlChar *)"komfort")) {
|
|
|
|
hzr->temp_h = atof ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
hkr->temp_h = atof ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
hzr->temp_h = hzr->temp_h / 2.0;
|
|
|
|
hkr->temp_h = hkr->temp_h / 2.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
xmlc = xmlc->next;
|
|
|
|
xmlc = xmlc->next;
|
|
|
@ -561,18 +561,18 @@ int FBSmartHome::GetHZR(std::string ain, FBSmartHomeHZR *hzr) {
|
|
|
|
if (!xmlStrcmp(xmlattr->name, (const xmlChar *)"count"))
|
|
|
|
if (!xmlStrcmp(xmlattr->name, (const xmlChar *)"count"))
|
|
|
|
count = atoi((char *) xmlNodeListGetString(xmldoc, xmlattr->children, 1));
|
|
|
|
count = atoi((char *) xmlNodeListGetString(xmldoc, xmlattr->children, 1));
|
|
|
|
else if (!xmlStrcmp(xmlattr->name, (const xmlChar *)"grid"))
|
|
|
|
else if (!xmlStrcmp(xmlattr->name, (const xmlChar *)"grid"))
|
|
|
|
hzr-> statsgrid = atoi((char *) xmlNodeListGetString(xmldoc, xmlattr->children, 1));
|
|
|
|
hkr-> statsgrid = atoi((char *) xmlNodeListGetString(xmldoc, xmlattr->children, 1));
|
|
|
|
xmlattr = xmlattr->next;
|
|
|
|
xmlattr = xmlattr->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
txt = ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
txt = ((char *) xmlNodeListGetString(xmldoc, xmlc->children, 1));
|
|
|
|
|
|
|
|
|
|
|
|
hzr->stats.clear();
|
|
|
|
hkr->stats.clear();
|
|
|
|
t = (char*)txt.c_str();
|
|
|
|
t = (char*)txt.c_str();
|
|
|
|
for (int i = 0; t != NULL && i < count; i++) {
|
|
|
|
for (int i = 0; t != NULL && i < count; i++) {
|
|
|
|
if (*t == ',') t++;
|
|
|
|
if (*t == ',') t++;
|
|
|
|
f = atoi (t);
|
|
|
|
f = atoi (t);
|
|
|
|
hzr->stats.push_back(f);
|
|
|
|
hkr->stats.push_back(f);
|
|
|
|
t = strchr(t, ',');
|
|
|
|
t = strchr(t, ',');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|