| | |
| | | import com.example.agvcontroller.action.LoadResetAction; |
| | | import com.example.agvcontroller.action.RotatopnLeftRight; |
| | | import com.example.agvcontroller.action.SingleSwitchAction; |
| | | import com.example.agvcontroller.action.SingleSwitchRunAction; |
| | | import com.example.agvcontroller.protocol.AgvAction; |
| | | import com.example.agvcontroller.action.HandOutAction; |
| | | import com.example.agvcontroller.socket.NettyServerHandler; |
| | |
| | | private boolean isGoBackward = false; |
| | | private boolean isRotatopnRight = false; |
| | | private boolean isRotatopnLeft = false; |
| | | |
| | | private boolean isFrontPaddleExtendBtn = false; |
| | | private boolean isFrontPaddleCollectBtn = false; |
| | | private boolean isBackPaddleExtendBtn = false; |
| | | private boolean isBackPaddleCollectBtn = false; |
| | | private boolean isRiseBtn = false; |
| | | private boolean isDropBtn = false; |
| | | private boolean isExtendForkBtn = false; |
| | | private boolean isCollectForkBtn = false; |
| | | private boolean isTurnLeftBtn = false; |
| | | private boolean isTurnRightBtn = false; |
| | | |
| | | |
| | | private boolean isFront1 = false; |
| | | private boolean isBack1 = false; |
| | | private boolean isFront2 = false; |
| | | private boolean isBack2 = false; |
| | | private boolean isFront3 = false; |
| | | private boolean isBack3 = false; |
| | | private boolean isFront4 = false; |
| | | private boolean isBack4 = false; |
| | | private boolean isFront5 = false; |
| | | private boolean isBack5 = false; |
| | | private boolean isFront6 = false; |
| | | private boolean isBack6 = false; |
| | | private boolean isFront7 = false; |
| | | private boolean isBack7 = false; |
| | | private boolean isFront8 = false; |
| | | private boolean isBack8 = false; |
| | | private boolean isFront9 = false; |
| | | private boolean isBack9 = false; |
| | | |
| | | |
| | | |
| | |
| | | private Handler handler = new Handler(new Handler.Callback() { |
| | | @Override |
| | | public boolean handleMessage(Message msg) { |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | short pwd = 0; |
| | | if (isGoForward) { |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(ForwardBackAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | |
| | | handler.sendEmptyMessageDelayed(0, 100); // 100ms 后发送下一条消息 |
| | | } |
| | | if (isGoBackward) { |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(ForwardBackAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | |
| | | handler.sendEmptyMessageDelayed(0, 100); |
| | | } |
| | | if (isRotatopnRight) { |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(RotatopnLeftRight.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | |
| | | handler.sendEmptyMessageDelayed(0, 100); |
| | | } |
| | | if (isRotatopnLeft) { |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(RotatopnLeftRight.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | |
| | | handler.sendEmptyMessageDelayed(0, 100); |
| | | } |
| | | |
| | | // // 前拨杆伸 |
| | | // if (isFrontPaddleExtendBtn) { |
| | | // String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | // AgvAction agvAction = new AgvAction<>(FrontPaddle.class) |
| | | // .setAgvNo(AgvNo) |
| | | // .setSerialNo(substring) |
| | | // .setVal(1) |
| | | // .bodySync((action) -> action.setPwd((short) 1)); |
| | | // nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | // handler.sendEmptyMessageDelayed(0, 100); |
| | | // } |
| | | // // 前拨杆收 |
| | | // if (isFrontPaddleCollectBtn) { |
| | | // String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | // AgvAction agvAction = new AgvAction<>(FrontPaddle.class) |
| | | // .setAgvNo(AgvNo) |
| | | // .setSerialNo(substring) |
| | | // .setVal(1) |
| | | // .bodySync((action) -> action.setPwd((short) 0)); |
| | | // nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | // handler.sendEmptyMessageDelayed(0, 100); |
| | | // } |
| | | // // 后拨杆伸 |
| | | // if (isBackPaddleExtendBtn) { |
| | | // String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | // AgvAction agvAction = new AgvAction<>(BackPaddle.class) |
| | | // .setAgvNo(AgvNo) |
| | | // .setSerialNo(substring) |
| | | // .setVal(1) |
| | | // .bodySync((action) -> action.setPwd((short) 1)); |
| | | // nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | // handler.sendEmptyMessageDelayed(0, 100); |
| | | // } |
| | | // // 后拨杆收 |
| | | // if (isBackPaddleCollectBtn) { |
| | | // String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | // AgvAction agvAction = new AgvAction<>(BackPaddle.class) |
| | | // .setAgvNo(AgvNo) |
| | | // .setSerialNo(substring) |
| | | // .setVal(1) |
| | | // .bodySync((action) -> action.setPwd((short) 0)); |
| | | // nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | // handler.sendEmptyMessageDelayed(0, 100); |
| | | // } |
| | | // // 上升 |
| | | // if (isRiseBtn) { |
| | | // String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | // AgvAction agvAction = new AgvAction<>(HandLift.class) |
| | | // .setAgvNo(AgvNo) |
| | | // .setSerialNo(substring) |
| | | // .setVal(1) |
| | | // .bodySync((action) -> action.setPwd((short) -10)); |
| | | // nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | // handler.sendEmptyMessageDelayed(0, 100); |
| | | // } |
| | | // // 下降 |
| | | // if (isDropBtn) { |
| | | // String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | // AgvAction agvAction = new AgvAction<>(HandLift.class) |
| | | // .setAgvNo(AgvNo) |
| | | // .setSerialNo(substring) |
| | | // .setVal(1) |
| | | // .bodySync((action) -> action.setPwd((short) -10)); |
| | | // nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | // handler.sendEmptyMessageDelayed(0, 100); |
| | | // } |
| | | // // 伸叉 |
| | | // if (isExtendForkBtn) { |
| | | // String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | // AgvAction agvAction = new AgvAction<>(HandExtendCollect.class) |
| | | // .setAgvNo(AgvNo) |
| | | // .setSerialNo(substring) |
| | | // .setVal(1) |
| | | // .bodySync((action) -> action.setPwd((short) -10)); |
| | | // nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | // handler.sendEmptyMessageDelayed(0, 100); |
| | | // } |
| | | // // 收叉 |
| | | // if (isCollectForkBtn) { |
| | | // String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | // AgvAction agvAction = new AgvAction<>(HandExtendCollect.class) |
| | | // .setAgvNo(AgvNo) |
| | | // .setSerialNo(substring) |
| | | // .setVal(1) |
| | | // .bodySync((action) -> action.setPwd((short) -10)); |
| | | // nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | // handler.sendEmptyMessageDelayed(0, 100); |
| | | // } |
| | | // // 货叉左旋 |
| | | // if (isTurnLeftBtn) { |
| | | // String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | // AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | // .setAgvNo(AgvNo) |
| | | // .setSerialNo(substring) |
| | | // .setVal(1) |
| | | // .bodySync((action) -> action.setPwd((short) -10)); |
| | | // nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | // handler.sendEmptyMessageDelayed(0, 100); |
| | | // } |
| | | // // 货叉右旋 |
| | | // if (isTurnRightBtn) { |
| | | // String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | // AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | // .setAgvNo(AgvNo) |
| | | // .setSerialNo(substring) |
| | | // .setVal(1) |
| | | // .bodySync((action) -> action.setPwd((short) -10)); |
| | | // nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | // handler.sendEmptyMessageDelayed(0, 100); |
| | | // } |
| | | if (isRotatopnRight) { |
| | | AgvAction agvAction = new AgvAction<>(RotatopnLeftRight.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(1) |
| | | .bodySync((action) -> action.setPwd((short) 50)); |
| | | nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | handler.sendEmptyMessageDelayed(0, 100); |
| | | } |
| | | if (isRotatopnLeft) { |
| | | AgvAction agvAction = new AgvAction<>(RotatopnLeftRight.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(1) |
| | | .bodySync((action) -> action.setPwd((short) -50 )); |
| | | nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | handler.sendEmptyMessageDelayed(0, 100); |
| | | } |
| | | return false; |
| | | } |
| | | }); |
| | |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(1) |
| | | .bodySync((action) -> action.setPwd((short) 21)); |
| | | .bodySync((action) -> action.setPwd((short) extendWidth)); |
| | | nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | extendWidth += 50; |
| | | } else { |
| | |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(1) |
| | | .bodySync((action) -> action.setPwd((short) 21)); |
| | | .bodySync((action) -> action.setPwd((short) extendWidth)); |
| | | nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端户端 |
| | | extendWidth -= 50; |
| | | } else { |
| | |
| | | if (vibrator != null && vibrator.hasVibrator()) { |
| | | vibrator.vibrate(500); |
| | | } |
| | | boolean result = false; |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | if (isAuto) { |
| | | AgvAction agvAction = new AgvAction<>(HandInAction.class) |
| | |
| | | .setVal(autoVal) |
| | | .bodySync((action) -> action.setPwd((short) 21)); |
| | | nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | result = true; |
| | | isAuto = !isAuto; |
| | | } else { |
| | | AgvAction agvAction = new AgvAction<>(HandOutAction.class) |
| | | .setAgvNo(AgvNo) |
| | |
| | | .setVal(autoVal) |
| | | .bodySync((action) -> action.setPwd((short) 21)); |
| | | nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | result = true; |
| | | isAuto = !isAuto; |
| | | } |
| | | |
| | | boolean result = false; |
| | | long timestamp = System.currentTimeMillis(); |
| | | while (System.currentTimeMillis() - timestamp < 5000) { |
| | | |
| | | Object o = map.get(substring); |
| | | |
| | | if (null != o) { |
| | | result = true; |
| | | isAuto = !isAuto; |
| | | map.remove(o); |
| | | break; |
| | | } |
| | | } |
| | | // long timestamp = System.currentTimeMillis(); |
| | | // while (System.currentTimeMillis() - timestamp < 5000) { |
| | | // |
| | | // Object o = map.get(substring); |
| | | // |
| | | // if (null != o) { |
| | | // result = true; |
| | | // isAuto = !isAuto; |
| | | // map.remove(o); |
| | | // break; |
| | | // } |
| | | // } |
| | | |
| | | if (result) { |
| | | // alert ok 修改按钮样式 名称 |
| | |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(5) |
| | | .bodySync((action) -> action.setPwd((short) 0)); |
| | | .bodySync((action) -> action.setPwd((short) 1)); |
| | | nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | axleFrontBtn5.setVisibility(View.VISIBLE); |
| | | axleBackBtn5.setVisibility(View.VISIBLE); |
| | | } else { |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(5) |
| | | .bodySync((action) -> action.setPwd((short) 1)); |
| | | .bodySync((action) -> action.setPwd((short) 0)); |
| | | nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | axleFrontBtn5.setVisibility(View.GONE); |
| | | axleBackBtn5.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | }); |
| | |
| | | }); |
| | | |
| | | |
| | | axleFrontBtn2 =findViewById(R.id.btn_axle_2_front); |
| | | axleBackBtn2 =findViewById(R.id.btn_axle_2_back); |
| | | axleFrontBtn3 =findViewById(R.id.btn_axle_3_front); |
| | | axleBackBtn3 =findViewById(R.id.btn_axle_3_back); |
| | | axleFrontBtn4 =findViewById(R.id.btn_axle_4_front); |
| | | axleBackBtn4 =findViewById(R.id.btn_axle_4_back); |
| | | axleFrontBtn5 =findViewById(R.id.btn_axle_5_front); |
| | | axleBackBtn5 =findViewById(R.id.btn_axle_5_back); |
| | | axleFrontBtn6 =findViewById(R.id.btn_axle_6_front); |
| | | axleBackBtn6 =findViewById(R.id.btn_axle_6_back); |
| | | axleFrontBtn7 =findViewById(R.id.btn_axle_7_front); |
| | | axleBackBtn7 =findViewById(R.id.btn_axle_7_back); |
| | | axleFrontBtn8 =findViewById(R.id.btn_axle_8_front); |
| | | axleBackBtn8 =findViewById(R.id.btn_axle_8_back); |
| | | axleFrontBtn9 =findViewById(R.id.btn_axle_9_front); |
| | | axleBackBtn9 =findViewById(R.id.btn_axle_9_back); |
| | | |
| | | axleFrontBtn1.setOnClickListener(new View.OnClickListener(){ |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(1) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(1) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(2) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(2) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(3) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(3) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(4) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(4) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(5) |
| | | .bodySync((action) -> action.setPwd((short) 100)); |
| | | .bodySync((action) -> action.setPwd((short) 99)); |
| | | nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | } |
| | | }); |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(5) |
| | | .bodySync((action) -> action.setPwd((short) -100)); |
| | | .bodySync((action) -> action.setPwd((short) -99)); |
| | | nettyServerHandler.sendMessageToClient(clientId, agvAction); // 发送消息到客户端 |
| | | } |
| | | }); |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(6) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(6) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(7) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(7) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(8) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(8) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(9) |
| | |
| | | vibrator.vibrate(500); |
| | | } |
| | | String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16); |
| | | AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class) |
| | | AgvAction agvAction = new AgvAction<>(SingleSwitchRunAction.class) |
| | | .setAgvNo(AgvNo) |
| | | .setSerialNo(substring) |
| | | .setVal(9) |
| | |
| | | rotatopnLeftBtn.setOnTouchListener(new CarTouchButton()); |
| | | rotatopnRightBtn.setOnTouchListener(new CarTouchButton()); |
| | | |
| | | // frontPaddleExtendBtn.setOnTouchListener(new CarTouchButton()); |
| | | // frontPaddleCollectBtn.setOnTouchListener(new CarTouchButton()); |
| | | // backPaddleExtendBtn.setOnTouchListener(new CarTouchButton()); |
| | | // backPaddleCollectBtn.setOnTouchListener(new CarTouchButton()); |
| | | // riseBtn.setOnTouchListener(new CarTouchButton()); |
| | | // dropBtn.setOnTouchListener(new CarTouchButton()); |
| | | // extendForkBtn.setOnTouchListener(new CarTouchButton()); |
| | | // collectForkBtn.setOnTouchListener(new CarTouchButton()); |
| | | // turnLeftBtn.setOnTouchListener(new CarTouchButton()); |
| | | // turnRightBtn.setOnTouchListener(new CarTouchButton()); |
| | | axleFrontBtn1.setOnTouchListener(new CarTouchButton()); |
| | | axleBackBtn1.setOnTouchListener(new CarTouchButton()); |
| | | axleFrontBtn2.setOnTouchListener(new CarTouchButton()); |
| | | axleBackBtn2.setOnTouchListener(new CarTouchButton()); |
| | | axleFrontBtn3.setOnTouchListener(new CarTouchButton()); |
| | | axleBackBtn3.setOnTouchListener(new CarTouchButton()); |
| | | axleFrontBtn4.setOnTouchListener(new CarTouchButton()); |
| | | axleBackBtn4.setOnTouchListener(new CarTouchButton()); |
| | | axleFrontBtn5.setOnTouchListener(new CarTouchButton()); |
| | | axleBackBtn5.setOnTouchListener(new CarTouchButton()); |
| | | axleFrontBtn6.setOnTouchListener(new CarTouchButton()); |
| | | axleBackBtn6.setOnTouchListener(new CarTouchButton()); |
| | | axleFrontBtn7.setOnTouchListener(new CarTouchButton()); |
| | | axleBackBtn7.setOnTouchListener(new CarTouchButton()); |
| | | axleFrontBtn8.setOnTouchListener(new CarTouchButton()); |
| | | axleBackBtn8.setOnTouchListener(new CarTouchButton()); |
| | | axleFrontBtn9.setOnTouchListener(new CarTouchButton()); |
| | | axleBackBtn9.setOnTouchListener(new CarTouchButton()); |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public boolean onTouch(View view, MotionEvent motionEvent) { |
| | | |
| | | if (view.getId() == R.id.btn_go_forward) { |
| | | // 前进 |
| | | if (motionEvent.getAction() == KeyEvent.ACTION_DOWN) { |
| | |
| | | } else if (motionEvent.getAction() == KeyEvent.ACTION_UP) { |
| | | isGoForward = false; |
| | | } |
| | | |
| | | } else if (view.getId() == R.id.btn_go_backward) { |
| | | // 后退 |
| | | if (motionEvent.getAction() == KeyEvent.ACTION_DOWN) { |
| | |
| | | } else if (motionEvent.getAction() == KeyEvent.ACTION_UP) { |
| | | isRotatopnRight = false; |
| | | } |
| | | } else if (view.getId() == R.id.btn_rotatopn_right) { |
| | | // 轴动按钮 |
| | | if (motionEvent.getAction() == KeyEvent.ACTION_DOWN) { |
| | | isRotatopnRight = true; |
| | | handler.sendEmptyMessage(0); |
| | | } else if (motionEvent.getAction() == KeyEvent.ACTION_UP) { |
| | | isRotatopnRight = false; |
| | | } |
| | | } |
| | | |
| | | |