Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 10 of 10

Thread: cash drawer

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default cash drawer

    hi everyone,

    i have 1 question

    how to open cash drawer with java?


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: cash drawer

    Hello lephoe,

    Welcome to the forums.

    Can you please give us some more information?

    I need to know what type of cash drawer this is.. How its connected to the PC etc etc. Please give as much information as possible.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Junior Member
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: cash drawer

    I use a usb printer to open a Cash Drawer. connected to the pc via usb

    how to open a Cash Drawer at the time of printing?

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: cash drawer

    Who is the cash drawer made by? Do you have the manual?

    Please give me a model number if possible. Also, who is the USB printer made by?

    This info will help me find out what information needs to be sent to open the cash drawer. All models are different.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  5. #5
    Junior Member
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: cash drawer

    I have been able to open Cash Drawer

    My problem now is how do I open ports COM3

    please help friends
    Last edited by lephoe; April 20th, 2010 at 12:54 AM.

  6. #6
    Junior Member
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: cash drawer

    it is the source code

    package testConn;
     
    import javax.comm.*;
    import java.util.*;
     
    /** Check each port to see if it is open. **/
    public class openPort {
     
      public static void main (String [] args) {
          Enumeration port_list = CommPortIdentifier.getPortIdentifiers ();
     
          while (port_list.hasMoreElements ()) {                                                            >>> [B]this process in the past, why did not you?[/B]
              // Get the list of ports
              CommPortIdentifier port_id =
                      (CommPortIdentifier) port_list.nextElement ();
     
              // Find each ports type and name
              if (port_id.getPortType () == CommPortIdentifier.PORT_SERIAL)
              {
                  System.out.println ("Serial port: " + port_id.getName ());
              }
              else if (port_id.getPortType () == CommPortIdentifier.PORT_PARALLEL)
              {
                  System.out.println ("Parallel port: " + port_id.getName ());
              } else
                  System.out.println ("Other port: " + port_id.getName ());
     
              // Attempt to open it
              try {
                  CommPort port = port_id.open ("PortListOpen",20);
                  System.out.println ("  Opened successfully");
                  port.close ();
              }
              catch  (PortInUseException pe)
              {
                  System.out.println ("  Open failed");
                  String owner_name = port_id.getCurrentOwner ();
                  if (owner_name == null)
                      System.out.println ("  Port Owned by unidentified app");
                  else
                      // The owner name not returned correctly unless it is
                      // a Java program.
                      System.out.println ("  " + owner_name);
              }
         }
      } //main
    } // PortListOpen

  7. #7
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: cash drawer

    So that code opens the cash drawer?

    What do you need to do with COM3? Whats the issue?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  8. #8
    Junior Member
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: cash drawer

    I was able to open a Cash Drawer. code was to display the text into line displays
    and I have just completed.

    thanks

  9. #9
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: cash drawer

    Have you solved this issue?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  10. #10
    Junior Member
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: cash drawer

    Quote Originally Posted by JavaPF View Post
    Have you solved this issue?
    yes, i have.
    I use the cmd command, because the API javax.comm command I did not understand


    This command to the API javax.comm :

    package testConn;

    import javax.comm.*;
    import java.util.*;

    /** Check each port to see if it is open. **/
    public class openPort {

    public static void main (String [] args) {
    Enumeration port_list = CommPortIdentifier.getPortIdentifiers ();

    while (port_list.hasMoreElements ()) { //This part in the diving, why not you?
    // Get the list of ports
    CommPortIdentifier port_id =
    (CommPortIdentifier) port_list.nextElement ();

    // Find each ports type and name
    if (port_id.getPortType () == CommPortIdentifier.PORT_SERIAL)
    {
    System.out.println ("Serial port: " + port_id.getName ());
    }
    else if (port_id.getPortType () == CommPortIdentifier.PORT_PARALLEL)
    {
    System.out.println ("Parallel port: " + port_id.getName ());
    } else
    System.out.println ("Other port: " + port_id.getName ());

    // Attempt to open it
    try {
    CommPort port = port_id.open ("PortListOpen",20);
    System.out.println (" Opened successfully");
    port.close ();
    }
    catch (PortInUseException pe)
    {
    System.out.println (" Open failed");
    String owner_name = port_id.getCurrentOwner ();
    if (owner_name == null)
    System.out.println (" Port Owned by unidentified app");
    else
    // The owner name not returned correctly unless it is
    // a Java program.
    System.out.println (" " + owner_name);
    }
    }
    } //main
    } // PortListOpen

Similar Threads

  1. Cash Register Exercise
    By Consus in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 19th, 2010, 11:52 PM
  2. Simple Program for Cash
    By javastudent in forum Paid Java Projects
    Replies: 9
    Last Post: December 1st, 2009, 07:25 AM