From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: Date: Tue, 17 Apr 2007 09:32:27 +0530 From: "Tushar Paturde" To: "BlueZ users" In-Reply-To: <1176727272.30165.2.camel@aeonflux.holtmann.net> MIME-Version: 1.0 References: <1176727272.30165.2.camel@aeonflux.holtmann.net> Subject: Re: [Bluez-users] Where does the Bluez stores registered services? Reply-To: BlueZ users List-Id: BlueZ users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1889084489==" Sender: bluez-users-bounces@lists.sourceforge.net Errors-To: bluez-users-bounces@lists.sourceforge.net --===============1889084489== Content-Type: multipart/alternative; boundary="----=_Part_60915_1895042.1176782547704" ------=_Part_60915_1895042.1176782547704 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Marcel, The code snippet that I'm using for registering new service record is as below . #define BT_INVALID_SDDB_HANDLE 0 .... bt_result_t bt_sddb_update_record(bt_record_t *record) { int scanned; sdp_record_t *rec = sdp_extract_pdu((uint8_t *)record->data, &scanned); if (rec == NULL) { return BT_RESULT_FAILURE; } if (record->id == BT_INVALID_SDDB_HANDLE) { if (sdp_record_register(g_sess, rec, 0) < 0) { sdp_record_free(rec); return BT_RESULT_FAILURE; } record->id = (bt_sddbid_t)rec->handle; return BT_RESULT_SUCCESS; } else { int retval; rec->handle = record->id; retval = sdp_record_update(g_sess, rec); sdp_record_free(rec); if (retval < 0) { return BT_RESULT_FAILURE; } record->id = (bt_sddbid_t)rec->handle; return BT_RESULT_SUCCESS; } } In this code sdp_record_register return with success but the value of "rec->handle " is set to zero (0). This is problem for me. I think the value should be greater than zero or ideally 1. Because the "record" that is passed with service information has set it's handle to zero i.e it point to the default service record. This is causes problem in the upper layer of java implementation . So I need to kill the app manually at present. But it seems "sdp_record_register" operation is success because the registered service can be browsed by external device. Regards, Tushar NB: This code snippet is part of phonme project jsr82 implementation btSDDB.c . On 4/16/07, Marcel Holtmann wrote: > > Hi Tushar, > > > I had registered one btl2cap service using Bluez api's . Even after > > stopping the service it is still returned by service discovery done > > from another device. I would like to know where is the registry of > > these services maintained by bluez library. Also how can I modify > > this services registry ? > > if the service record doesn't disappear, then your code is wrong. You > have used persistent SDP records. Don't do that. And it is even better > to register the service records over D-Bus. > > Regards > > Marcel > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Bluez-users mailing list > Bluez-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bluez-users > -- Tushar Paturde ------=_Part_60915_1895042.1176782547704 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Marcel,
The code snippet  that I'm using for registering  new service record is as below .

#define BT_INVALID_SDDB_HANDLE 0
....
bt_result_t bt_sddb_update_record(bt_record_t *record)
{
    int scanned;
    sdp_record_t *rec = sdp_extract_pdu((uint8_t *)record->data, &scanned);
    if (rec == NULL) {
        return BT_RESULT_FAILURE;
    }

    if (record->id == BT_INVALID_SDDB_HANDLE) {
        if (sdp_record_register(g_sess, rec, 0) < 0) {
            sdp_record_free(rec);
            return BT_RESULT_FAILURE;
        }
        record->id = (bt_sddbid_t)rec->handle;
        return BT_RESULT_SUCCESS;
    } else {
        int retval;
        rec->handle = record->id;
        retval = sdp_record_update(g_sess, rec);
        sdp_record_free(rec);
        if (retval < 0) {
            return BT_RESULT_FAILURE;
        }
        record->id = (bt_sddbid_t)rec->handle;
        return BT_RESULT_SUCCESS;
    }
}


In this code sdp_record_register return with success but the   value of "rec->handle " is set to zero (0).  This is problem for me. I think the value should be greater than zero or ideally 1. Because the " record" that is passed with service information has set it's handle to zero i.e it point to the default service record. 

This is causes problem in the upper layer of java implementation . So I need to kill the app manually at present. But it seems "sdp_record_register" operation is success because the registered service can be  browsed by external device.


Regards,

Tushar

NB: This code snippet is part of phonme project jsr82 implementation btSDDB.c .


On 4/16/07, Marcel Holtmann <marcel@holtmann.org> wrote:
Hi Tushar,

> I had registered one btl2cap service  using Bluez api's . Even after
> stopping the service it is still returned by service discovery done
> from another device. I would like to know where is the registry of
> these services maintained by bluez library.  Also how can I modify
> this services registry ?

if the service record doesn't disappear, then your code is wrong. You
have used persistent SDP records. Don't do that. And it is even better
to register the service records over D-Bus.

Regards

Marcel



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users



--
Tushar Paturde ------=_Part_60915_1895042.1176782547704-- --===============1889084489== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ --===============1889084489== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Bluez-users mailing list Bluez-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-users --===============1889084489==--