thermferm/server.c

changeset 676
09b5efe0c633
parent 666
48cc8868f9f4
child 677
c867eb3f7fc1
equal deleted inserted replaced
675:825210ba2707 676:09b5efe0c633
611 srv_send(s, (char *)"NEXT_UNIT,%d", Config.next_unit); 611 srv_send(s, (char *)"NEXT_UNIT,%d", Config.next_unit);
612 srv_send(s, (char *)"MQTT_HOST,%s", Config.mqtt_host); 612 srv_send(s, (char *)"MQTT_HOST,%s", Config.mqtt_host);
613 srv_send(s, (char *)"MQTT_PORT,%d", Config.mqtt_port); 613 srv_send(s, (char *)"MQTT_PORT,%d", Config.mqtt_port);
614 srv_send(s, (char *)"MQTT_USER,%s", Config.mqtt_username); 614 srv_send(s, (char *)"MQTT_USER,%s", Config.mqtt_username);
615 srv_send(s, (char *)"MQTT_PASS,%s", Config.mqtt_password); 615 srv_send(s, (char *)"MQTT_PASS,%s", Config.mqtt_password);
616 srv_send(s, (char *)"WEBSOCKET_PORT,%d", Config.websocket_port);
616 srv_send(s, (char *)"."); 617 srv_send(s, (char *)".");
617 return 0; 618 return 0;
618 } 619 }
619 620
620 if (strcmp(opt, (char *)"PUT") == 0) { 621 if (strcmp(opt, (char *)"PUT") == 0) {
748 free(Config.mqtt_password); 749 free(Config.mqtt_password);
749 if (val) 750 if (val)
750 Config.mqtt_password = xstrcpy(val); 751 Config.mqtt_password = xstrcpy(val);
751 else 752 else
752 Config.mqtt_password = NULL; 753 Config.mqtt_password = NULL;
754
755 } else if (val && (strcmp(kwd, (char *)"WEBSOCKET_PORT") == 0)) {
756 if (sscanf(val, "%d", &ival) == 1) {
757 if (Config.websocket_port != ival) {
758 syslog(LOG_NOTICE, "Global Websocket port %d to %d", Config.websocket_port, ival);
759 Config.websocket_port = ival;
760 }
761 }
753 762
754 } 763 }
755 } 764 }
756 } 765 }
757 } 766 }

mercurial