1

我有一个 DateCS MP55 收银机,我希望它打印一些行,但我不知道我需要向它发送什么命令以及如何发送。它连接在 COM5 上,基本上这就是我发送“1”命令的原因。这是正确的方法吗?

 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 (port_id.getName()+" port opened successfully");
                      outputStream = port.getOutputStream();
                      String num = "1";
                      outputStream.write(num.getBytes());
                      port.close ();
                  }

这是我发现的关于打印的“命令”:

 P - print text:P,[logical number],______,_,__;[line 1];[line 2];[line 3];[line 4];[line 5];
If the line is empty, it is not printed out. If it contains only spaces, it will be printed as anempty line.
 MP-50 and MP-55 print out only the first line. The maximum number of symbolsper line is 24 for ECR and 30 for FP

那么我必须做这样的事情吗?:

outputStream.write("P,[logical number],______,_,__;[line 1];[line 2];[line 3];[line 4];[line 5]".getBytes());
4

0 回答 0