|
|
|
@ -1,7 +1,14 @@
|
|
|
|
package com.rehome.dywoa.ui.activity.sbxdjgl;
|
|
|
|
package com.rehome.dywoa.ui.activity.sbxdjgl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static android.content.Context.BIND_AUTO_CREATE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.ComponentName;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
|
|
|
import android.content.ServiceConnection;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
|
|
|
import android.os.Handler;
|
|
|
|
|
|
|
|
import android.os.IBinder;
|
|
|
|
import android.text.Editable;
|
|
|
|
import android.text.Editable;
|
|
|
|
import android.text.InputFilter;
|
|
|
|
import android.text.InputFilter;
|
|
|
|
import android.text.InputType;
|
|
|
|
import android.text.InputType;
|
|
|
|
@ -22,6 +29,7 @@ import com.rehome.dywoa.DBModel.DjjhRwQy;
|
|
|
|
import com.rehome.dywoa.R;
|
|
|
|
import com.rehome.dywoa.R;
|
|
|
|
import com.rehome.dywoa.base.BaseFragment;
|
|
|
|
import com.rehome.dywoa.base.BaseFragment;
|
|
|
|
import com.rehome.dywoa.bean.SisReaultBean;
|
|
|
|
import com.rehome.dywoa.bean.SisReaultBean;
|
|
|
|
|
|
|
|
import com.rehome.dywoa.bleUtil.BluetoothLeService;
|
|
|
|
import com.rehome.dywoa.utils.GsonUtils;
|
|
|
|
import com.rehome.dywoa.utils.GsonUtils;
|
|
|
|
import com.rehome.dywoa.utils.HttpListener;
|
|
|
|
import com.rehome.dywoa.utils.HttpListener;
|
|
|
|
import com.rehome.dywoa.utils.NoProgresshttpUtils;
|
|
|
|
import com.rehome.dywoa.utils.NoProgresshttpUtils;
|
|
|
|
@ -69,6 +77,7 @@ public class CJFragment extends BaseFragment {
|
|
|
|
TextView tv_sis_value;
|
|
|
|
TextView tv_sis_value;
|
|
|
|
//Button btn_next;
|
|
|
|
//Button btn_next;
|
|
|
|
Button btn_selectCheckResult;
|
|
|
|
Button btn_selectCheckResult;
|
|
|
|
|
|
|
|
Button btn_cj;
|
|
|
|
|
|
|
|
|
|
|
|
LinearLayout ll_bz;
|
|
|
|
LinearLayout ll_bz;
|
|
|
|
LinearLayout ll_et_jg;
|
|
|
|
LinearLayout ll_et_jg;
|
|
|
|
@ -86,6 +95,8 @@ public class CJFragment extends BaseFragment {
|
|
|
|
private double bjsx = 0;//报警上限
|
|
|
|
private double bjsx = 0;//报警上限
|
|
|
|
private double bjxx = 0;//报警下限
|
|
|
|
private double bjxx = 0;//报警下限
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BluetoothLeService mBluetoothLeService;
|
|
|
|
|
|
|
|
|
|
|
|
public CJFragment() {
|
|
|
|
public CJFragment() {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -145,6 +156,7 @@ public class CJFragment extends BaseFragment {
|
|
|
|
ll_bz = view.findViewById(R.id.ll_bz);
|
|
|
|
ll_bz = view.findViewById(R.id.ll_bz);
|
|
|
|
ll_et_jg = view.findViewById(R.id.ll_et_jg);
|
|
|
|
ll_et_jg = view.findViewById(R.id.ll_et_jg);
|
|
|
|
sv = view.findViewById(R.id.sv);
|
|
|
|
sv = view.findViewById(R.id.sv);
|
|
|
|
|
|
|
|
btn_cj = view.findViewById(R.id.btn_cj);
|
|
|
|
// btn_next.setOnClickListener(new View.OnClickListener() {
|
|
|
|
// btn_next.setOnClickListener(new View.OnClickListener() {
|
|
|
|
// @Override
|
|
|
|
// @Override
|
|
|
|
// public void onClick(View v) {
|
|
|
|
// public void onClick(View v) {
|
|
|
|
@ -191,6 +203,28 @@ public class CJFragment extends BaseFragment {
|
|
|
|
dialog.show();
|
|
|
|
dialog.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
btn_cj.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
if(mBluetoothLeService!=null){
|
|
|
|
|
|
|
|
new Handler().postDelayed(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
if(isEdit){
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(info.getPOINTNAME())){
|
|
|
|
|
|
|
|
if(info.getPOINTNAME().contains("温度")){
|
|
|
|
|
|
|
|
mBluetoothLeService.writeHex("0B0B6300");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(info.getPOINTNAME().contains("振动")){
|
|
|
|
|
|
|
|
mBluetoothLeService.writeHex("1F13");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},1000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@ -232,6 +266,11 @@ public class CJFragment extends BaseFragment {
|
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isEdit){
|
|
|
|
|
|
|
|
Intent gattServiceIntent = new Intent(requireActivity(), BluetoothLeService.class);
|
|
|
|
|
|
|
|
requireActivity().bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void getSisDate(String sisNo){
|
|
|
|
private void getSisDate(String sisNo){
|
|
|
|
@ -333,7 +372,6 @@ public class CJFragment extends BaseFragment {
|
|
|
|
tv_kks.setText(info.getASSETNUM());
|
|
|
|
tv_kks.setText(info.getASSETNUM());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(info.getUNITOFMEASURE())){
|
|
|
|
if(!TextUtils.isEmpty(info.getUNITOFMEASURE())){
|
|
|
|
tv_dw.setVisibility(View.VISIBLE);
|
|
|
|
tv_dw.setVisibility(View.VISIBLE);
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
@ -347,17 +385,29 @@ public class CJFragment extends BaseFragment {
|
|
|
|
if(!TextUtils.isEmpty(info.getMEAMETHOD())){
|
|
|
|
if(!TextUtils.isEmpty(info.getMEAMETHOD())){
|
|
|
|
if(info.getMEAMETHOD().equals("抄表")){
|
|
|
|
if(info.getMEAMETHOD().equals("抄表")){
|
|
|
|
//android:digits="0123456789.-"
|
|
|
|
//android:digits="0123456789.-"
|
|
|
|
|
|
|
|
btn_cj.setVisibility(View.GONE);
|
|
|
|
ll_bz.setVisibility(View.GONE);
|
|
|
|
ll_bz.setVisibility(View.GONE);
|
|
|
|
tv_dw.setVisibility(View.VISIBLE);
|
|
|
|
tv_dw.setVisibility(View.VISIBLE);
|
|
|
|
ll_et_jg.setVisibility(View.VISIBLE);
|
|
|
|
ll_et_jg.setVisibility(View.VISIBLE);
|
|
|
|
btn_selectCheckResult.setVisibility(View.GONE);
|
|
|
|
btn_selectCheckResult.setVisibility(View.GONE);
|
|
|
|
//et_jg.setInputType(InputType.TYPE_CLASS_NUMBER|InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
|
|
|
//et_jg.setInputType(InputType.TYPE_CLASS_NUMBER|InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
|
|
|
//et_jg.setText("正常");
|
|
|
|
//et_jg.setText("正常");
|
|
|
|
|
|
|
|
if(isEdit){
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(info.getPOINTNAME())){
|
|
|
|
|
|
|
|
if(info.getPOINTNAME().contains("温度")){
|
|
|
|
|
|
|
|
btn_cj.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(info.getPOINTNAME().contains("振动")){
|
|
|
|
|
|
|
|
btn_cj.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
ll_bz.setVisibility(View.GONE);
|
|
|
|
ll_bz.setVisibility(View.GONE);
|
|
|
|
tv_dw.setVisibility(View.GONE);
|
|
|
|
tv_dw.setVisibility(View.GONE);
|
|
|
|
ll_et_jg.setVisibility(View.GONE);
|
|
|
|
ll_et_jg.setVisibility(View.GONE);
|
|
|
|
btn_selectCheckResult.setVisibility(View.VISIBLE);
|
|
|
|
btn_selectCheckResult.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
btn_cj.setVisibility(View.GONE);
|
|
|
|
//et_jg.setInputType(InputType.TYPE_CLASS_TEXT);
|
|
|
|
//et_jg.setInputType(InputType.TYPE_CLASS_TEXT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -506,4 +556,29 @@ public class CJFragment extends BaseFragment {
|
|
|
|
public String getEditTextFxContent() {
|
|
|
|
public String getEditTextFxContent() {
|
|
|
|
return etFxnr.getText().toString().trim();
|
|
|
|
return etFxnr.getText().toString().trim();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void getBlueToothData(String bleData) {
|
|
|
|
|
|
|
|
et_jg.setText(bleData);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private final ServiceConnection mServiceConnection = new ServiceConnection() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onServiceConnected(ComponentName componentName, IBinder service) {
|
|
|
|
|
|
|
|
mBluetoothLeService = ((BluetoothLeService.LocalBinder) service).getService();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onServiceDisconnected(ComponentName componentName) {
|
|
|
|
|
|
|
|
mBluetoothLeService = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onDestroy() {
|
|
|
|
|
|
|
|
super.onDestroy();
|
|
|
|
|
|
|
|
if(isEdit){
|
|
|
|
|
|
|
|
if(mBluetoothLeService!=null){
|
|
|
|
|
|
|
|
requireActivity().unbindService(mServiceConnection);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|