| | |
| | | private static final int REQUEST_CODE_CAR = 101; |
| | | private int request_code = REQUEST_CODE_MAP; |
| | | private Button btn_config_signal; |
| | | private Button btn_mcu_upgrade,btn_map_select,btn_roadmap_select; |
| | | private EditText et_ip,et_port,et_simulte_ip,et_simulate_port; |
| | | private Button btn_mcu_upgrade,btn_map_select; |
| | | private Gson gson = new Gson(); |
| | | private EditText et_ip_rtk,et_port_rtk,et_city_id,et_city_province,et_phone; |
| | | // private EditText et_ip_rtk,et_port_rtk,et_city_id,et_city_province,et_phone; |
| | | private RTKConfigViewModel rtkConfigViewModel; |
| | | private RTKConfig mRtkConfig; |
| | | private boolean needSendRtk = false; |
| | |
| | | if (rtkConfig != null){ |
| | | Log.i(TAG, "RTKConfig Changed: "+rtkConfig.toString()); |
| | | mRtkConfig = rtkConfig; |
| | | et_ip_rtk.setText(rtkConfig.getIp()); |
| | | et_city_id.setText(String.valueOf(rtkConfig.getCity())); |
| | | et_city_province.setText(String.valueOf(rtkConfig.getProvince())); |
| | | et_port_rtk.setText(String.valueOf(rtkConfig.getPort())); |
| | | et_phone.setText(rtkConfig.getPhone()); |
| | | // et_ip_rtk.setText(rtkConfig.getIp()); |
| | | // et_city_id.setText(String.valueOf(rtkConfig.getCity())); |
| | | // et_city_province.setText(String.valueOf(rtkConfig.getProvince())); |
| | | // et_port_rtk.setText(String.valueOf(rtkConfig.getPort())); |
| | | // et_phone.setText(rtkConfig.getPhone()); |
| | | ExamPlatformData.getInstance().setRTKPort(rtkConfig.getPort()); |
| | | ExamPlatformData.getInstance().setRTKIP(rtkConfig.getIp()); |
| | | |
| | |
| | | ((MainActivity)_mActivity).btn_return.setVisibility(View.VISIBLE); |
| | | } |
| | | view.findViewById(R.id.btn_save_platform).setOnClickListener(this); |
| | | et_ip = view.findViewById(R.id.et_platform_ip); |
| | | et_port = view.findViewById(R.id.et_platform_port); |
| | | et_ip.setText(ExamPlatformData.getInstance().getPlatformIP()); |
| | | et_port.setText(ExamPlatformData.getInstance().getPlatformPort()+""); |
| | | // et_ip = view.findViewById(R.id.et_platform_ip); |
| | | // et_port = view.findViewById(R.id.et_platform_port); |
| | | // et_ip.setText(ExamPlatformData.getInstance().getPlatformIP()); |
| | | // et_port.setText(ExamPlatformData.getInstance().getPlatformPort()+""); |
| | | btn_mcu_upgrade = view.findViewById(R.id.btn_mcu_upgrade); |
| | | btn_map_select = view.findViewById(R.id.btn_map_select); |
| | | btn_roadmap_select = view.findViewById(R.id.btn_roadmap_select); |
| | | view.findViewById(R.id.btn_car_select).setOnClickListener(this); |
| | | btn_mcu_upgrade.setOnClickListener(this); |
| | | btn_map_select.setOnClickListener(this); |
| | | btn_roadmap_select.setOnClickListener(this); |
| | | btn_config_signal = view.findViewById(R.id.btn_signal_conf); |
| | | btn_config_signal.setOnClickListener(this); |
| | | |
| | | |
| | | et_ip_rtk = view.findViewById(R.id.rtk_addr_ip); |
| | | et_simulte_ip = view.findViewById(R.id.simulate_ip); |
| | | et_city_id = view.findViewById(R.id.et_city_id); |
| | | et_city_province = view.findViewById(R.id.et_provice_id); |
| | | et_phone = view.findViewById(R.id.et_phone); |
| | | et_port_rtk = view.findViewById(R.id.rtk_addr_port); |
| | | et_simulate_port = view.findViewById(R.id.simulate_port); |
| | | // et_ip_rtk = view.findViewById(R.id.rtk_addr_ip); |
| | | // et_city_id = view.findViewById(R.id.et_city_id); |
| | | // et_city_province = view.findViewById(R.id.et_provice_id); |
| | | // et_phone = view.findViewById(R.id.et_phone); |
| | | // et_port_rtk = view.findViewById(R.id.rtk_addr_port); |
| | | |
| | | } |
| | | @Override |
| | |
| | | break; |
| | | case R.id.btn_save_platform: |
| | | Toast.makeText(_mActivity, "保存成功", Toast.LENGTH_SHORT).show(); |
| | | if(ExamPlatformData.getInstance().compareIPandPort(et_ip.getText().toString().trim(),Integer.parseInt(et_port.getText().toString().trim()))){ |
| | | SPUtils.put(getActivity(), SPUtils.DES_HEX_PWD,""); |
| | | ((MainActivity)getActivity()).examPlatformModel.getDataChange().postValue(1); |
| | | ExamPlatformData.getInstance().insertPlatformIp(et_ip.getText().toString().trim()); |
| | | ExamPlatformData.getInstance().insertPlatformPort(Integer.parseInt(et_port.getText().toString().trim())); |
| | | } |
| | | // if(ExamPlatformData.getInstance().compareIPandPort(et_ip.getText().toString().trim(),Integer.parseInt(et_port.getText().toString().trim()))){ |
| | | // SPUtils.put(getActivity(), SPUtils.DES_HEX_PWD,""); |
| | | // ((MainActivity)getActivity()).examPlatformModel.getDataChange().postValue(1); |
| | | // ExamPlatformData.getInstance().insertPlatformIp(et_ip.getText().toString().trim()); |
| | | // ExamPlatformData.getInstance().insertPlatformPort(Integer.parseInt(et_port.getText().toString().trim())); |
| | | // } |
| | | |
| | | if (mRtkConfig != null){ |
| | | String rtkip = et_ip_rtk.getText().toString().trim(); |
| | | int rtkport = Integer.parseInt(et_port_rtk.getText().toString().trim()); |
| | | |
| | | mRtkConfig.setPort(rtkport); |
| | | mRtkConfig.setCity(Integer.parseInt(et_city_id.getText().toString().trim())); |
| | | mRtkConfig.setProvince(Integer.parseInt(et_city_province.getText().toString().trim())); |
| | | mRtkConfig.setIp(rtkip); |
| | | mRtkConfig.setPhone(et_phone.getText().toString().trim()); |
| | | |
| | | if (ExamPlatformData.getInstance().compareRTKIPandPort(rtkip,rtkport)){ |
| | | mRtkConfig.setRegistered(0); |
| | | MyLog.i("rtk ip和地址有变化"); |
| | | needSendRtk = true; |
| | | sendRtkConfigInfo(mRtkConfig); |
| | | |
| | | } |
| | | rtkConfigViewModel.insertRTKConfig(mRtkConfig); |
| | | |
| | | } |
| | | // if (mRtkConfig != null){ |
| | | // String rtkip = et_ip_rtk.getText().toString().trim(); |
| | | // int rtkport = Integer.parseInt(et_port_rtk.getText().toString().trim()); |
| | | // |
| | | // mRtkConfig.setPort(rtkport); |
| | | // mRtkConfig.setCity(Integer.parseInt(et_city_id.getText().toString().trim())); |
| | | // mRtkConfig.setProvince(Integer.parseInt(et_city_province.getText().toString().trim())); |
| | | // mRtkConfig.setIp(rtkip); |
| | | // mRtkConfig.setPhone(et_phone.getText().toString().trim()); |
| | | // |
| | | // if (ExamPlatformData.getInstance().compareRTKIPandPort(rtkip,rtkport)){ |
| | | // mRtkConfig.setRegistered(0); |
| | | // MyLog.i("rtk ip和地址有变化"); |
| | | // needSendRtk = true; |
| | | // sendRtkConfigInfo(mRtkConfig); |
| | | // |
| | | // } |
| | | // rtkConfigViewModel.insertRTKConfig(mRtkConfig); |
| | | // |
| | | // } |
| | | |
| | | |
| | | |
| | |
| | | request_code = REQUEST_CODE_MAP; |
| | | openFileMgr(); |
| | | break; |
| | | case R.id.btn_roadmap_select: |
| | | request_code = REQUEST_CODE_ROADMAP; |
| | | openFileMgr(); |
| | | break; |
| | | // case R.id.btn_roadmap_select: |
| | | // request_code = REQUEST_CODE_ROADMAP; |
| | | // openFileMgr(); |
| | | // break; |
| | | default: |
| | | break; |
| | | } |