OSDN Git Service

android: Add IPC helper for convenient error sending
authorSzymon Janc <szymon.janc@tieto.com>
Mon, 21 Oct 2013 18:56:49 +0000 (20:56 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 21 Oct 2013 19:48:50 +0000 (22:48 +0300)
This simple helper will simplify error paths in code.

android/ipc.c
android/ipc.h

index 1840624..1a867fb 100644 (file)
@@ -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);
+}
index db92c97..4b0ee2a 100644 (file)
@@ -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);