Return-Path: MIME-Version: 1.0 In-Reply-To: <1398734107-4793-3-git-send-email-lukasz.rymanowski@tieto.com> References: <1398734107-4793-1-git-send-email-lukasz.rymanowski@tieto.com> <1398734107-4793-3-git-send-email-lukasz.rymanowski@tieto.com> Date: Tue, 29 Apr 2014 03:19:18 +0200 Message-ID: Subject: Re: [PATCH] android/gatt: Add support for send indication From: Lukasz Rymanowski To: "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi On 29 April 2014 03:14, Lukasz Rymanowski wrote: > With this patch Android app can send indication to remote device > --- > android/gatt.c | 30 +++++++++++++++++++++++++++++- > 1 file changed, 29 insertions(+), 1 deletion(-) > > diff --git a/android/gatt.c b/android/gatt.c > index 3e291cf..74d36bb 100644 > --- a/android/gatt.c > +++ b/android/gatt.c > @@ -3666,10 +3666,38 @@ failed: > > static void handle_server_send_indication(const void *buf, uint16_t len) > { > + const struct hal_cmd_gatt_server_send_indication *cmd = buf; > + uint8_t pdu[ATT_DEFAULT_LE_MTU]; > + struct app_connection *conn; > + uint8_t status; > + uint16_t length; > + > DBG(""); > > + conn = find_connection_by_id(cmd->conn_id); > + if (!conn) { > + error("gatt: Could not find connection"); > + status = HAL_STATUS_FAILED; > + goto reply; > + } > + > + if (cmd->confirm) > + /* TODO: Add data to track confirmation for this request */ > + length = enc_indication(cmd->attribute_handle, > + (uint8_t *)cmd->value, cmd->len, > + pdu, sizeof(pdu)); > + else > + length = enc_notification(cmd->attribute_handle, > + (uint8_t *)cmd->value, cmd->len, > + pdu, sizeof(pdu)); > + > + g_attrib_send(conn->device->attrib , 0, pdu, length, NULL, NULL , NULL); > + > + status = HAL_STATUS_SUCCESS; > + > +reply: > ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, > - HAL_OP_GATT_SERVER_SEND_INDICATION, HAL_STATUS_FAILED); > + HAL_OP_GATT_SERVER_SEND_INDICATION, status); > } > > static void handle_server_send_response(const void *buf, uint16_t len) > -- > 1.8.4 > Ignore this patch \Lukasz