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

[bluetooth-dev] Stop receiving after 127 characters by ttyBT0



Dear all,
  
         I am writing a function inside the program btd.c inside "/apps/bluetooth/btd" to receiving data from another BT device. The function is called rf_receive( ). After writing this function, i found that i can only print out (receive) 127 characters in the application control program. How can i solve this problem??? I am try to solve it for a long time since i am not very good in serial port programming. Here is my program:
 
 
  else if (sscanf(buf, "rf_receive %s", &dir) == 1)
  {
#define MAXSIZE (100000*2)
   
    struct termios t, t_old;
 
    int fd;
    int line = 1;
    char tmp[MAXSIZE];
    int i = MAXSIZE;
    int n = 0;
    int j = 0;
 
    if((fd = open(btdev, O_RDWR | O_NOCTTY)) < 0)
    {
      perror("open_device");
      return 0;
    }
   
    if (tcgetattr(fd, &t) < 0)
    {
      perror("tcgetattr");
      exit(1);
    }
 
    cfsetispeed(&t, B115200);
    cfsetospeed(&t, B115200);
 
    t.c_iflag &= ~IXON;
    t.c_iflag &= ~IXOFF;
 
    if(tcsetattr(fd, TCSANOW, &t) < 0)
    {
      perror("tcsetattr");
      exit(1);
    }
 
    printf("The Bluetooth Device is %s\n", btdev);
 
    n = read(fd, tmp, i);
 
    printf("The value n is %d.\n", n);
 
    for (j = 0; j < n; j++)
    {
      printf("%c", tmp[j]);
    }
 
    close_device(fd);
  }
 
  /* END OF RECEIVE FILE */
 
 
        Thank you for you kind attention. I am looking forward for your reply.
 
Regards,
Tim