diff options
Diffstat (limited to 'srs-client/include')
-rw-r--r-- | srs-client/include/srs-client.h | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/srs-client/include/srs-client.h b/srs-client/include/srs-client.h index 632e882..16eee49 100644 --- a/srs-client/include/srs-client.h +++ b/srs-client/include/srs-client.h @@ -1,7 +1,7 @@ /* * This file is part of Samsung-RIL. * - * Copyright (C) 2013 Paul Kocialkowski <contact@oaulk.fr> + * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr> * * Samsung-RIL is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,43 +17,46 @@ * along with Samsung-RIL. If not, see <http://www.gnu.org/licenses/>. */ -#include <pthread.h> - -#include <samsung-ril-socket.h> - #ifndef _SRS_CLIENT_H_ #define _SRS_CLIENT_H_ -#define SRS_CLIENT_TIMEOUT 500000 +#include <stdlib.h> +#include <pthread.h> -#define SRS_CLIENT_LOCK(client) pthread_mutex_lock(&(client->mutex)) -#define SRS_CLIENT_UNLOCK(client) pthread_mutex_unlock(&(client->mutex)) +#include <samsung-ril-socket.h> -typedef void (*srs_client_thread_cb)(struct srs_message *message); +#define SRS_CLIENT_LOCK(client) pthread_mutex_lock(&client->mutex) +#define SRS_CLIENT_UNLOCK(client) pthread_mutex_unlock(&client->mutex) struct srs_client { int fd; + int event_fd; pthread_mutex_t mutex; pthread_t thread; - int thread_run; - srs_client_thread_cb thread_cb; + void (*callback)(struct srs_client *client, struct srs_message *message); }; -int srs_client_recv_message(struct srs_client *client, struct srs_message *message); -int srs_client_send_message(struct srs_client *client, struct srs_message *message); -int srs_client_send(struct srs_client *client, unsigned short command, void *data, int length); +const char *srs_command_string(unsigned short command); +int srs_header_setup(struct srs_header *header, + const struct srs_message *message); +int srs_message_setup(const struct srs_header *header, + struct srs_message *message); +int srs_ping(struct srs_client *client); + +struct srs_client *srs_client_create(void); +int srs_client_destroy(struct srs_client *client); int srs_client_open(struct srs_client *client); int srs_client_close(struct srs_client *client); -int srs_client_create(struct srs_client **client_p); -int srs_client_destroy(struct srs_client *client); - -int srs_client_thread_start(struct srs_client *client, - srs_client_thread_cb cb); -int srs_client_thread_stop(struct srs_client *client); - -int srs_client_ping(struct srs_client *client); +int srs_client_poll(struct srs_client *client); +int srs_client_send(struct srs_client *client, unsigned short command, + void *data, size_t size); +int srs_client_recv(struct srs_client *client, struct srs_message *message); +int srs_client_loop(struct srs_client *client); +int srs_client_loop_start(struct srs_client *client, + void (*callback)(struct srs_client *client, struct srs_message *message)); +int srs_client_loop_stop(struct srs_client *client); #endif |