diff --git a/app/src/controller.c b/app/src/controller.c index cdf53edb..4a1d2b1d 100644 --- a/app/src/controller.c +++ b/app/src/controller.c @@ -9,20 +9,20 @@ sc_controller_init(struct sc_controller *controller, sc_socket control_socket, struct sc_acksync *acksync) { cbuf_init(&controller->queue); - bool ok = receiver_init(&controller->receiver, control_socket, acksync); + bool ok = sc_receiver_init(&controller->receiver, control_socket, acksync); if (!ok) { return false; } ok = sc_mutex_init(&controller->mutex); if (!ok) { - receiver_destroy(&controller->receiver); + sc_receiver_destroy(&controller->receiver); return false; } ok = sc_cond_init(&controller->msg_cond); if (!ok) { - receiver_destroy(&controller->receiver); + sc_receiver_destroy(&controller->receiver); sc_mutex_destroy(&controller->mutex); return false; } @@ -43,7 +43,7 @@ sc_controller_destroy(struct sc_controller *controller) { sc_control_msg_destroy(&msg); } - receiver_destroy(&controller->receiver); + sc_receiver_destroy(&controller->receiver); } bool @@ -117,7 +117,7 @@ sc_controller_start(struct sc_controller *controller) { return false; } - if (!receiver_start(&controller->receiver)) { + if (!sc_receiver_start(&controller->receiver)) { sc_controller_stop(controller); sc_thread_join(&controller->thread, NULL); return false; @@ -137,5 +137,5 @@ sc_controller_stop(struct sc_controller *controller) { void sc_controller_join(struct sc_controller *controller) { sc_thread_join(&controller->thread, NULL); - receiver_join(&controller->receiver); + sc_receiver_join(&controller->receiver); } diff --git a/app/src/controller.h b/app/src/controller.h index f8662353..67c3c58d 100644 --- a/app/src/controller.h +++ b/app/src/controller.h @@ -21,7 +21,7 @@ struct sc_controller { sc_cond msg_cond; bool stopped; struct sc_control_msg_queue queue; - struct receiver receiver; + struct sc_receiver receiver; }; bool diff --git a/app/src/receiver.c b/app/src/receiver.c index 0376948d..e715a8e6 100644 --- a/app/src/receiver.c +++ b/app/src/receiver.c @@ -7,7 +7,7 @@ #include "util/log.h" bool -receiver_init(struct receiver *receiver, sc_socket control_socket, +sc_receiver_init(struct sc_receiver *receiver, sc_socket control_socket, struct sc_acksync *acksync) { bool ok = sc_mutex_init(&receiver->mutex); if (!ok) { @@ -21,12 +21,12 @@ receiver_init(struct receiver *receiver, sc_socket control_socket, } void -receiver_destroy(struct receiver *receiver) { +sc_receiver_destroy(struct sc_receiver *receiver) { sc_mutex_destroy(&receiver->mutex); } static void -process_msg(struct receiver *receiver, struct device_msg *msg) { +process_msg(struct sc_receiver *receiver, struct device_msg *msg) { switch (msg->type) { case DEVICE_MSG_TYPE_CLIPBOARD: { char *current = SDL_GetClipboardText(); @@ -51,7 +51,7 @@ process_msg(struct receiver *receiver, struct device_msg *msg) { } static ssize_t -process_msgs(struct receiver *receiver, const unsigned char *buf, size_t len) { +process_msgs(struct sc_receiver *receiver, const unsigned char *buf, size_t len) { size_t head = 0; for (;;) { struct device_msg msg; @@ -76,7 +76,7 @@ process_msgs(struct receiver *receiver, const unsigned char *buf, size_t len) { static int run_receiver(void *data) { - struct receiver *receiver = data; + struct sc_receiver *receiver = data; static unsigned char buf[DEVICE_MSG_MAX_SIZE]; size_t head = 0; @@ -108,7 +108,7 @@ run_receiver(void *data) { } bool -receiver_start(struct receiver *receiver) { +sc_receiver_start(struct sc_receiver *receiver) { LOGD("Starting receiver thread"); bool ok = sc_thread_create(&receiver->thread, run_receiver, @@ -122,6 +122,6 @@ receiver_start(struct receiver *receiver) { } void -receiver_join(struct receiver *receiver) { +sc_receiver_join(struct sc_receiver *receiver) { sc_thread_join(&receiver->thread, NULL); } diff --git a/app/src/receiver.h b/app/src/receiver.h index f5808e4b..eb959fb8 100644 --- a/app/src/receiver.h +++ b/app/src/receiver.h @@ -11,7 +11,7 @@ // receive events from the device // managed by the controller -struct receiver { +struct sc_receiver { sc_socket control_socket; sc_thread thread; sc_mutex mutex; @@ -20,18 +20,18 @@ struct receiver { }; bool -receiver_init(struct receiver *receiver, sc_socket control_socket, - struct sc_acksync *acksync); +sc_receiver_init(struct sc_receiver *receiver, sc_socket control_socket, + struct sc_acksync *acksync); void -receiver_destroy(struct receiver *receiver); +sc_receiver_destroy(struct sc_receiver *receiver); bool -receiver_start(struct receiver *receiver); +sc_receiver_start(struct sc_receiver *receiver); -// no receiver_stop(), it will automatically stop on control_socket shutdown +// no sc_receiver_stop(), it will automatically stop on control_socket shutdown void -receiver_join(struct receiver *receiver); +sc_receiver_join(struct sc_receiver *receiver); #endif