public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Mingfan.Lu" <lucharse@gmail.com>
To: "BlueZ development" <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] Can I search two service at the same time?
Date: Wed, 20 Sep 2006 09:09:02 +0800	[thread overview]
Message-ID: <3f5a9ba20609191809k6de962fr1de38558a380e694@mail.gmail.com> (raw)
In-Reply-To: <1158662153.20978.3.camel@localhost>


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

Here is the  data, maybe it can give some hits.


My func named getService()

int BTWorker::getService(Device * pDev)
{
  int CPS_err;
  sdp_list_t *CPS_r,*next;
  sdp_record_t *CPS_rec;
  sdp_list_t *CPS_proto_list;
  bool bFound=false;
  uint8_t numoffound=0;
  uint8_t rfcommChannel;
  uint8_t obexChannel;
  char desc[100];

  bdaddr_t source;//the source dongle should be saved in the adaptor, you
should config it in the ap.ini
  bdaddr_t target;
  str2ba(pDev->getDeviceAddress()->getAddress_str().c_str(),&target);
      sdp_session_t *session = 0;
  str2ba(adaptor->getAddress()->getAddress_str().c_str(),&source);
  // connect to the SDP server running on the remote machine
  session = sdp_connect_custom(&source,&target,SDP_RETRY_IF_BUSY);
  if(session==NULL)
  {
      return -1;
      }

  // specify the UUID of the application service(s) we're searching for
  uint16_t CPS_svc_uuid_int=CPS_SERV_UUID;   // 0x2222
  uint16_t OBEX_svc_uuid_int=OBEX_SERV_UUID; // 0x 1105
  uuid_t CPS_svc_uuid;
  uuid_t OBEX_svc_uuid;
  sdp_uuid16_create(&CPS_svc_uuid, CPS_svc_uuid_int);
  sdp_uuid16_create(&OBEX_svc_uuid,OBEX_svc_uuid_int);

  sdp_list_t * CPS_search_list;
  CPS_search_list = sdp_list_append(NULL,&CPS_svc_uuid);
  CPS_search_list = sdp_list_append(CPS_search_list,&OBEX_svc_uuid );

  // specify that we want a list of all the matching services' attributes

  uint16_t rec_num =2;
  // get a list of service records that have UUID CPS_SERV_UUID +
OBEX_SERV_UUID
  sdp_list_t *CPS_response_list = NULL;

  // search

   CPS_err =
sdp_service_search_req(session,CPS_search_list,255,&CPS_response_list);

  printf("CPS_err is %d\n",CPS_err);
  if(CPS_response_list == NULL)
   printf("Rsp is NULL\n");
  sdp_list_free(CPS_search_list,0);
  sdp_close(session);
  //...............other..................
}

My program's output is:

CPS_err is -1
NULL is
NO CPS or OBEX svc founded
Get service failed!00:12:D1:D1:08:47

The HCIDUMP -X -V output is:


..................

< HCI Command: Create Connection (0x01|0x0005) plen 13
    bdaddr 00:12:D1:D1:08:47 ptype 0xcc18 rswitch 0x01 clkoffset 0x40c8
(valid)
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5
> HCI Event: Command Status (0x0f) plen 4
    Create Connection (0x01|0x0005) status 0x00 ncmd 1
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 1 bdaddr 00:12:D1:D1:08:47 type ACL encrypt 0x00
< ACL data: handle 1 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0040
< HCI Command: Write Link Policy Settings (0x02|0x000d) plen 4
    handle 1 policy 0x0f
    Link policy: RSWITCH HOLD SNIFF PARK
> HCI Event: Command Complete (0x0e) plen 6
    Write Link Policy Settings (0x02|0x000d) ncmd 1
    status 0x00 handle 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 1 packets 1
> HCI Event: Max Slots Change (0x1b) plen 3
    handle 1 slots 5
> HCI Event: Connection Packet Type Changed (0x1d) plen 5
    status 0x00 handle 1 ptype 0xcc18
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5
> ACL data: handle 1 flags 0x02 dlen 10
    L2CAP(s): Info req: type 2
< ACL data: handle 1 flags 0x02 dlen 12
    L2CAP(s): Info rsp: type 2 result 1
      Not supported
> ACL data: handle 1 flags 0x02 dlen 28
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 1 status 2
      Connection pending - Authorization pending
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
      Connection successful
< ACL data: handle 1 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 1 packets 1
> ACL data: handle 1 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 1 packets 1
< ACL data: handle 1 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 0
      Success
> ACL data: handle 1 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      Success
      MTU 672
< ACL data: handle 1 flags 0x02 dlen 20
    L2CAP(d): cid 0x0040 len 16 [psm 1]
        SDP SS Req: tid 0x0 len 0xb
          pat uuid-16 0x2222 uuid-16 0x1105 (OBEXObjPush)
          max 2
          cont 00
> ACL data: handle 2 flags 0x02 dlen 14
    L2CAP(d): cid 0x0040 len 10 [psm 1]
        SDP SS Rsp: tid 0x0 len 0x5
          count 0
          cont 00
< ACL data: handle 2 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x00bb scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 2 packets 1
> ACL data: handle 2 flags 0x02 dlen 12
    L2CAP(s): Disconn rsp: dcid 0x00bb scid 0x0040
< HCI Command: Disconnect (0x01|0x0006) plen 3
    handle 1 reason 0x13
    Reason: Remote User Terminated Connection
> HCI Event: Command Status (0x0f) plen 4
    Disconnect (0x01|0x0006) status 0x00 ncmd 1
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 1 reason 0x16
    Reason: Connection Terminated by Local Host
< HCI Command: Disconnect (0x01|0x0006) plen 3
    handle 2 reason 0x13
    Reason: Remote User Terminated Connection
> HCI Event: Command Status (0x0f) plen 4
    Disconnect (0x01|0x0006) status 0x00 ncmd 1
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 2 reason 0x16
    Reason: Connection Terminated by Local Host

.........................................



2006/9/19, Marcel Holtmann <marcel@holtmann.org>:
>
> Hi,
>
> > Problem,
> >    I have seen that there is a function named sdp_service_search_req,
> >    So,I append two service uuid such as obexpush's uuid and another
> > service's uuid into the search list, I want to get the two services'
> > info only call search func once.
> >   and then set the max_rec_num = 2,
> >   then call
> >        sdp_service_search_req(session,search_list,2,&rsp_list);
> >  but ,I have seen that the func return 0, but the rsp_list is NULL.
>
> I would propose you run "hcidump -X -V" as root while you are trying
> this and then show us that output.
>
> Regards
>
> Marcel
>
>
>
> -------------------------------------------------------------------------
> 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
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>



-- 
With respects,
   Mingfan.Lu

[-- Attachment #1.2: Type: text/html, Size: 9485 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-09-20  1:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-19 10:30 [Bluez-devel] Can I search two service at the same time? Mingfan.Lu
2006-09-19 10:35 ` Marcel Holtmann
2006-09-20  1:09   ` Mingfan.Lu [this message]
2006-09-21  3:21     ` Mingfan.Lu

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=3f5a9ba20609191809k6de962fr1de38558a380e694@mail.gmail.com \
    --to=lucharse@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