Advertisement
shubhamgoyal

Java Wrapper for Machine APIs

May 24th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. import com.leiyuntop.machine.StatusCapture;
  2. public class Test {
  3. static boolean m_pick = false;
  4. private StatusCapture sc;
  5. Test(StatusCapture sc) {
  6. this.sc = sc;
  7. }
  8. void connect(String portName) {
  9. this.sc.Start(portName, 10);
  10. }
  11. void disconnect() {
  12. this.sc.Close();
  13. }
  14. void getMachineStatus() {
  15. this.sc.VMC_Status();
  16. }
  17. void irTest() {
  18. if (m_pick) {
  19. this.sc.VMC_ExitTest();
  20. } else {
  21. this.sc.VMC_Test("红外", "");
  22. }
  23. m_pick = !m_pick;
  24. }
  25. void lift(String value) {
  26. this.sc.VMC_Test("升降", value); // can be A, B, C, D, E, F
  27. }
  28. void location() {
  29. this.sc.Elevator_Location();
  30. }
  31. void testSlot(String testSlotValue) {
  32. this.sc.VMC_Test("单道", testSlotValue);
  33. }
  34. void allSlots() {
  35. this.sc.VMC_Test("全道", "");
  36. }
  37. void slotItemSale(String key) {
  38. this.sc.VMC_Sale(key);
  39. }
  40. public static void main (String args[]) {
  41. StatusCapture sc = new StatusCapture();
  42. Test obj = new Test(sc);
  43. obj.connect("COM1");
  44. obj.getMachineStatus();
  45. obj.irTest();
  46. obj.lift("A");
  47. obj.location();
  48. obj.testSlot("A1");
  49. obj.allSlots();
  50. obj.slotItemSale("A1");
  51. obj.disconnect();
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement