thermometers/main.c

changeset 10
5600a1789644
parent 8
e584bc0177df
child 11
f78f313b1d34
equal deleted inserted replaced
9:91218bc77abc 10:5600a1789644
179 struct mosquitto *mosq = NULL; 179 struct mosquitto *mosq = NULL;
180 char hostname[256], buf[1024]; 180 char hostname[256], buf[1024];
181 int rc, keepalive = 60; 181 int rc, keepalive = 60;
182 unsigned int max_inflight = 20; 182 unsigned int max_inflight = 20;
183 char err[1024]; 183 char err[1024];
184 w1_therm *tmp1, *old1;
184 185
185 /* 186 /*
186 * Initialize mosquitto communication 187 * Initialize mosquitto communication
187 */ 188 */
188 mosquitto_lib_init(); 189 mosquitto_lib_init();
272 do { 273 do {
273 if (status == STATUS_CONNACK_RECVD) { 274 if (status == STATUS_CONNACK_RECVD) {
274 /* 275 /*
275 * Sleep just log enough to keep the system load low. 276 * Sleep just log enough to keep the system load low.
276 */ 277 */
277 usleep(1); 278 // usleep(1);
278 /* 279 /*
279 * Here send our sensors values 280 * Here send our sensors values
280 */ 281 */
282 for (tmp1 = Config.w1therms; tmp1; tmp1 = old1) {
283 old1 = tmp1->next;
284 fprintf(stdout, "s: %s\n", tmp1->name);
285 }
286 usleep(15000000);
281 287
282 if (shutdown) { 288 if (shutdown) {
283 /* 289 /*
284 * Final publish 0 to clients/<hostname>/thermometers/state 290 * Final publish 0 to clients/<hostname>/thermometers/state
285 */ 291 */

mercurial