From: Szymon Janc <szymon.janc@tieto.com>
To: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 01/10] android/gatt: Replace request state with boolean
Date: Fri, 13 Feb 2015 12:49:44 +0100 [thread overview]
Message-ID: <1658969.V8rH4AEXo2@uw000953> (raw)
In-Reply-To: <1423665248-5121-1-git-send-email-jakub.tyszkowski@tieto.com>
Hi Jakub,
On Wednesday 11 of February 2015 15:33:59 Jakub Tyszkowski wrote:
> As there are two states we can instead use boolean value.
> ---
> android/gatt.c | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/android/gatt.c b/android/gatt.c
> index 8e58e41..b0ce1a8 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -690,11 +690,6 @@ static void destroy_gatt_app(void *data)
> free(app);
> }
>
> -enum pend_req_state {
> - REQUEST_PENDING,
> - REQUEST_DONE,
> -};
> -
> struct pending_request {
> struct gatt_db_attribute *attrib;
> int length;
> @@ -704,7 +699,7 @@ struct pending_request {
> uint8_t *filter_value;
> uint16_t filter_vlen;
>
> - enum pend_req_state state;
> + bool completed;
> uint8_t error;
> };
>
> @@ -4475,7 +4470,7 @@ static bool match_pending_dev_request(const void *data, const void *user_data)
> {
> const struct pending_request *pending_request = data;
>
> - return pending_request->state == REQUEST_PENDING;
> + return !pending_request->completed;
> }
>
> static void send_dev_complete_response(struct gatt_device *device,
> @@ -4830,7 +4825,7 @@ static void attribute_read_cb(struct gatt_db_attribute *attrib, int err,
> resp_data->length = length;
> resp_data->error = error;
>
> - resp_data->state = REQUEST_DONE;
> + resp_data->completed = true;
>
> if (!length)
> return;
> @@ -4856,7 +4851,7 @@ static void read_requested_attributes(void *data, void *user_data)
> attrib = resp_data->attrib;
> if (!attrib) {
> resp_data->error = ATT_ECODE_ATTR_NOT_FOUND;
> - resp_data->state = REQUEST_DONE;
> + resp_data->completed = true;
> return;
> }
>
> @@ -4874,7 +4869,7 @@ static void read_requested_attributes(void *data, void *user_data)
> permissions);
> if (error != 0) {
> resp_data->error = error;
> - resp_data->state = REQUEST_DONE;
> + resp_data->completed = true;
> return;
> }
>
> @@ -5650,7 +5645,7 @@ static void handle_server_send_response(const void *buf, uint16_t len)
>
> /* Cast status to uint8_t, due to (byte) cast in java layer. */
> req->error = err_to_att((uint8_t) cmd->status);
> - req->state = REQUEST_DONE;
> + req->completed = true;
>
> /*
> * FIXME: Handle situation when not all server applications
> @@ -6493,7 +6488,7 @@ static void attribute_write_cb(struct gatt_db_attribute *attrib, int err,
> data->attrib = attrib;
> data->error = error;
>
> - data->state = REQUEST_DONE;
> + data->completed = true;
> }
>
> static uint8_t write_req_request(const uint8_t *cmd, uint16_t cmd_len,
Patches 1-4, 6, 8 and 9 are now applied. Thanks.
--
Best regards,
Szymon Janc
prev parent reply other threads:[~2015-02-13 11:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 14:33 [PATCH 01/10] android/gatt: Replace request state with boolean Jakub Tyszkowski
2015-02-11 14:34 ` [PATCH 02/10] android/gatt: Destroy app connections before destroying apps Jakub Tyszkowski
2015-02-11 14:34 ` [PATCH 03/10] android/gatt: Simplify app disconnection function call flow Jakub Tyszkowski
2015-02-11 14:34 ` [PATCH 04/10] android/gatt: Make struct destructors NULL proof Jakub Tyszkowski
2015-02-11 14:34 ` [PATCH 05/10] android/gatt: Use g_attrib_send consistently Jakub Tyszkowski
2015-02-13 11:31 ` Szymon Janc
2015-02-13 12:49 ` Tyszkowski Jakub
2015-02-11 14:34 ` [PATCH 06/10] android/gatt: Improve send_dev_complete_response Jakub Tyszkowski
2015-02-11 14:34 ` [PATCH 07/10] android/gatt: Improve send_dev_complete_response even further Jakub Tyszkowski
2015-02-13 11:35 ` Szymon Janc
2015-02-13 13:38 ` Tyszkowski Jakub
2015-02-11 14:34 ` [PATCH 08/10] android/gatt: Remove not needed checks and jumps Jakub Tyszkowski
2015-02-11 14:34 ` [PATCH 09/10] android/gatt: Remove redundant matching function Jakub Tyszkowski
2015-02-11 14:34 ` [PATCH 10/10] android/gatt: Avoid copying pointers in matching functions Jakub Tyszkowski
2015-02-13 11:48 ` Szymon Janc
2015-02-13 13:25 ` Tyszkowski Jakub
2015-02-13 11:49 ` Szymon Janc [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1658969.V8rH4AEXo2@uw000953 \
--to=szymon.janc@tieto.com \
--cc=jakub.tyszkowski@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox