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

[bluetooth-dev] BT_CTRL_TTY & /dev/ttyBTx ..!



Sir,
     Could anyone please tell me the difference
between BT_CTRL_TTY and /dev/ttyBTx.Do we need to use
both at the same time?
     And is "line" the "x" in /dev/ttyBTx ? If so is
the following code correct for opening the tty and
sending the data to my device from access point.
     Please have a look at lines marked ****** and
your help in this regard will be very helpful for my
Masters Thesis.
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);
      }
        printf("Reading proc file\n");
******  pFile = fopen("/proc/bt_channel_con","r");
        if(pFile == 0)
                perror("fopen");
******  temp = fread(buffer, 5, 1, pFile);
        printf("Connect on bt_cfd %d,temp %d buffer %s
line %c\n", bt_cfd,temp,buffer,buffer[0]);
        fclose(pFile);
        t1 = (char *)malloc(sizeof(char));
        t2 = (char *)malloc(sizeof(char));
        sprintf(t1,"%c",buffer[0]);
        sprintf(t2,"%c",buffer[2]);
*****   line = atoi(t1);
*****   srv_ch = atoi(t2);
*****   if(bt_isconnected(bt_cfd,line))
        {
     *(int*)bd_addr = line;
     if(ioctl(bt_cfd, BTREADREMOTEBDADDR, bd_addr) <
0)
                {
                        perror("BTREADREMOTEBDADDR");
                }

        tty[10] = buffer[0];
        printf("The tty is %s\n",tty);
*****   fd = open_device(tty,O_RDWR,0);
        printf("Device file descriptor %d\n",fd);

        for(i=0;i<20000;i++)
        {
*****         if(write(fd,buffer,5) != 5)
                        perror("write");
        }
                close_device(fd);
     }

__________________________________
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