[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bluetooth-dev] RE: rfcomm server + sdp registery ..!



Sir,
    How can I wait for incoming connections on
specific channel ? The following functions are there
but,not for specific channel.
void bt_waitconnection(int bt_fd, int line);
void bt_waitnewconnections(int bt_fd);
   I tried reading the bt_internal_proc file and I
could get the channel number of incoming
connection,but Iam really confused about what will be
the valid handle to send the commands ?? Iam sending
the following code...which may make any sense at this
moment,I request you to take a look at it and advice
me on how I can implement my rfcomm server to listen
on specific channel.Iam trying to understand the
sdp.xml file and was sucessfull in registering the
service,but struck with my server.
   Hope to hear from you regarding this.
   Thank you. 
 
 while(1){
    if((bt_cfd = bt_openctrl()) < 0)
      {
        perror("Could not open BT Control device");
        exit(1);
      }
    if(!bt_isinitiated(bt_cfd))
      {
        printf("Stack not initianted ,exit\n");
        exit(1);
      }
        pFile = fopen("/proc/bt_channel_con","r");
        if(pFile == 0)
                perror("fopen");
        temp = fread(buffer, 5, 1, pFile);
        
        fclose(pFile);
        if(buffer[2] == 3){
        if (ioctl(bt_cfd, BTREADREMOTEBDADDR, bd_addr)
< 0)
      {
        perror("BTREADREMOTEBDADDR");
      }
    printf("Remote addr
x:%x:%x:%x:%x:%x\n",bd_addr[0],bd_addr[1],bd_addr[2],bd_addr[3],bd_addr[4],bd_addr[5]);
       }
}

--- Anders Torbjorn Johansson
<anders.t.johansson@xxxxxxx.com> wrote:
> Hello,
> 
> Check the logfile to see if there are any errors
> such as "line not connected".
> To add a new service you will only have to edit the
> sdp.xml-file. Unfortunately
> there is no tutorial fot this but I suggest that you
> start with one of the 
> existing services as a template and just change the
> values to whatever your
> service need. If you need to use other UUID:s than
> the ones specified
> you will also need to add the new keywords in the
> translation-table (at the end
> of the file).
> 
> Best Regards,
> Anders
> 
> > -----Original Message-----
> > From: axis [mailto:axis2list@xxxxxxx.com]
> > Sent: den 6 januari 2004 12:34
> > To: Bluetooth-dev
> > Cc: anderstj@xxxxxxx.com
> > Subject: rfcomm server + sdp registery ..!
> > 
> > 
> > Sir,
> >     Iam trying to implement a rfcomm server on
> > specified channel(running on BT access point)
> which
> > waits for incoming connections,get the remote bd
> > address (for later processing) and disconnects.For
> > this I tried to use the following code,but after
> the
> > connection the remote bd address is always
> > 00:00:00:00:00:00
> >         unsigned char *bd;
> >         if(strcmp(buf,"rf_wait") == 0)
> >           {
> >             bt_waitconnection(bt_cfd, line);
> >             printf("Connect on line %d\n", line);
> >             read_remote_bd(bt_cfd, line,bd);
> >             printf("Remote bd: %x:%x:%x:%x:%x:%x
> > \n",bd[0],bd[1],bd[2],bd[3],bd[4],bd[5]);
> >             con_id = CREATE_RFCOMM_ID(line, 0 /*
> fixme
> > -- don't care */);
> >             retval = bt_disconnect(bt_cfd,
> con_id);
> >           }
> >         }
> >     
> >      Once this is properly working I want to
> register
> > this server as a Service so that the device trying
> to
> > connect to access point can discover this service
> and
> > try to connect on this channel.So for registering
> the
> > service is it enough if I add the entry in sdp.xml
> > file or is there any SDP API which I can use for
> this
> > purpose.Please advice me on sdp mechanism and how
> to
> > use and implement it.
> >       Hope to hear from you regarding this
> > Thank you.
> >      
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Hotjobs: Enter the "Signing Bonus"
> Sweepstakes
> > http://hotjobs.sweepstakes.yahoo.com/signingbonus
> > 
> 
> -
> To unsubscribe from this list: send the line
> "unsubscribe bluetooth-dev" in
> the body of a message to majordomo@xxxxxxx.com


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com