public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] Can I search two services at the same time?
@ 2006-09-26  6:30 Mingfan.Lu
  2006-09-26  8:39 ` Marcel Holtmann
  2006-09-27  9:00 ` Marcel Holtmann
  0 siblings, 2 replies; 7+ messages in thread
From: Mingfan.Lu @ 2006-09-26  6:30 UTC (permalink / raw)
  To: Bluez-devel


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

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.

My func named getService() which uses sdp_service_search_req

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
Rsp is NULL
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


 Who can you tell me why?
thank you.

-- 
With respects,
   Mingfan.Lu


-- 
With respects,
   Mingfan.Lu

[-- Attachment #1.2: Type: text/html, Size: 8316 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-09-27 11:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-26  6:30 [Bluez-devel] Can I search two services at the same time? Mingfan.Lu
2006-09-26  8:39 ` Marcel Holtmann
2006-09-27  1:15   ` Mingfan.Lu
2006-09-27  7:42     ` Marcel Holtmann
2006-09-27  9:00 ` Marcel Holtmann
2006-09-27 11:07   ` Mingfan.Lu
2006-09-27 11:10     ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox