Re: [PATCH 2/3] Add SDP registration of Primary GATT services

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 16, 2011 at 6:18 PM, Brian Gix <bgix@xxxxxxxxxxxxxx> wrote:
> SDP registration can be supressed by passing Zero as the end
> handle argument to attrib_db_add().
> ---
>  attrib/example.c    |  119 +++++++++++++++++++++++++++++++------------
>  src/attrib-server.c |  139 +++++++++++++++++++++++++++++++++++----------------
>  src/attrib-server.h |    6 ++-
>  3 files changed, 184 insertions(+), 80 deletions(-)
>
> diff --git a/attrib/example.c b/attrib/example.c
> index 1911912..eab3c0f 100644
> --- a/attrib/example.c
> +++ b/attrib/example.c
> @@ -31,6 +31,7 @@
>
>  #include <bluetooth/sdp.h>
>  #include <bluetooth/sdp_lib.h>
> +#include <src/sdpd.h>
>
>  #include <glib.h>
>
> @@ -59,6 +60,9 @@
>  #define FMT_KILOGRAM_UUID              0xA010
>  #define FMT_HANGING_UUID               0xA011
>
> +#define SDP_RECORD_COUNT 10
> +sdp_record_t *sdp_records[SDP_RECORD_COUNT];
> +
>  static int register_attributes(void)
>  {
>        const char *desc_out_temp = "Outside Temperature";
> @@ -77,59 +81,73 @@ static int register_attributes(void)
>        uint8_t atval[256];
>        uuid_t uuid;
>        int len;
> +       int i = 0;
>
>        /* Battery state service: primary service definition */
>        sdp_uuid16_create(&uuid, GATT_PRIM_SVC_UUID);
>        att_put_u16(BATTERY_STATE_SVC_UUID, &atval[0]);
> -       attrib_db_add(0x0100, &uuid, ATT_NONE, ATT_NOT_PERMITTED, atval, 2);
> +       sdp_records[i++] = attrib_db_add(0x0100, 0x0111, &uuid,
> +                                               "Battery State Service",
> +                                               ATT_NONE, ATT_NOT_PERMITTED,
> +                                               atval, 2);

What if instead of changing attrib_db_add() signature to return a SDP
record, you create a "sdp_record_from_attrib()" for this purpose? This
function could get the struct attribute * pointers for start/end.

There are plans for attrib_db_add() to return the created struct
attribute *a (as shown in a patch I sent sometime ago which I still
need to resend), I can send an updated version of that patch if you
agree to this approach.

> @@ -609,7 +603,7 @@ static uint16_t write_value(struct gatt_channel *channel, uint16_t handle,
>  static uint16_t mtu_exchange(struct gatt_channel *channel, uint16_t mtu,
>                uint8_t *pdu, int len)
>  {
> -       channel->mtu = MIN(mtu, ATT_MAX_MTU);
> +       channel->mtu = MIN(mtu, channel->mtu);
>
>        return enc_mtu_resp(channel->mtu, pdu, len);
>  }

This change looks unrelated to the patch.

Regards,
-- 
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux