thermferm/server.c

changeset 418
0bfe08c7ba6e
parent 398
efdfef1677d1
child 492
750f2468dec5
equal deleted inserted replaced
417:9943f49fdb98 418:0bfe08c7ba6e
1000 srv_send((char *)"TEMP_STATE,%s", TEMPSTATE[Config.temp_state]); 1000 srv_send((char *)"TEMP_STATE,%s", TEMPSTATE[Config.temp_state]);
1001 srv_send((char *)"TEMP_VALUE,%.1f", Config.temp_value / 1000.0); 1001 srv_send((char *)"TEMP_VALUE,%.1f", Config.temp_value / 1000.0);
1002 srv_send((char *)"HUM_ADDRESS,%s", Config.hum_address); 1002 srv_send((char *)"HUM_ADDRESS,%s", Config.hum_address);
1003 srv_send((char *)"HUM_STATE,%s", TEMPSTATE[Config.hum_state]); 1003 srv_send((char *)"HUM_STATE,%s", TEMPSTATE[Config.hum_state]);
1004 srv_send((char *)"HUM_VALUE,%.0f", Config.hum_value / 1000.0); 1004 srv_send((char *)"HUM_VALUE,%.0f", Config.hum_value / 1000.0);
1005 #ifdef HAVE_WIRINGPI_H
1006 srv_send((char *)"LCD_COLS,%d", Config.lcd_cols); 1005 srv_send((char *)"LCD_COLS,%d", Config.lcd_cols);
1007 srv_send((char *)"LCD_ROWS,%d", Config.lcd_rows); 1006 srv_send((char *)"LCD_ROWS,%d", Config.lcd_rows);
1008 #endif
1009 srv_send((char *)"."); 1007 srv_send((char *)".");
1010 return 0; 1008 return 0;
1011 } 1009 }
1012 1010
1013 if (strcmp(opt, (char *)"PUT") == 0) { 1011 if (strcmp(opt, (char *)"PUT") == 0) {
1072 Config.hum_address = xstrcpy(val); 1070 Config.hum_address = xstrcpy(val);
1073 device_count(TRUE, Config.hum_address); 1071 device_count(TRUE, Config.hum_address);
1074 } else 1072 } else
1075 Config.hum_address = NULL; 1073 Config.hum_address = NULL;
1076 1074
1077 #ifdef HAVE_WIRINGPI_H
1078 } else if (val && (strcmp(kwd, (char *)"LCD_COLS") == 0)) { 1075 } else if (val && (strcmp(kwd, (char *)"LCD_COLS") == 0)) {
1079 if (sscanf(val, "%d", &ival) == 1) { 1076 if (sscanf(val, "%d", &ival) == 1) {
1080 if (Config.lcd_cols != ival) 1077 if (Config.lcd_cols != ival)
1081 syslog(LOG_NOTICE, "Global LCD columns %d to %d", Config.lcd_cols, ival); 1078 syslog(LOG_NOTICE, "Global LCD columns %d to %d", Config.lcd_cols, ival);
1082 Config.lcd_cols = ival; 1079 Config.lcd_cols = ival;
1086 if (sscanf(val, "%d", &ival) == 1) { 1083 if (sscanf(val, "%d", &ival) == 1) {
1087 if (Config.lcd_rows != ival) 1084 if (Config.lcd_rows != ival)
1088 syslog(LOG_NOTICE, "Global LCD rows %d to %d", Config.lcd_rows, ival); 1085 syslog(LOG_NOTICE, "Global LCD rows %d to %d", Config.lcd_rows, ival);
1089 Config.lcd_rows = ival; 1086 Config.lcd_rows = ival;
1090 } 1087 }
1091 #endif
1092 } 1088 }
1093 } 1089 }
1094 } 1090 }
1095 } 1091 }
1096 } 1092 }
2034 tmpu->next = unit; 2030 tmpu->next = unit;
2035 break; 2031 break;
2036 } 2032 }
2037 } 2033 }
2038 } 2034 }
2039 #ifdef HAVE_WIRINGPI_H
2040 lcd_buf_reset(); 2035 lcd_buf_reset();
2041 #endif
2042 run_pause = FALSE; 2036 run_pause = FALSE;
2043 2037
2044 syslog(LOG_NOTICE, "Unit %s added", unit->uuid); 2038 syslog(LOG_NOTICE, "Unit %s added", unit->uuid);
2045 srv_send((char *)"211 Unit %s added", unit->uuid); 2039 srv_send((char *)"211 Unit %s added", unit->uuid);
2046 return 1; 2040 return 1;
2056 if (run_hold) 2050 if (run_hold)
2057 break; 2051 break;
2058 } 2052 }
2059 2053
2060 rc = delete_Unit(param); 2054 rc = delete_Unit(param);
2061 #ifdef HAVE_WIRINGPI_H
2062 lcd_buf_reset(); 2055 lcd_buf_reset();
2063 #endif
2064 run_pause = FALSE; 2056 run_pause = FALSE;
2065 2057
2066 if (rc) { 2058 if (rc) {
2067 syslog(LOG_NOTICE, "Unit %s deleted", param); 2059 syslog(LOG_NOTICE, "Unit %s deleted", param);
2068 srv_send((char *)"211 Unit %s deleted", param); 2060 srv_send((char *)"211 Unit %s deleted", param);

mercurial