From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: Date: Wed, 4 Oct 2006 17:14:26 +0200 From: "Andrea Carlevato" To: bluez-devel@lists.sourceforge.net MIME-Version: 1.0 Subject: [Bluez-devel] SDP browsing a 128 bit UUID ??? Reply-To: BlueZ development List-Id: BlueZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1119690767==" Sender: bluez-devel-bounces@lists.sourceforge.net Errors-To: bluez-devel-bounces@lists.sourceforge.net --===============1119690767== Content-Type: multipart/alternative; boundary="----=_Part_140959_28857335.1159974866783" ------=_Part_140959_28857335.1159974866783 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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); } ------=_Part_140959_28857335.1159974866783 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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);

}

------=_Part_140959_28857335.1159974866783-- --===============1119690767== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- 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 --===============1119690767== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel --===============1119690767==--