diff options
author | Simon Busch <morphis@gravedo.de> | 2011-08-25 18:23:15 +0200 |
---|---|---|
committer | Simon Busch <morphis@gravedo.de> | 2011-08-25 18:23:15 +0200 |
commit | f6bbbfa9c5e038e838e5641764666f53a04b2985 (patch) | |
tree | db5969d31334fb424f338cc24f2467ab6ccd0c87 | |
parent | 7d80f41d7cda80978db6c93e6e50422c93f133d4 (diff) | |
download | external_libsamsung-ipc-f6bbbfa9c5e038e838e5641764666f53a04b2985.zip external_libsamsung-ipc-f6bbbfa9c5e038e838e5641764666f53a04b2985.tar.gz external_libsamsung-ipc-f6bbbfa9c5e038e838e5641764666f53a04b2985.tar.bz2 |
Use ipc ops in public API methods
-rw-r--r-- | samsung-ipc/ipc.c | 35 | ||||
-rw-r--r-- | samsung-ipc/ipc_private.h | 4 |
2 files changed, 36 insertions, 3 deletions
diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c index 28da210..e25ba7e 100644 --- a/samsung-ipc/ipc.c +++ b/samsung-ipc/ipc.c @@ -51,6 +51,34 @@ int ipc_init(int client_type) return rc; } +int ipc_open(void) +{ + return ops != NULL && ops->open != NULL ? ops->open() : -1; +} + +int ipc_close(void) +{ + return ops != NULL && ops->close != NULL ? ops->close() : -1; +} + +void ipc_power_on(void) +{ + if (ops != NULL && ops->power_on != NULL) + ops->power_on(); +} + +void ipc_power_off(void) +{ + if (ops != NULL && ops->power_off != NULL) + ops->power_off(); +} + +void ipc_send(struct ipc_request *request) +{ + if (ops != NULL && ops->send != NULL) + ops->send(request); +} + /* Convenience functions for ipc_send */ inline void ipc_msg_send_get(const int command, unsigned char aseq) { @@ -75,6 +103,11 @@ void ipc_msg_send(const int command, const int type, unsigned char *data, const request.length = length; request.data = data; - ipc_send(&request); + ipc_send(&request); +} + +int ipc_recv(struct ipc_response *response) +{ + return ops != NULL && ops->recv != NULL ? ops->recv(response) : -1; } diff --git a/samsung-ipc/ipc_private.h b/samsung-ipc/ipc_private.h index 8eb34d9..2dbf2c3 100644 --- a/samsung-ipc/ipc_private.h +++ b/samsung-ipc/ipc_private.h @@ -24,8 +24,8 @@ struct ipc_ops { int (*open)(void); int (*close)(void); - int (*power_on)(void); - int (*power_off)(void); + void (*power_on)(void); + void (*power_off)(void); int (*send)(struct ipc_request*); int (*recv)(struct ipc_response*); }; |