187 |
187 |
188 #ifdef HAVE_WIRINGPI_H |
188 #ifdef HAVE_WIRINGPI_H |
189 rc = 0; |
189 rc = 0; |
190 if ((device->type == DEVTYPE_RC433) && (device->gpiopin != -1) && (device->present == DEVPRESENT_YES)) { |
190 if ((device->type == DEVTYPE_RC433) && (device->gpiopin != -1) && (device->present == DEVPRESENT_YES)) { |
191 enableTransmit(device->gpiopin); |
191 enableTransmit(device->gpiopin); |
192 // usleep(10000); |
|
193 snprintf(buf, 39, "%s,%d", device->address, value ? 1:0); |
192 snprintf(buf, 39, "%s,%d", device->address, value ? 1:0); |
194 for (i = 0; i < strlen(buf); i++) |
193 for (i = 0; i < strlen(buf); i++) |
195 if (buf[i] == '-') |
194 if (buf[i] == '-') |
196 buf[i] = ','; |
195 buf[i] = ','; |
197 rc = toggleSwitch(buf); |
196 rc = toggleSwitch(buf); |
198 syslog(LOG_NOTICE, "RC433 command %s rc=%d", buf, rc); |
197 syslog(LOG_NOTICE, "RC433 command %s rc=%d", buf, rc); |
199 if (debug) |
198 if (debug) |
200 fprintf(stdout, "RC433 command %s rc=%d\n", buf, rc); |
199 fprintf(stdout, "RC433 command %s rc=%d\n", buf, rc); |
201 // usleep(50000); |
|
202 disableTransmit(); |
200 disableTransmit(); |
203 device->value = value; |
201 device->value = value; |
204 device->timestamp = time(NULL); |
202 device->timestamp = time(NULL); |
205 return rc; |
203 return rc; |
206 } |
204 } |
407 char *addr = NULL, line[60], *p = NULL; |
405 char *addr = NULL, line[60], *p = NULL; |
408 FILE *fp; |
406 FILE *fp; |
409 int temp, rc; |
407 int temp, rc; |
410 |
408 |
411 syslog(LOG_NOTICE, "Thread my_devices_loop started"); |
409 syslog(LOG_NOTICE, "Thread my_devices_loop started"); |
412 if (debug) |
|
413 fprintf(stdout, "Thread my_devices_loop started\n"); |
|
414 |
410 |
415 /* |
411 /* |
416 * Loop forever until the external shutdown variable is set. |
412 * Loop forever until the external shutdown variable is set. |
417 */ |
413 */ |
418 for (;;) { |
414 for (;;) { |