linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen Ganir <chen.ganir@ti.com>
To: Anderson Lizardo <anderson.lizardo@openbossa.org>
Cc: <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH v3 06/10] battery: Get Battery ID
Date: Thu, 20 Sep 2012 14:03:14 +0300	[thread overview]
Message-ID: <505AF7F2.7010304@ti.com> (raw)
In-Reply-To: <CAJdJm_MyO5Fq-rDWMnSm3pkR_Qj8ghCri8We0fXtaYVXtpzB6A@mail.gmail.com>

Anderson,

On 09/20/2012 01:46 PM, Anderson Lizardo wrote:
> Hi Chen,
>
> On Thu, Sep 20, 2012 at 4:27 AM,  <chen.ganir@ti.com> wrote:
>> @@ -150,31 +200,35 @@ static void configure_battery_cb(GSList *characteristics, guint8 status,
>>
>>          for (l = characteristics; l; l = l->next) {
>>                  struct gatt_char *c = l->data;
>> -               struct characteristic *ch;
>> -               uint16_t start, end;
>> -
>> -               ch = g_new0(struct characteristic, 1);
>> -               ch->attr.handle = c->handle;
>> -               ch->attr.properties = c->properties;
>> -               ch->attr.value_handle = c->value_handle;
>> -               memcpy(ch->attr.uuid, c->uuid, MAX_LEN_UUID_STR + 1);
>> -               ch->batt = batt;
>>
>> -               batt->chars = g_slist_append(batt->chars, ch);
>> -
>> -               start = c->value_handle + 1;
>> -
>> -               if (l->next != NULL) {
>> -                       struct gatt_char *c = l->next->data;
>> -                       if (start == c->handle)
>> +               if (g_strcmp0(c->uuid, BATTERY_LEVEL_UUID) == 0) {
>
> Minor comment, but looks like it would be cleaner if you used:
>
> if (g_strcmp0(c->uuid, BATTERY_LEVEL_UUID) != 0)
>      continue;
>
> and avoided all this shifting and one more level of indentation.
>
I'll change that. It does make more sense.


>> +                       struct characteristic *ch;
>> +                       uint16_t start, end;
>> +
>> +                       ch = g_new0(struct characteristic, 1);
>> +                       ch->attr.handle = c->handle;
>> +                       ch->attr.properties = c->properties;
>> +                       ch->attr.value_handle = c->value_handle;
>> +                       memcpy(ch->attr.uuid, c->uuid, MAX_LEN_UUID_STR + 1);
>> +                       ch->batt = batt;
>> +
>> +                       batt->chars = g_slist_append(batt->chars, ch);
>> +
>> +                       start = c->value_handle + 1;
>> +
>> +                       if (l->next != NULL) {
>> +                               struct gatt_char *c = l->next->data;
>> +                               if (start == c->handle)
>> +                                       continue;
>> +                               end = c->handle - 1;
>> +                       } else if (c->value_handle != batt->svc_range->end)
>> +                               end = batt->svc_range->end;
>> +                       else
>>                                  continue;
>> -                       end = c->handle - 1;
>> -               } else if (c->value_handle != batt->svc_range->end)
>> -                       end = batt->svc_range->end;
>> -               else
>> -                       continue;
>>
>> -               gatt_find_info(batt->attrib, start, end, discover_desc_cb, ch);
>> +                       gatt_find_info(batt->attrib, start, end,
>> +                                                       discover_desc_cb, ch);
>> +               }
>>          }
>>   }
>
> Regards,
>

Thanks,

-- 
BR,
Chen Ganir


  reply	other threads:[~2012-09-20 11:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-20  8:27 [PATCH v3 00/10] Implement Generic battery and LE Battery client chen.ganir
2012-09-20  8:27 ` [PATCH v3 01/10] battery: Add generic device battery documentation chen.ganir
2012-09-20  8:27 ` [PATCH v3 02/10] battery: Implement Generic device battery chen.ganir
2012-09-20  8:27 ` [PATCH v3 03/10] battery: Add GATT Battery Client Service skeleton chen.ganir
2012-09-20  8:27 ` [PATCH v3 04/10] battery: Add client connection logic chen.ganir
2012-09-20  8:27 ` [PATCH v3 05/10] battery: Discover Characteristic Descriptors chen.ganir
2012-09-20  8:27 ` [PATCH v3 06/10] battery: Get Battery ID chen.ganir
2012-09-20 10:46   ` Anderson Lizardo
2012-09-20 11:03     ` Chen Ganir [this message]
2012-09-20  8:27 ` [PATCH v3 07/10] battery: Add Battery to device chen.ganir
2012-09-20  8:27 ` [PATCH v3 08/10] battery: Read Battery level characteristic chen.ganir
2012-09-20  8:27 ` [PATCH v3 09/10] battery: Add support for notifications chen.ganir
2012-09-20 10:54   ` Anderson Lizardo
2012-09-20 11:00     ` Chen Ganir
2012-09-20  8:27 ` [PATCH v3 10/10] battery: Support persistent battery level chen.ganir
2012-09-20 10:56 ` [PATCH v3 00/10] Implement Generic battery and LE Battery client Anderson Lizardo
2012-09-20 11:04   ` Chen Ganir

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=505AF7F2.7010304@ti.com \
    --to=chen.ganir@ti.com \
    --cc=anderson.lizardo@openbossa.org \
    --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;
as well as URLs for NNTP newsgroup(s).