| | |
| | | import android.widget.GridLayout; |
| | | import android.widget.RelativeLayout; |
| | | import android.widget.Switch; |
| | | import android.widget.TextView; |
| | | |
| | | import com.example.agvcontroller.action.AllResetAction; |
| | | import com.example.agvcontroller.action.BackPaddle; |
| | |
| | | |
| | | public static final Map<String, Object> map = new ConcurrentHashMap(); |
| | | public static final Map<String, Object> car_num = new ConcurrentHashMap(); |
| | | |
| | | private static TextView agvBattery; |
| | | |
| | | private Vibrator vibrator; |
| | | private Button stopBtn; // 急停按钮 |
| | |
| | | |
| | | private Button bodySwitchBtn; // 底盘/货叉切换 |
| | | private Socket socket; |
| | | private String AgvNo = "1"; |
| | | |
| | | private RelativeLayout layout_bottom; |
| | | private RelativeLayout layout_top; |
| | | private GridLayout layout_single; |
| | |
| | | return false; |
| | | } |
| | | }); |
| | | |
| | | static String AgvNo = "1"; |
| | | static String clientId; |
| | | NettyServerHandler nettyServerHandler; |
| | | |
| | | |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_main); |
| | | |
| | | agvBattery = findViewById(R.id.agv_battery); |
| | | |
| | | |
| | | |
| | | // 按钮震动 |
| | |
| | | |
| | | Intent intent = getIntent(); |
| | | if (intent != null) { |
| | | String newClientId = intent.getStringExtra("clientId"); |
| | | if (newClientId != null) { |
| | | clientId = newClientId; |
| | | AgvNo = intent.getStringExtra("agvNo"); |
| | | } |
| | | AGVCar car = (AGVCar) intent.getSerializableExtra("item"); |
| | | clientId = car.getClientId(); |
| | | AgvNo = car.getAgvNo(); |
| | | } |
| | | |
| | | Log.i("message1",clientId); |
| | |
| | | //socketManager.stopServer(); // 停止服务器 |
| | | } |
| | | |
| | | public static void upClient(String newClientId) { |
| | | clientId = newClientId; |
| | | public static void upClient(AGVCar agvCar) { |
| | | clientId = agvCar.getClientId(); |
| | | AgvNo = agvCar.getAgvNo(); |
| | | agvBattery.setText("电量:" + agvCar.getBattery() + "%"); |
| | | // updateAgvBatteryText("电量:" + agvCar.getBattery() + "%"); |
| | | } |
| | | |
| | | private static void updateAgvBatteryText(String batteryLevel) { |
| | | if (agvBattery != null) { |
| | | agvBattery.setText(batteryLevel); |
| | | } |
| | | } |
| | | } |