|
|
|
@ -112,7 +112,6 @@ public class HomeFragment extends BaseFragment {
|
|
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
|
|
|
private BleManager ble;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//人脸识别
|
|
|
|
//人脸识别
|
|
|
|
ActivityResultLauncher<Intent> launcherResultFaceRecognition;
|
|
|
|
ActivityResultLauncher<Intent> launcherResultFaceRecognition;
|
|
|
|
@ -134,45 +133,6 @@ public class HomeFragment extends BaseFragment {
|
|
|
|
username = App.getInstance().getUserInfo().getManid();
|
|
|
|
username = App.getInstance().getUserInfo().getManid();
|
|
|
|
firstDeparment = App.getInstance().getUserInfo().getFirstDeparment();
|
|
|
|
firstDeparment = App.getInstance().getUserInfo().getFirstDeparment();
|
|
|
|
|
|
|
|
|
|
|
|
ble= BleManager.getInstance();
|
|
|
|
|
|
|
|
String str=ble.init(requireActivity());
|
|
|
|
|
|
|
|
if("OK".equals(str)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ble.setOnReceiveListener(new BleManager.OnReceiveListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onShowMessage(Context context, Intent intent) {
|
|
|
|
|
|
|
|
final String action = intent.getAction();
|
|
|
|
|
|
|
|
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
|
|
|
|
|
|
|
|
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
|
|
|
|
|
|
|
if (ActivityCompat.checkSelfPermission(requireActivity(), Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
|
|
|
|
|
|
|
// TODO: Consider calling
|
|
|
|
|
|
|
|
// ActivityCompat#requestPermissions
|
|
|
|
|
|
|
|
// here to request the missing permissions, and then overriding
|
|
|
|
|
|
|
|
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
|
|
|
|
|
|
|
// int[] grantResults)
|
|
|
|
|
|
|
|
// to handle the case where the user grants the permission. See the documentation
|
|
|
|
|
|
|
|
// for ActivityCompat#requestPermissions for more details.
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
showLog("扫描发现设备" + device.getName() + "," + device.getAddress());
|
|
|
|
|
|
|
|
String deviceName = device.getName();
|
|
|
|
|
|
|
|
if (deviceName != null && !deviceName.isEmpty()){
|
|
|
|
|
|
|
|
showLog(new Gson().toJson(device));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) {
|
|
|
|
|
|
|
|
showLog("连接");
|
|
|
|
|
|
|
|
} else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) {
|
|
|
|
|
|
|
|
showLog("断开");
|
|
|
|
|
|
|
|
} else if (BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) {
|
|
|
|
|
|
|
|
showLog("数据传输通道准备就绪,可以发送数据了。");
|
|
|
|
|
|
|
|
} else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) {
|
|
|
|
|
|
|
|
byte[] data= intent.getByteArrayExtra(BluetoothLeService.EXTRA_DATA);
|
|
|
|
|
|
|
|
showLog("收到传感器数据" + new String(data));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//android 10 以上
|
|
|
|
//android 10 以上
|
|
|
|
if (context.getExternalFilesDir(null) != null) {
|
|
|
|
if (context.getExternalFilesDir(null) != null) {
|
|
|
|
@ -544,12 +504,12 @@ public class HomeFragment extends BaseFragment {
|
|
|
|
// String[] titles = {"管控一体化","两票系统", "SIS系统", "机组参数","巡检","点检","运行日志","kks码查询","应急预案","用车","用印","BI"};
|
|
|
|
// String[] titles = {"管控一体化","两票系统", "SIS系统", "机组参数","巡检","点检","运行日志","kks码查询","应急预案","用车","用印","BI"};
|
|
|
|
// int[] imgIds = {R.drawable.icon_runlog_home,R.drawable.icon_liangpiao, R.drawable.icon_sis_new, R.drawable.icon_gcjd_new,R.drawable.xjgz,R.drawable.icon_dianjian,R.drawable.icon_runlog_home,R.drawable.icon_kks,R.drawable.icon_yjya,R.drawable.icon_use_car,R.drawable.icon_use_seal,R.drawable.icon_bi};
|
|
|
|
// int[] imgIds = {R.drawable.icon_runlog_home,R.drawable.icon_liangpiao, R.drawable.icon_sis_new, R.drawable.icon_gcjd_new,R.drawable.xjgz,R.drawable.icon_dianjian,R.drawable.icon_runlog_home,R.drawable.icon_kks,R.drawable.icon_yjya,R.drawable.icon_use_car,R.drawable.icon_use_seal,R.drawable.icon_bi};
|
|
|
|
|
|
|
|
|
|
|
|
String[] titles = {"管控一体化","两票系统", "SIS系统", "机组参数","巡检","点检","kks码查询","应急预案","BI","高风险","人脸识别","隐患随手拍","每日作业管控风险清单","蓝牙传感器"};
|
|
|
|
String[] titles = {"管控一体化","两票系统", "SIS系统", "机组参数","巡检","点检","kks码查询","应急预案","BI","高风险","人脸识别","隐患随手拍","每日作业管控风险清单"};
|
|
|
|
int[] imgIds = {R.drawable.icon_gkyth,R.drawable.icon_lpqt, R.drawable.icon_sis_new_first,
|
|
|
|
int[] imgIds = {R.drawable.icon_gkyth,R.drawable.icon_lpqt, R.drawable.icon_sis_new_first,
|
|
|
|
R.drawable.icon_jzcs_new,R.drawable.icon_qj_new,R.drawable.icon_dj_new,
|
|
|
|
R.drawable.icon_jzcs_new,R.drawable.icon_qj_new,R.drawable.icon_dj_new,
|
|
|
|
R.drawable.icon_kks_search,R.drawable.icon_yjya,R.drawable.icon_bi,
|
|
|
|
R.drawable.icon_kks_search,R.drawable.icon_yjya,R.drawable.icon_bi,
|
|
|
|
R.drawable.icon_high_risk,R.drawable.icon_face_re,R.drawable.icon_rinhuan_take,
|
|
|
|
R.drawable.icon_high_risk,R.drawable.icon_face_re,R.drawable.icon_rinhuan_take,
|
|
|
|
R.drawable.icon_zyfx,R.drawable.icon_rinhuan_take};
|
|
|
|
R.drawable.icon_zyfx};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|