scrcpy/app/src/controller.h

48 lines
999 B
C
Raw Normal View History

#ifndef CONTROLLER_H
#define CONTROLLER_H
#include "common.h"
#include <stdbool.h>
#include "control_msg.h"
#include "receiver.h"
#include "util/acksync.h"
2019-11-24 18:53:00 +08:00
#include "util/cbuf.h"
#include "util/net.h"
#include "util/thread.h"
2022-01-15 05:17:30 +08:00
struct sc_control_msg_queue CBUF(struct control_msg, 64);
2022-01-15 05:17:30 +08:00
struct sc_controller {
sc_socket control_socket;
sc_thread thread;
sc_mutex mutex;
sc_cond msg_cond;
bool stopped;
2022-01-15 05:17:30 +08:00
struct sc_control_msg_queue queue;
struct receiver receiver;
};
bool
2022-01-15 05:17:30 +08:00
sc_controller_init(struct sc_controller *controller, sc_socket control_socket,
struct sc_acksync *acksync);
void
2022-01-15 05:17:30 +08:00
sc_controller_destroy(struct sc_controller *controller);
bool
2022-01-15 05:17:30 +08:00
sc_controller_start(struct sc_controller *controller);
void
2022-01-15 05:17:30 +08:00
sc_controller_stop(struct sc_controller *controller);
void
2022-01-15 05:17:30 +08:00
sc_controller_join(struct sc_controller *controller);
bool
2022-01-15 05:17:30 +08:00
sc_controller_push_msg(struct sc_controller *controller,
const struct control_msg *msg);
#endif