From: Szymon Janc Date: Mon, 21 Oct 2013 18:56:49 +0000 (+0200) Subject: android: Add IPC helper for convenient error sending X-Git-Tag: android-x86-4.4-r3~7273 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=16265b991696a13de4b92357496a498497c5bb21;p=android-x86%2Fexternal-bluetooth-bluez.git android: Add IPC helper for convenient error sending This simple helper will simplify error paths in code. --- 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);