public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Andrea Carlevato" <andrea.carlevatoml@gmail.com>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] SDP browsing a 128 bit UUID ???
Date: Wed, 4 Oct 2006 17:14:26 +0200	[thread overview]
Message-ID: <becc9d2c0610040814r82bf05dsc851d5629a7adc01@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 3181 bytes --]

Hello,
i ve this problem:

i neet to write a simple code to search a sdp record on
my cell phone, identified by a 128 bit UUID and loaded
by a java midlet.
In particular, the UUID is:
f07122bf9a648cf8082c0553b183326

i wrote this code,  00:11:9F:B0:EA:02 is the MAC of my phone.
But when i run it, value of "err" after 'sdp_service_search_attr_req'
is always 0, and the response list seem to be empty.
Can someone tell me if it's a wrong code ??

thanks a lot
Andrea


-----------------------------------------------------

void sdp_search()
{
    uint32_t svc_uuid_int[] = { 0xf07122bf, 0x09a648cf, 0x8082c055,
0x3b183326 };
    uuid_t svc_uuid;
    int err;
    bdaddr_t target;
    sdp_list_t *response_list = NULL, *search_list, *attrid_list;
    sdp_session_t *session = 0;

    str2ba( "00:11:9F:B0:EA:02", &target );

    // connect to the SDP server running on the remote machine
    printf("SDP Connecting\n");
    session = sdp_connect( BDADDR_ANY, &target, SDP_RETRY_IF_BUSY );
    printf("SDP Connecting\n");


    // specify the UUID of the application we're searching for
    sdp_uuid128_create( &svc_uuid, &svc_uuid_int );
    search_list = sdp_list_append( NULL, &svc_uuid );

    // specify that we want a list of all the matching applications'
attributes
    uint32_t range = 0x0000ffff;
    attrid_list = sdp_list_append( NULL, &range );

    // get a list of service records that have UUID 0xabcd
    err = sdp_service_search_attr_req( session, search_list, \
            SDP_ATTR_REQ_RANGE, attrid_list, &response_list);

    sdp_list_t *r = response_list;
    printf("COMPLETE: %d\n", err);
    // go through each of the service records
    for (; r; r = r->next ) {
        printf("RECORD\n");
        sdp_record_t *rec = (sdp_record_t*) r->data;
        sdp_list_t *proto_list;

        // get a list of the protocol sequences
        if( sdp_get_access_protos( rec, &proto_list ) == 0 ) {
        sdp_list_t *p = proto_list;

        // go through each protocol sequence
        for( ; p ; p = p->next ) {
            sdp_list_t *pds = (sdp_list_t*)p->data;

            // go through each protocol list of the protocol sequence
            for( ; pds ; pds = pds->next ) {

                // check the protocol attributes
                sdp_data_t *d = (sdp_data_t*)pds->data;
                int proto = 0;
                for( ; d; d = d->next ) {
                    switch( d->dtd ) {
                        case SDP_UUID16:
                        case SDP_UUID32:
                        case SDP_UUID128:
                            proto = sdp_uuid_to_proto( &d->val.uuid );
                            break;
                        case SDP_UINT8:
                            if( proto == RFCOMM_UUID ) {
                                printf("rfcomm channel: %d\n",d->val.int8);
                            }
                            break;
                    }
                }
            }
            sdp_list_free( (sdp_list_t*)p->data, 0 );
        }
        sdp_list_free( proto_list, 0 );

        }

        printf("found service record 0x%x\n", rec->handle);
        sdp_record_free( rec );
    }

    sdp_close(session);

}

[-- Attachment #1.2: Type: text/html, Size: 6733 bytes --]

[-- Attachment #2: Type: text/plain, Size: 348 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

                 reply	other threads:[~2006-10-04 15:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=becc9d2c0610040814r82bf05dsc851d5629a7adc01@mail.gmail.com \
    --to=andrea.carlevatoml@gmail.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /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