From 16265b991696a13de4b92357496a498497c5bb21 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Mon, 21 Oct 2013 20:56:49 +0200 Subject: [PATCH] android: Add IPC helper for convenient error sending This simple helper will simplify error paths in code. --- android/ipc.c | 9 +++++++++ android/ipc.h | 1 + 2 files changed, 10 insertions(+) diff --git a/android/ipc.c b/android/ipc.c index 1840624d5..1a867fb44 100644 --- a/android/ipc.c +++ b/android/ipc.c @@ -77,3 +77,12 @@ void ipc_send(GIOChannel *io, uint8_t service_id, uint8_t opcode, uint16_t len, raise(SIGTERM); } } + +void ipc_send_error(GIOChannel *io, uint8_t service_id, uint8_t status) +{ + struct hal_msg_rsp_error err; + + err.status = status; + + ipc_send(io, service_id, HAL_MSG_OP_ERROR, sizeof(err), &err, -1); +} diff --git a/android/ipc.h b/android/ipc.h index db92c976a..4b0ee2a41 100644 --- a/android/ipc.h +++ b/android/ipc.h @@ -23,3 +23,4 @@ void ipc_send(GIOChannel *io, uint8_t service_id, uint8_t opcode, uint16_t len, void *param, int fd); +void ipc_send_error(GIOChannel *io, uint8_t service_id, uint8_t status); -- 2.11.0