Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8209979

delay and timeout in two way serial communication

XMLWordPrintable

    • x86_64
    • windows_8

      A DESCRIPTION OF THE PROBLEM :
      i have to set a time out in serial communication for receiving message from another comm cports

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      i am sending some string .if coming output is equal to "OK" then print ok in my JFrame. plus set time for
      receiving string .if string come befor the the time then print ok otherwise error message will show.and one more thing condition will check the receving message will a have a "OK" and plus time condition .

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      set time delay for receiving message. string will contain a "OK" which is coming from another ports

      ---------- BEGIN SOURCE ----------
      Calendar currentCalendar = Calendar.getInstance();
      Date currentTime = currentCalendar.getTime();
      System.out.println(dateFormat.format(currentTime));
      System.out.println(timeFormat.format(currentTime));
      //label.setText(dateFormat.format(currentTime));
      //label3.setText(timeFormat.format(currentTime));
      Timer t=new Timer();
      currentCalendar.add(Calendar.SECOND, 10);
      System.out.println(currentCalendar.getTime());
      SimpleDateFormat parser = new SimpleDateFormat("HH:mm");
      int hour = currentCalendar.get( Calendar.HOUR );
      int second = currentCalendar.get(Calendar.SECOND);
      if( currentCalendar.get( Calendar.AM_PM ) == 0 ){
      String am_pm = "AM";
      if(Calendar.SECOND)
      System.out.println( "welcome 123" );
      }
      else{
      String am_pm = "PM";
      if(second<6)
      System.out.println( "welcome" );
      }
      if (initIOStream() == true)
      {
      initListener();
      }
      ---------- END SOURCE ----------

            pmangal Priyanka Mangal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: