aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-06-27 12:58:30 +0200
committerPaul Kocialkowski <contact@paulk.fr>2013-06-27 12:58:30 +0200
commitb73c6cf5a94e1c7f9be38917f26da37e13fe452e (patch)
tree569586654512f79d70a1bb065b15b8f9f3373a0e /include
parent0916c6823f2af47257b09899ba62e44eb56eee72 (diff)
downloadexternal_libsamsung-ipc-b73c6cf5a94e1c7f9be38917f26da37e13fe452e.zip
external_libsamsung-ipc-b73c6cf5a94e1c7f9be38917f26da37e13fe452e.tar.gz
external_libsamsung-ipc-b73c6cf5a94e1c7f9be38917f26da37e13fe452e.tar.bz2
Rework handlers and ipc functions for better consistency
Detailed list of the changes introduced by this commit: * Rename ipc_client_bootstrap_modem to ipc_client_bootstrap * Rename ipc_client_new/free to ipc_client_create/destroy * Rename log_handler to log_callback and change arguments order * Remove handlers common data and fd mechanisms * Set transport, power and gprs common data for handlers * Add data_create and data_destroy handlers * Rework arguments order for handlers * Add poll transport handler * Remove functions types typedefs * Remove dumb ipc_client_send_* functions * Remove ipc_client_gprs_handlers_available * Adapt device files for the new API changes * Adapt modemctrl for the new API changes Change-Id: Ia9ba1045dbbf9f5e31a201aa8629b49019158972 Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'include')
-rw-r--r--include/samsung-ipc.h75
1 files changed, 40 insertions, 35 deletions
diff --git a/include/samsung-ipc.h b/include/samsung-ipc.h
index b1d19be..02d2e07 100644
--- a/include/samsung-ipc.h
+++ b/include/samsung-ipc.h
@@ -19,6 +19,8 @@
*
*/
+#include <time.h>
+
#ifndef __SAMSUNG_IPC_H__
#define __SAMSUNG_IPC_H__
@@ -56,50 +58,53 @@ struct ipc_client_gprs_capabilities {
* Helpers
*/
-typedef void (*ipc_client_log_handler_cb)(const char *message, void *user_data);
-
-typedef int (*ipc_io_handler_cb)(void *data, unsigned int size, void *io_data);
-typedef int (*ipc_handler_cb)(void *io_data);
-
-struct ipc_client* ipc_client_new(int client_type);
-struct ipc_client *ipc_client_new_for_device(int device_type, int client_type);
-int ipc_client_free(struct ipc_client *client);
-
-int ipc_client_set_log_handler(struct ipc_client *client,
- ipc_client_log_handler_cb log_handler_cb, void *user_data);
-
-int ipc_client_set_handlers(struct ipc_client *client,
- struct ipc_handlers *handlers);
-int ipc_client_set_io_handlers(struct ipc_client *client,
- ipc_io_handler_cb read, void *read_data,
- ipc_io_handler_cb write, void *write_data);
-
-int ipc_client_set_handlers_common_data(struct ipc_client *client, void *data);
-void *ipc_client_get_handlers_common_data(struct ipc_client *client);
-int ipc_client_create_handlers_common_data(struct ipc_client *client);
-int ipc_client_destroy_handlers_common_data(struct ipc_client *client);
-int ipc_client_set_handlers_common_data_fd(struct ipc_client *client, int fd);
-int ipc_client_get_handlers_common_data_fd(struct ipc_client *client);
+struct ipc_client *ipc_client_create(int client_type);
+int ipc_client_destroy(struct ipc_client *client);
+
+void ipc_client_log(struct ipc_client *client, const char *message, ...);
+int ipc_client_set_log_callback(struct ipc_client *client,
+ void (*log_callback)(void *log_data, const char *message), void *log_data);
+
+int ipc_client_set_transport_handlers(struct ipc_client *client,
+ int (*open)(void *transport_data, int type),
+ int (*close)(void *transport_data),
+ int (*read)(void *transport_data, void *buffer, unsigned int length),
+ int (*write)(void *transport_data, void *buffer, unsigned int length),
+ int (*poll)(void *transport_data, struct timeval *timeout),
+ void *transport_data);
+int ipc_client_set_power_handlers(struct ipc_client *client,
+ int (*power_on)(void *power_data),
+ int (*power_off)(void *power_data),
+ void *power_data);
+int ipc_client_set_gprs_handlers(struct ipc_client *client,
+ int (*gprs_activate)(void *gprs_data, int cid),
+ int (*gprs_deactivate)(void *gprs_data, int cid),
+ void *gprs_data);
+
+int ipc_client_bootstrap(struct ipc_client *client);
+int ipc_client_send(struct ipc_client *client, const unsigned short command,
+ const char type, unsigned char *data, const int length, unsigned char mseq);
+int ipc_client_recv(struct ipc_client *client,
+ struct ipc_message_info *response);
+void ipc_client_response_free(struct ipc_client *client,
+ struct ipc_message_info *response);
-int ipc_client_bootstrap_modem(struct ipc_client *client);
int ipc_client_open(struct ipc_client *client);
int ipc_client_close(struct ipc_client *client);
+int ipc_client_poll(struct ipc_client *client, struct timeval *timeout);
+
int ipc_client_power_on(struct ipc_client *client);
int ipc_client_power_off(struct ipc_client *client);
-int ipc_client_gprs_handlers_available(struct ipc_client *client);
+
int ipc_client_gprs_activate(struct ipc_client *client, int cid);
int ipc_client_gprs_deactivate(struct ipc_client *client, int cid);
-char *ipc_client_gprs_get_iface(struct ipc_client *client, int cid);
-int ipc_client_gprs_get_capabilities(struct ipc_client *client,
- struct ipc_client_gprs_capabilities *cap);
-int ipc_client_send(struct ipc_client *client, const unsigned short command,
- const char type, unsigned char *data, const int length, unsigned char mseq);
-int ipc_client_recv(struct ipc_client *client,
- struct ipc_message_info *response);
+int ipc_client_data_create(struct ipc_client *client);
+int ipc_client_data_destroy(struct ipc_client *client);
-void ipc_client_response_free(struct ipc_client *client,
- struct ipc_message_info *response);
+char *ipc_client_gprs_get_iface(struct ipc_client *client, int cid);
+int ipc_client_gprs_get_capabilities(struct ipc_client *client,
+ struct ipc_client_gprs_capabilities *capabilities);
/* Utility functions */
void ipc_client_log_recv(struct ipc_client *client,