Ejemplo n.º 1
0
static struct threadqueue_t *initDev(JsonNode *jdevice) {
	char *platform = GPIO_PLATFORM;

	if(config_setting_get_string("gpio-platform", 0, &platform) != 0) {
		logprintf(LOG_ERR, "no gpio-platform configured");
		return NULL;
	}
	if(strcmp(platform, "none") == 0) {
		FREE(platform);
		logprintf(LOG_ERR, "no gpio-platform configured");
		return NULL;
	}
	if(wiringXSetup(platform, logprintf1) < 0) {
		FREE(platform);
		return NULL;
	}
	FREE(platform);

	loop = 1;
	char *output = json_stringify(jdevice, NULL);
	JsonNode *json = json_decode(output);
	json_free(output);

	struct protocol_threads_t *node = protocol_thread_init(gpio_switch, json);
	return threads_register("gpio_switch", &thread, (void *)node, 0);
}
Ejemplo n.º 2
0
static struct threadqueue_t *initDev(JsonNode *jdevice) {
	loop = 1;
	char *output = json_stringify(jdevice, NULL);
	JsonNode *json = json_decode(output);
	json_free(output);

	struct protocol_threads_t *node = protocol_thread_init(ds18s20, json);
	return threads_register("ds18s20", &thread, (void *)node, 0);
}
Ejemplo n.º 3
0
struct threadqueue_t *ds18b20InitDev(JsonNode *jdevice) {
	ds18b20_loop = 1;
	char *output = json_stringify(jdevice, NULL);
	JsonNode *json = json_decode(output);
	sfree((void *)&output);

	struct protocol_threads_t *node = protocol_thread_init(ds18b20, json);
	return threads_register("ds18b20", &ds18b20Parse, (void *)node, 0);
}
Ejemplo n.º 4
0
struct threadqueue_t *programInitDev(JsonNode *jdevice) {
	program_loop = 1;
	char *output = json_stringify(jdevice, NULL);
	JsonNode *json = json_decode(output);
	sfree((void *)&output);

	struct protocol_threads_t *node = protocol_thread_init(program, json);	
	return threads_register("program", &programParse, (void *)node, 0);
}
Ejemplo n.º 5
0
struct threadqueue_t *xbmcInitDev(JsonNode *jdevice) {
	xbmc_loop = 1;
	char *output = json_stringify(jdevice, NULL);
	JsonNode *json = json_decode(output);
	sfree((void *)&output);

	struct protocol_threads_t *node = protocol_thread_init(xbmc, json);	
	return threads_register("xbmc", &xbmcParse, (void *)node, 0);
}
Ejemplo n.º 6
0
static struct threadqueue_t *dht22InitDev(JsonNode *jdevice) {
	dht22_loop = 1;
	wiringXSetup();
	char *output = json_stringify(jdevice, NULL);
	JsonNode *json = json_decode(output);
	json_free(output);

	struct protocol_threads_t *node = protocol_thread_init(dht22, json);
	return threads_register("dht22", &dht22Parse, (void *)node, 0);
}
Ejemplo n.º 7
0
struct threadqueue_t *lircInitDev(JsonNode *jdevice) {
	lirc_loop = 1;

	struct protocol_threads_t *node = protocol_thread_init(lirc, NULL);	
	return threads_register("lirc", &lircParse, (void *)node, 0);
}