f6320c7e31
The goal is to expose a consistent API for system tools, and paves the way to make the "core" independant of SDL in the future.
45 lines
876 B
C
45 lines
876 B
C
#ifndef CONTROLLER_H
|
|
#define CONTROLLER_H
|
|
|
|
#include "common.h"
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "control_msg.h"
|
|
#include "receiver.h"
|
|
#include "util/cbuf.h"
|
|
#include "util/net.h"
|
|
#include "util/thread.h"
|
|
|
|
struct control_msg_queue CBUF(struct control_msg, 64);
|
|
|
|
struct controller {
|
|
socket_t control_socket;
|
|
sc_thread thread;
|
|
sc_mutex mutex;
|
|
sc_cond msg_cond;
|
|
bool stopped;
|
|
struct control_msg_queue queue;
|
|
struct receiver receiver;
|
|
};
|
|
|
|
bool
|
|
controller_init(struct controller *controller, socket_t control_socket);
|
|
|
|
void
|
|
controller_destroy(struct controller *controller);
|
|
|
|
bool
|
|
controller_start(struct controller *controller);
|
|
|
|
void
|
|
controller_stop(struct controller *controller);
|
|
|
|
void
|
|
controller_join(struct controller *controller);
|
|
|
|
bool
|
|
controller_push_msg(struct controller *controller,
|
|
const struct control_msg *msg);
|
|
|
|
#endif
|