#include #include #include #include #include #include #include controller* controller_create(void) { controller *result = malloc(sizeof(*result)); uuid_generate(result->uuid); strcpy(result->name, "new emgauwa device"); result->port = 0; result->relay_count = 10; result->relays = malloc(sizeof(*result->relays) * result->relay_count); uint8_t i; for(i = 0; i < result->relay_count; i++) { result->relays[i] = relay_init(i); } return result; } void controller_debug(controller *cntrlr) { char uuid_str[37]; uuid_unparse(cntrlr->uuid, uuid_str); printf("%s @ %p\n", uuid_str, cntrlr); printf("name: %s\n", cntrlr->name); printf("port: %5d relays: %3d\n", cntrlr->port, cntrlr->relay_count); }