blue
This commit is contained in:
parent
10d0be4df4
commit
458a80bc00
|
|
@ -151,7 +151,7 @@ dependencies {
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'//2.0.4
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'//2.0.4
|
||||||
implementation 'com.tencent:mmkv:2.0.0'
|
implementation 'com.tencent:mmkv:2.0.0'
|
||||||
implementation("com.github.bumptech.glide:okhttp3-integration:4.11.0" )
|
implementation("com.github.bumptech.glide:okhttp3-integration:4.11.0" )
|
||||||
// implementation 'com.github.Jasonchenlijian:FastBle:2.4.0'
|
implementation 'com.github.Jasonchenlijian:FastBle:2.4.0'
|
||||||
|
|
||||||
implementation 'io.github.lucksiege:pictureselector:v3.11.2'
|
implementation 'io.github.lucksiege:pictureselector:v3.11.2'
|
||||||
// 图片压缩 (按需引入)
|
// 图片压缩 (按需引入)
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,6 @@
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<!-- // jiablue-->
|
|
||||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />-->
|
|
||||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />-->
|
|
||||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
|
@ -37,14 +34,14 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- 蓝牙权限需求 -->
|
<!-- 蓝牙权限需求 -->
|
||||||
<!-- // jiablue-->
|
<!-- // jiaxblue-->
|
||||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH" />-->
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!– 安卓12新增的蓝牙权限 –>-->
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- 安卓12新增的蓝牙权限 -->
|
||||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />-->
|
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
|
||||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />-->
|
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <!– 定位权限, 蓝牙搜索需要 –>-->
|
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <!-- 定位权限, 蓝牙搜索需要 -->
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />-->
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<!-- 使用相机 -->
|
<!-- 使用相机 -->
|
||||||
<!--
|
<!--
|
||||||
<uses-feature
|
<uses-feature
|
||||||
|
|
@ -107,7 +104,7 @@
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
tools:replace="android:icon,android:theme,android:allowBackup">
|
tools:replace="android:icon,android:theme,android:allowBackup">
|
||||||
|
|
||||||
<!-- 推送服务 jjia-push-->
|
<!-- 推送服务 jjia-xpush-->
|
||||||
<service
|
<service
|
||||||
android:name="com.ifish.push.IPushService"
|
android:name="com.ifish.push.IPushService"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
|
|
||||||
|
|
@ -47,14 +47,14 @@ public class BindTwoDeviceActivity extends BaseActivity {
|
||||||
initTitle("选择设备");
|
initTitle("选择设备");
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
|
||||||
// jiablue
|
// jiablue
|
||||||
// perlist = new String[]{
|
perlist = new String[]{
|
||||||
// android.Manifest.permission.BLUETOOTH_SCAN,
|
android.Manifest.permission.BLUETOOTH_SCAN,
|
||||||
// android.Manifest.permission.BLUETOOTH_ADVERTISE,
|
android.Manifest.permission.BLUETOOTH_ADVERTISE,
|
||||||
// android.Manifest.permission.BLUETOOTH_CONNECT,
|
android.Manifest.permission.BLUETOOTH_CONNECT,
|
||||||
// android.Manifest.permission.ACCESS_FINE_LOCATION,
|
android.Manifest.permission.ACCESS_FINE_LOCATION,
|
||||||
// android.Manifest.permission.ACCESS_COARSE_LOCATION,
|
android.Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||||
// android.Manifest.permission.BLUETOOTH
|
android.Manifest.permission.BLUETOOTH
|
||||||
// };
|
};
|
||||||
}
|
}
|
||||||
initView();//初始化控件
|
initView();//初始化控件
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
//import com.clj.fastble.BleManager;
|
import com.clj.fastble.BleManager;
|
||||||
import com.ifish.adapter.GridViewCameraBaseAdapter;
|
import com.ifish.adapter.GridViewCameraBaseAdapter;
|
||||||
import com.ifish.adapter.GridViewDeviceBaseAdapter;
|
import com.ifish.adapter.GridViewDeviceBaseAdapter;
|
||||||
import com.ifish.basebean.BaseBean;
|
import com.ifish.basebean.BaseBean;
|
||||||
|
|
@ -370,8 +370,8 @@ public class DeviceCameraListActivity extends BaseActivity {
|
||||||
@Override
|
@Override
|
||||||
public void success(BaseBean<Device> baseBean) {
|
public void success(BaseBean<Device> baseBean) {
|
||||||
result = baseBean.result;
|
result = baseBean.result;
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// BleManager.getInstance().disconnectAllDevice();
|
BleManager.getInstance().disconnectAllDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ public class LoadingActivity extends BaseActivityNotAnim {
|
||||||
|
|
||||||
|
|
||||||
private void initapp() {
|
private void initapp() {
|
||||||
// jjia-push
|
// jjia-xpush
|
||||||
// IPushService
|
// IPushService
|
||||||
// IIntentService
|
// IIntentService
|
||||||
PushManager.getInstance().preInit(this);
|
PushManager.getInstance().preInit(this);
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,8 @@ public class BottomChoiceDialog extends DialogFragment implements View.OnClickLi
|
||||||
lineAirKiss.setVisibility(View.VISIBLE);
|
lineAirKiss.setVisibility(View.VISIBLE);
|
||||||
lineAP.setVisibility(View.VISIBLE);
|
lineAP.setVisibility(View.VISIBLE);
|
||||||
lineSmartConfig.setVisibility(View.GONE);
|
lineSmartConfig.setVisibility(View.GONE);
|
||||||
// jiablue 暂时隐藏
|
// jiaxblue 暂时隐藏
|
||||||
lineBle.setVisibility(View.GONE);
|
// lineBle.setVisibility(View.GONE);
|
||||||
switch (curConnectType) {
|
switch (curConnectType) {
|
||||||
case SmartConfig:
|
case SmartConfig:
|
||||||
// 处理SmartConfig逻辑
|
// 处理SmartConfig逻辑
|
||||||
|
|
|
||||||
|
|
@ -29,15 +29,15 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
//import com.clj.fastble.BleManager;
|
import com.clj.fastble.BleManager;
|
||||||
//import com.clj.fastble.callback.BleGattCallback;
|
import com.clj.fastble.callback.BleGattCallback;
|
||||||
//import com.clj.fastble.callback.BleMtuChangedCallback;
|
import com.clj.fastble.callback.BleMtuChangedCallback;
|
||||||
//import com.clj.fastble.callback.BleNotifyCallback;
|
import com.clj.fastble.callback.BleNotifyCallback;
|
||||||
//import com.clj.fastble.callback.BleScanCallback;
|
import com.clj.fastble.callback.BleScanCallback;
|
||||||
//import com.clj.fastble.callback.BleWriteCallback;
|
import com.clj.fastble.callback.BleWriteCallback;
|
||||||
//import com.clj.fastble.data.BleDevice;
|
import com.clj.fastble.data.BleDevice;
|
||||||
//import com.clj.fastble.exception.BleException;
|
import com.clj.fastble.exception.BleException;
|
||||||
import com.ifish.activity.BindCameraActivity;
|
import com.ifish.activity.BindCameraActivity;
|
||||||
import com.ifish.activity.BindTankActivity;
|
import com.ifish.activity.BindTankActivity;
|
||||||
import com.ifish.activity.BindTankPetActivity;
|
import com.ifish.activity.BindTankPetActivity;
|
||||||
|
|
@ -151,8 +151,8 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
devicetype = getIntent().getStringExtra("devicetype");
|
devicetype = getIntent().getStringExtra("devicetype");
|
||||||
L.i("jjia----------------devicetype="+devicetype);
|
L.i("jjia----------------devicetype="+devicetype);
|
||||||
airKissUtil.init(this,devicetype);
|
airKissUtil.init(this,devicetype);
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// BleManager.getInstance().disconnectAllDevice();
|
BleManager.getInstance().disconnectAllDevice();
|
||||||
if ("bluetooth".equals(type)){
|
if ("bluetooth".equals(type)){
|
||||||
curConnectType = BlueTooth;
|
curConnectType = BlueTooth;
|
||||||
}else {
|
}else {
|
||||||
|
|
@ -163,8 +163,8 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
switchUIConnectType(curConnectType);
|
switchUIConnectType(curConnectType);
|
||||||
|
|
||||||
if ("bluetooth".equals(type)){ // 主动去联网
|
if ("bluetooth".equals(type)){ // 主动去联网
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// currentDevice = getIntent().getParcelableExtra("device");
|
currentDevice = getIntent().getParcelableExtra("device");
|
||||||
}
|
}
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
|
|
||||||
|
|
@ -472,40 +472,40 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// boolean support = BleManager.getInstance().isSupportBle();
|
boolean support = BleManager.getInstance().isSupportBle();
|
||||||
// if (!support){
|
if (!support){
|
||||||
// ToastUtil.show(NewBindDeviceActivity.this,"当前设备不支持低功耗蓝牙");
|
ToastUtil.show(NewBindDeviceActivity.this,"当前设备不支持低功耗蓝牙");
|
||||||
// } else {
|
} else {
|
||||||
// boolean enable = BleManager.getInstance().isBlueEnable();
|
boolean enable = BleManager.getInstance().isBlueEnable();
|
||||||
// if (enable){
|
if (enable){
|
||||||
// if (TextUtils.isEmpty(type)){
|
if (TextUtils.isEmpty(type)){
|
||||||
// blueScan();
|
blueScan();
|
||||||
// }else {
|
}else {
|
||||||
// showDialog("开始连接蓝牙设备");
|
showDialog("开始连接蓝牙设备");
|
||||||
// connectBle();
|
connectBle();
|
||||||
// }
|
}
|
||||||
// }else {
|
}else {
|
||||||
// AlertDialog.Builder dialog = new AlertDialog.Builder(NewBindDeviceActivity.this, AlertDialog.THEME_HOLO_LIGHT);
|
AlertDialog.Builder dialog = new AlertDialog.Builder(NewBindDeviceActivity.this, AlertDialog.THEME_HOLO_LIGHT);
|
||||||
// dialog.setCancelable(false);
|
dialog.setCancelable(false);
|
||||||
// dialog.setMessage("蓝牙没有打开,现在去申请打开蓝牙,请允许后,再点击'确定'连接");
|
dialog.setMessage("蓝牙没有打开,现在去申请打开蓝牙,请允许后,再点击'确定'连接");
|
||||||
// dialog.setPositiveButton("去申请", new DialogInterface.OnClickListener() {
|
dialog.setPositiveButton("去申请", new DialogInterface.OnClickListener() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onClick(
|
public void onClick(
|
||||||
// DialogInterface dialog,
|
DialogInterface dialog,
|
||||||
// int which) {
|
int which) {
|
||||||
// BlueToothUtil.openBlueTooth(NewBindDeviceActivity.this);
|
BlueToothUtil.openBlueTooth(NewBindDeviceActivity.this);
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// dialog.setNegativeButton("拒绝", new DialogInterface.OnClickListener() {
|
dialog.setNegativeButton("拒绝", new DialogInterface.OnClickListener() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
// finish();
|
finish();
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// dialog.show();
|
dialog.show();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case APConnect:
|
case APConnect:
|
||||||
|
|
@ -520,44 +520,44 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// private void blueScan(){
|
private void blueScan(){
|
||||||
// BleManager.getInstance().scan(new BleScanCallback() {
|
BleManager.getInstance().scan(new BleScanCallback() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onScanFinished(List<BleDevice> scanResultList) {
|
public void onScanFinished(List<BleDevice> scanResultList) {
|
||||||
//
|
|
||||||
// if (currentDevice!=null){
|
if (currentDevice!=null){
|
||||||
// connectBle();
|
connectBle();
|
||||||
// }else {
|
}else {
|
||||||
// ToastUtil.show(NewBindDeviceActivity.this,"扫描结束,没有搜索到可用设备");
|
ToastUtil.show(NewBindDeviceActivity.this,"扫描结束,没有搜索到可用设备");
|
||||||
// dismissDialog();
|
dismissDialog();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onScanStarted(boolean success) {
|
public void onScanStarted(boolean success) {
|
||||||
//// ToastUtil.show(NewBindDeviceActivity.this,"开始扫描");
|
// ToastUtil.show(NewBindDeviceActivity.this,"开始扫描");
|
||||||
// showDialog("正在搜索附近设备,请确保设备处于配网状态");
|
showDialog("正在搜索附近设备,请确保设备处于配网状态");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
// @Override
|
@Override
|
||||||
// public void onScanning(BleDevice bleDevice) {
|
public void onScanning(BleDevice bleDevice) {
|
||||||
// if (bleDevice!=null && bleDevice.getDevice()!=null){
|
if (bleDevice!=null && bleDevice.getDevice()!=null){
|
||||||
// BluetoothDevice bean = bleDevice.getDevice();
|
BluetoothDevice bean = bleDevice.getDevice();
|
||||||
// if (!TextUtils.isEmpty(bean.getName()) && bean.getName().startsWith("ifish")){
|
if (!TextUtils.isEmpty(bean.getName()) && bean.getName().startsWith("ifish")){
|
||||||
// currentDevice = bleDevice;
|
currentDevice = bleDevice;
|
||||||
//// tvname.setText(bean.getName()+bean.getAddress());
|
// tvname.setText(bean.getName()+bean.getAddress());
|
||||||
// BleManager.getInstance().cancelScan();
|
BleManager.getInstance().cancelScan();
|
||||||
// }
|
}
|
||||||
// L.i(bean.getName()+"jjia---------"+bean.getAddress());
|
L.i(bean.getName()+"jjia---------"+bean.getAddress());
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
private boolean isJump = false;
|
private boolean isJump = false;
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// BleDevice currentDevice;
|
BleDevice currentDevice;
|
||||||
/**
|
/**
|
||||||
* 1.跳转设置页面连接ifish-xxx的wifi,连接成功后返回
|
* 1.跳转设置页面连接ifish-xxx的wifi,连接成功后返回
|
||||||
*/
|
*/
|
||||||
|
|
@ -636,142 +636,142 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
private String device_mac;
|
private String device_mac;
|
||||||
// private void openNotify(){
|
private void openNotify(){
|
||||||
// BleManager.getInstance().notify(currentDevice, SERVICE_UUID, WRITE_UUID, new BleNotifyCallback() {
|
BleManager.getInstance().notify(currentDevice, SERVICE_UUID, WRITE_UUID, new BleNotifyCallback() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onNotifySuccess() {
|
public void onNotifySuccess() {
|
||||||
// sendBleData();
|
sendBleData();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onNotifyFailure(BleException exception) {
|
public void onNotifyFailure(BleException exception) {
|
||||||
//// dismissProgressDialogCancelble();
|
// dismissProgressDialogCancelble();
|
||||||
// dismissDialog();
|
dismissDialog();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onCharacteristicChanged(byte[] data) {
|
public void onCharacteristicChanged(byte[] data) {
|
||||||
//
|
|
||||||
// if (data!=null && data.length>0){
|
if (data!=null && data.length>0){
|
||||||
// int check_code = data[1];
|
int check_code = data[1];
|
||||||
// int length = data[14];
|
int length = data[14];
|
||||||
// byte[] dataByte = new byte[length];
|
byte[] dataByte = new byte[length];
|
||||||
// for (int i = 0; i < dataByte.length; i++) {
|
for (int i = 0; i < dataByte.length; i++) {
|
||||||
// dataByte[i] = data[i];
|
dataByte[i] = data[i];
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// Object object = ModelCodec.deCode(dataByte,Commons.IoBuffer);
|
Object object = ModelCodec.deCode(dataByte,Commons.IoBuffer);
|
||||||
// if (object!=null && object instanceof BackFunctionCode7_11){
|
if (object!=null && object instanceof BackFunctionCode7_11){
|
||||||
// BackFunctionCode7_11 model = (BackFunctionCode7_11) object;
|
BackFunctionCode7_11 model = (BackFunctionCode7_11) object;
|
||||||
// String status = ByteUtil.toHex(model.getStatus());
|
String status = ByteUtil.toHex(model.getStatus());
|
||||||
// device_mac = ByteUtil.bytesToHexString(model.getSrc());
|
device_mac = ByteUtil.bytesToHexString(model.getSrc());
|
||||||
//
|
|
||||||
//
|
|
||||||
// dismissDialog();
|
dismissDialog();
|
||||||
// if (!TextUtils.isEmpty(device_mac)){
|
if (!TextUtils.isEmpty(device_mac)){
|
||||||
// showDialog("正在绑定设备...");
|
showDialog("正在绑定设备...");
|
||||||
// connectDevice.cancel();
|
connectDevice.cancel();
|
||||||
// connectDevice.start();
|
connectDevice.start();
|
||||||
// }
|
}
|
||||||
//// checkoutMac(device_mac);
|
// checkoutMac(device_mac);
|
||||||
// }
|
}
|
||||||
// L.i("jjia-------check_code-"+check_code);
|
L.i("jjia-------check_code-"+check_code);
|
||||||
// L.i("jjia-------length-"+length);
|
L.i("jjia-------length-"+length);
|
||||||
// L.i("jjia-------device_mac-"+device_mac);
|
L.i("jjia-------device_mac-"+device_mac);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
int devicePosition = 0;
|
int devicePosition = 0;
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// private void sendBleData(){
|
private void sendBleData(){
|
||||||
//
|
|
||||||
// String ssid = tvWifiName.getText().toString();
|
String ssid = tvWifiName.getText().toString();
|
||||||
// String pwd = tvWifiPwd.getText().toString();
|
String pwd = tvWifiPwd.getText().toString();
|
||||||
//
|
|
||||||
// OrderDeviceConnectModel model = OrderModel.OrderDeviceConnectModel(ssid, pwd,true);//设置正式环境域名
|
OrderDeviceConnectModel model = OrderModel.OrderDeviceConnectModel(ssid, pwd,true);//设置正式环境域名
|
||||||
// byte[] data = ModelCodec.enCode(model, Commons.IoBuffer);
|
byte[] data = ModelCodec.enCode(model, Commons.IoBuffer);
|
||||||
// BleManager.getInstance().write(currentDevice, SERVICE_UUID, WRITE_UUID, data,false, new BleWriteCallback() {
|
BleManager.getInstance().write(currentDevice, SERVICE_UUID, WRITE_UUID, data,false, new BleWriteCallback() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onWriteSuccess(int current, int total, byte[] justWrite) {
|
public void onWriteSuccess(int current, int total, byte[] justWrite) {
|
||||||
//
|
|
||||||
// L.i("jjia-------------ssid 发送");
|
L.i("jjia-------------ssid 发送");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onWriteFailure(BleException exception) {
|
public void onWriteFailure(BleException exception) {
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// private void toReset(){
|
private void toReset(){
|
||||||
// ResetDeviceModel model = OrderModel.resetDevice();//设置正式环境域名
|
ResetDeviceModel model = OrderModel.resetDevice();//设置正式环境域名
|
||||||
// byte[] data = ModelCodec.enCode(model);
|
byte[] data = ModelCodec.enCode(model);
|
||||||
//// data = new byte[1];
|
// data = new byte[1];
|
||||||
//
|
|
||||||
//// QueryTempeSettingModel xx = OrderModel.OrderQueryTempeSettingModel(device_mac);
|
// QueryTempeSettingModel xx = OrderModel.OrderQueryTempeSettingModel(device_mac);
|
||||||
//// byte[] data = ModelCodec.enCode(xx);
|
// byte[] data = ModelCodec.enCode(xx);
|
||||||
// BleManager.getInstance().write(currentDevice, SERVICE_UUID, WRITE_UUID, data,false, new BleWriteCallback() {
|
BleManager.getInstance().write(currentDevice, SERVICE_UUID, WRITE_UUID, data,false, new BleWriteCallback() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onWriteSuccess(int current, int total, byte[] justWrite) {
|
public void onWriteSuccess(int current, int total, byte[] justWrite) {
|
||||||
// L.i("jjia-------------重启 发送 成功-");
|
L.i("jjia-------------重启 发送 成功-");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onWriteFailure(BleException exception) {
|
public void onWriteFailure(BleException exception) {
|
||||||
// L.i("jjia-------------重启 发送 失败"+exception.toString());
|
L.i("jjia-------------重启 发送 失败"+exception.toString());
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final String SERVICE_UUID = "000000ff-0000-1000-8000-00805f9b34fb"; //蓝牙通讯服务
|
public static final String SERVICE_UUID = "000000ff-0000-1000-8000-00805f9b34fb"; //蓝牙通讯服务
|
||||||
public static final String READ_UUID = "0000ff01-0000-1000-8000-00805f9b34fb"; //读特征
|
public static final String READ_UUID = "0000ff01-0000-1000-8000-00805f9b34fb"; //读特征
|
||||||
public static final String WRITE_UUID = "0000ff01-0000-1000-8000-00805f9b34fb"; //写特征
|
public static final String WRITE_UUID = "0000ff01-0000-1000-8000-00805f9b34fb"; //写特征
|
||||||
|
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// private void connectBle(){
|
private void connectBle(){
|
||||||
// BleManager.getInstance().connect(currentDevice, new BleGattCallback() {
|
BleManager.getInstance().connect(currentDevice, new BleGattCallback() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onStartConnect() {
|
public void onStartConnect() {
|
||||||
// showDialog("开始连接蓝牙设备");
|
showDialog("开始连接蓝牙设备");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onConnectFail(BleDevice bleDevice, BleException exception) {
|
public void onConnectFail(BleDevice bleDevice, BleException exception) {
|
||||||
// ToastUtil.show(NewBindDeviceActivity.this,"连接蓝牙设备失败,请重试");
|
ToastUtil.show(NewBindDeviceActivity.this,"连接蓝牙设备失败,请重试");
|
||||||
// dismissDialog();
|
dismissDialog();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onConnectSuccess(BleDevice bleDevice, BluetoothGatt gatt, int status) {
|
public void onConnectSuccess(BleDevice bleDevice, BluetoothGatt gatt, int status) {
|
||||||
//// ToastUtil.show(NewBindDeviceActivity.this,"蓝牙连接成功");
|
// ToastUtil.show(NewBindDeviceActivity.this,"蓝牙连接成功");
|
||||||
//// setMessage("蓝牙连接成功");
|
// setMessage("蓝牙连接成功");
|
||||||
// BleManager.getInstance().setMtu(bleDevice, 512, new BleMtuChangedCallback() {
|
BleManager.getInstance().setMtu(bleDevice, 512, new BleMtuChangedCallback() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onSetMTUFailure(BleException exception) {
|
public void onSetMTUFailure(BleException exception) {
|
||||||
// L.i("jjia-------MTU--"+exception.toString());
|
L.i("jjia-------MTU--"+exception.toString());
|
||||||
// dismissDialog();
|
dismissDialog();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onMtuChanged(int mtu) {
|
public void onMtuChanged(int mtu) {
|
||||||
// L.i("jjia-------MTU--"+mtu);
|
L.i("jjia-------MTU--"+mtu);
|
||||||
// openNotify();
|
openNotify();
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onDisConnected(boolean isActiveDisConnected, BleDevice device, BluetoothGatt gatt, int status) {
|
public void onDisConnected(boolean isActiveDisConnected, BleDevice device, BluetoothGatt gatt, int status) {
|
||||||
//// ToastUtil.show(NewBindDeviceActivity.this,"连接断开了");
|
// ToastUtil.show(NewBindDeviceActivity.this,"连接断开了");
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
private Activity act;
|
private Activity act;
|
||||||
private ConnectDevice connectDevice;
|
private ConnectDevice connectDevice;
|
||||||
private boolean isContinue = true;
|
private boolean isContinue = true;
|
||||||
|
|
@ -791,8 +791,8 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Boolean available) {
|
public int compareTo(Boolean available) {
|
||||||
if (available) {
|
if (available) {
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// toReset();
|
toReset();
|
||||||
isContinue = false;
|
isContinue = false;
|
||||||
connectDevice.cancel();
|
connectDevice.cancel();
|
||||||
L.i("jjia-----------调用绑定接口---");
|
L.i("jjia-----------调用绑定接口---");
|
||||||
|
|
@ -1155,23 +1155,23 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
// myProgressDialogCancelble = null;
|
// myProgressDialogCancelble = null;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// List<BleDevice> deviceList;
|
List<BleDevice> deviceList;
|
||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
private void findConencted(){
|
private void findConencted(){
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// deviceList = BleManager.getInstance().getAllConnectedDevice();
|
deviceList = BleManager.getInstance().getAllConnectedDevice();
|
||||||
// if (deviceList!=null && deviceList.size()>0){
|
if (deviceList!=null && deviceList.size()>0){
|
||||||
// for (BleDevice item:deviceList){
|
for (BleDevice item:deviceList){
|
||||||
// if (item!=null){
|
if (item!=null){
|
||||||
// L.i("jjia-----------"+item.getDevice().getName());
|
L.i("jjia-----------"+item.getDevice().getName());
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// }else {
|
}else {
|
||||||
// L.i("jjia--------没有连接的蓝牙---");
|
L.i("jjia--------没有连接的蓝牙---");
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ public class EventBean {
|
||||||
public String name;
|
public String name;
|
||||||
public String value;
|
public String value;
|
||||||
public int index = 0;
|
public int index = 0;
|
||||||
// jiablue
|
// jiaxblue
|
||||||
// public static String BLUETOOTH_START_SCAN = "start_scan";
|
public static String BLUETOOTH_START_SCAN = "start_scan";
|
||||||
// public static String BLUETOOTH_STOP_SCAN = "stop_scan";
|
public static String BLUETOOTH_STOP_SCAN = "stop_scan";
|
||||||
public static String TAB_INDEX = "tab_index";
|
public static String TAB_INDEX = "tab_index";
|
||||||
public static String LINK_FINISH = "link_finish";
|
public static String LINK_FINISH = "link_finish";
|
||||||
public static String CHANGE_DEVICE_NAME = "change_device_name";
|
public static String CHANGE_DEVICE_NAME = "change_device_name";
|
||||||
|
|
|
||||||
|
|
@ -19,16 +19,15 @@ import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.multidex.MultiDexApplication;
|
import androidx.multidex.MultiDexApplication;
|
||||||
//import com.clj.fastble.BleManager;
|
import com.clj.fastble.BleManager;
|
||||||
//import com.clj.fastble.scan.BleScanRuleConfig;
|
import com.clj.fastble.scan.BleScanRuleConfig;
|
||||||
import com.ifish.activity.BuildConfig;
|
import com.ifish.activity.BuildConfig;
|
||||||
|
import com.ifish.basebean.EventBean;
|
||||||
import com.ifish.utils.ActivityManager;
|
import com.ifish.utils.ActivityManager;
|
||||||
import com.ifish.utils.ImageDownLoader;
|
import com.ifish.utils.ImageDownLoader;
|
||||||
import com.ifish.utils.L;
|
import com.ifish.utils.L;
|
||||||
import com.ifish.utils.SystemUtil;
|
import com.ifish.utils.SystemUtil;
|
||||||
import com.ifish.utils.TrustAllCerts;
|
import com.ifish.utils.TrustAllCerts;
|
||||||
//import com.igexin.sdk.PushManager;
|
|
||||||
import com.igexin.sdk.PushManager;
|
|
||||||
import com.p2p.core.P2PSpecial.P2PSpecial;
|
import com.p2p.core.P2PSpecial.P2PSpecial;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
|
|
@ -41,6 +40,8 @@ import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.SSLSession;
|
import javax.net.ssl.SSLSession;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
|
|
||||||
|
import de.greenrobot.event.EventBus;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -77,19 +78,19 @@ public class BaseApplication extends MultiDexApplication {
|
||||||
P2PSpecial.getInstance().init(app, APPID, APPToken, APPVersion);
|
P2PSpecial.getInstance().init(app, APPID, APPToken, APPVersion);
|
||||||
initLog();
|
initLog();
|
||||||
initPicasso();
|
initPicasso();
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// BleManager.getInstance().init(this);
|
BleManager.getInstance().init(this);
|
||||||
|
|
||||||
UUID[] uuids = {UUID.fromString(SERVICE_UUID)};
|
UUID[] uuids = {UUID.fromString(SERVICE_UUID)};
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// BleScanRuleConfig scanRuleConfig = new BleScanRuleConfig.Builder()
|
BleScanRuleConfig scanRuleConfig = new BleScanRuleConfig.Builder()
|
||||||
// .setServiceUuids(uuids) // 只扫描指定的服务的设备,可选
|
.setServiceUuids(uuids) // 只扫描指定的服务的设备,可选
|
||||||
//// .setDeviceName(true, names) // 只扫描指定广播名的设备,可选
|
// .setDeviceName(true, names) // 只扫描指定广播名的设备,可选
|
||||||
//// .setDeviceMac(mac) // 只扫描指定mac的设备,可选
|
// .setDeviceMac(mac) // 只扫描指定mac的设备,可选
|
||||||
//// .setAutoConnect(isAutoConnect) // 连接时的autoConnect参数,可选,默认false
|
// .setAutoConnect(isAutoConnect) // 连接时的autoConnect参数,可选,默认false
|
||||||
// .setScanTimeOut(30000) // 扫描超时时间30S,可选,默认10秒;小于等于0表示不限制扫描时间
|
.setScanTimeOut(30000) // 扫描超时时间30S,可选,默认10秒;小于等于0表示不限制扫描时间
|
||||||
// .build();
|
.build();
|
||||||
// BleManager.getInstance().initScanRule(scanRuleConfig);
|
BleManager.getInstance().initScanRule(scanRuleConfig);
|
||||||
|
|
||||||
|
|
||||||
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||||
|
|
@ -103,9 +104,9 @@ public class BaseApplication extends MultiDexApplication {
|
||||||
if (count==0){
|
if (count==0){
|
||||||
Activity activityName = ActivityManager.getInstance().lastActivity();
|
Activity activityName = ActivityManager.getInstance().lastActivity();
|
||||||
if (activityName!=null && activityName.toString().contains("MainTabActivity")){
|
if (activityName!=null && activityName.toString().contains("MainTabActivity")){
|
||||||
// jiablue
|
// jiaxblue
|
||||||
// EventBean eventBean = new EventBean(EventBean.BLUETOOTH_START_SCAN);
|
EventBean eventBean = new EventBean(EventBean.BLUETOOTH_START_SCAN);
|
||||||
// EventBus.getDefault().post(eventBean);
|
EventBus.getDefault().post(eventBean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
|
@ -128,9 +129,9 @@ public class BaseApplication extends MultiDexApplication {
|
||||||
if (count==0){
|
if (count==0){
|
||||||
Activity activityName = ActivityManager.getInstance().lastActivity();
|
Activity activityName = ActivityManager.getInstance().lastActivity();
|
||||||
if (activityName!=null && activityName.toString().contains("MainTabActivity")){
|
if (activityName!=null && activityName.toString().contains("MainTabActivity")){
|
||||||
// jiablue
|
// jiaxblue
|
||||||
// EventBean eventBean = new EventBean(EventBean.BLUETOOTH_STOP_SCAN);
|
EventBean eventBean = new EventBean(EventBean.BLUETOOTH_STOP_SCAN);
|
||||||
// EventBus.getDefault().post(eventBean);
|
EventBus.getDefault().post(eventBean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,11 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
//import com.clj.fastble.BleManager;
|
import com.clj.fastble.BleManager;
|
||||||
//import com.clj.fastble.callback.BleScanCallback;
|
import com.clj.fastble.callback.BleScanCallback;
|
||||||
//import com.clj.fastble.data.BleDevice;
|
import com.clj.fastble.data.BleDevice;
|
||||||
//import com.clj.fastble.data.BleScanState;
|
import com.clj.fastble.data.BleScanState;
|
||||||
import com.ifish.activity.BindTwoDeviceActivity;
|
import com.ifish.activity.BindTwoDeviceActivity;
|
||||||
import com.ifish.activity.DeviceInstructionActivity;
|
import com.ifish.activity.DeviceInstructionActivity;
|
||||||
import com.ifish.activity.InformationListActivity;
|
import com.ifish.activity.InformationListActivity;
|
||||||
|
|
@ -1132,8 +1132,8 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
||||||
lv_camera.setAdapter(cameraAdapter);
|
lv_camera.setAdapter(cameraAdapter);
|
||||||
setUserInfo();
|
setUserInfo();
|
||||||
|
|
||||||
// jiablue
|
// jiaxblue
|
||||||
// startDownTimer();
|
startDownTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1591,9 +1591,9 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
||||||
AnimationUtil.startAnimation(getActivity());
|
AnimationUtil.startAnimation(getActivity());
|
||||||
break;
|
break;
|
||||||
case R.id.rl_adddevice:
|
case R.id.rl_adddevice:
|
||||||
// jiablue
|
// jiaxblue
|
||||||
// EventBean eventBean = new EventBean(EventBean.BLUETOOTH_STOP_SCAN);
|
EventBean eventBean = new EventBean(EventBean.BLUETOOTH_STOP_SCAN);
|
||||||
// EventBus.getDefault().post(eventBean);
|
EventBus.getDefault().post(eventBean);
|
||||||
showPermissionHint();
|
showPermissionHint();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1909,42 +1909,42 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
||||||
}
|
}
|
||||||
firstResult = firstResult + HttpManager.PAGESIZE;
|
firstResult = firstResult + HttpManager.PAGESIZE;
|
||||||
}
|
}
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// private void initBooth(){
|
private void initBooth(){
|
||||||
// boolean enable = BleManager.getInstance().isBlueEnable();
|
boolean enable = BleManager.getInstance().isBlueEnable();
|
||||||
// if (enable) {
|
if (enable) {
|
||||||
// BleManager.getInstance().scan(new BleScanCallback() {
|
BleManager.getInstance().scan(new BleScanCallback() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onScanFinished(List<BleDevice> scanResultList) {
|
public void onScanFinished(List<BleDevice> scanResultList) {
|
||||||
// if (currentDevice!=null){ // 扫描结束,有设备
|
if (currentDevice!=null){ // 扫描结束,有设备
|
||||||
// L.i("jjjia-----------scan---");
|
L.i("jjjia-----------scan---");
|
||||||
// showDevice();
|
showDevice();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onScanStarted(boolean success) {
|
public void onScanStarted(boolean success) {
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
// @Override
|
@Override
|
||||||
// public void onScanning(BleDevice bleDevice) {
|
public void onScanning(BleDevice bleDevice) {
|
||||||
// if (bleDevice!=null && bleDevice.getDevice()!=null){
|
if (bleDevice!=null && bleDevice.getDevice()!=null){
|
||||||
// BluetoothDevice bean = bleDevice.getDevice();
|
BluetoothDevice bean = bleDevice.getDevice();
|
||||||
// if (!TextUtils.isEmpty(bean.getName()) && bean.getName().startsWith("ifish")){
|
if (!TextUtils.isEmpty(bean.getName()) && bean.getName().startsWith("ifish")){
|
||||||
// currentDevice = bleDevice;
|
currentDevice = bleDevice;
|
||||||
// BleManager.getInstance().cancelScan();
|
BleManager.getInstance().cancelScan();
|
||||||
// }
|
}
|
||||||
// L.i(bean.getName()+"jjia------mac---"+bean.getAddress());
|
L.i(bean.getName()+"jjia------mac---"+bean.getAddress());
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// BleDevice currentDevice;
|
BleDevice currentDevice;
|
||||||
public void onEventMainThread(BluetoothDevice event) {
|
public void onEventMainThread(BluetoothDevice event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1953,33 +1953,33 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
||||||
private boolean isShowEd = false;
|
private boolean isShowEd = false;
|
||||||
|
|
||||||
private int currentIndex = 0;
|
private int currentIndex = 0;
|
||||||
// jiablue
|
// jiaxblue
|
||||||
// public void onEventMainThread(EventBean eventBean){
|
public void onEventMainThread(EventBean eventBean){
|
||||||
// if (eventBean!= null){
|
if (eventBean!= null){
|
||||||
// if (EventBean.BLUETOOTH_START_SCAN.equals(eventBean.name)){
|
if (EventBean.BLUETOOTH_START_SCAN.equals(eventBean.name)){
|
||||||
// if (!isShowEd){
|
if (!isShowEd){
|
||||||
// initBooth();
|
initBooth();
|
||||||
// }
|
}
|
||||||
// }else if (EventBean.BLUETOOTH_STOP_SCAN.equals(eventBean.name)){
|
}else if (EventBean.BLUETOOTH_STOP_SCAN.equals(eventBean.name)){
|
||||||
// if (!isShowIng){
|
if (!isShowIng){
|
||||||
// currentDevice = null;
|
currentDevice = null;
|
||||||
// }
|
}
|
||||||
// BleManager.getInstance().cancelScan();
|
BleManager.getInstance().cancelScan();
|
||||||
// }else
|
}else
|
||||||
//
|
|
||||||
// if (EventBean.TAB_INDEX.equals(eventBean.name)){
|
if (EventBean.TAB_INDEX.equals(eventBean.name)){
|
||||||
// currentIndex = eventBean.index;
|
currentIndex = eventBean.index;
|
||||||
// L.i("jjia-----tab_index--"+eventBean.index);
|
L.i("jjia-----tab_index--"+eventBean.index);
|
||||||
// if (currentIndex == 0){
|
if (currentIndex == 0){
|
||||||
// startDownTimer();
|
startDownTimer();
|
||||||
// }else {
|
}else {
|
||||||
// oonPause();
|
oonPause();
|
||||||
// }
|
}
|
||||||
// }else if (EventBean.HEADER.equals(eventBean.name)){
|
}else if (EventBean.HEADER.equals(eventBean.name)){
|
||||||
// Glide.with(getActivity()).load(eventBean.value).into(iv_head);
|
Glide.with(getActivity()).load(eventBean.value).into(iv_head);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
private void showPermissionHint(){
|
private void showPermissionHint(){
|
||||||
IosAlertDialog dialog = new IosAlertDialog(getContext()).builder();
|
IosAlertDialog dialog = new IosAlertDialog(getContext()).builder();
|
||||||
|
|
@ -2025,8 +2025,8 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
||||||
intent.setClass(requireActivity(), NewBindDeviceActivity.class);
|
intent.setClass(requireActivity(), NewBindDeviceActivity.class);
|
||||||
intent.putExtra("title", "连接水族箱");
|
intent.putExtra("title", "连接水族箱");
|
||||||
intent.putExtra("type", "bluetooth");
|
intent.putExtra("type", "bluetooth");
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// intent.putExtra("device", currentDevice);
|
intent.putExtra("device", currentDevice);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
AnimationUtil.finishAnimation(requireActivity());
|
AnimationUtil.finishAnimation(requireActivity());
|
||||||
});
|
});
|
||||||
|
|
@ -2045,22 +2045,22 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
||||||
@Override
|
@Override
|
||||||
public void onTick(long l) {
|
public void onTick(long l) {
|
||||||
L.i("jjia-----dowmCount--"+dowmCount);
|
L.i("jjia-----dowmCount--"+dowmCount);
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// if (dowmCount%6==0){
|
if (dowmCount%6==0){
|
||||||
// BleScanState scanState = getScanState();
|
BleScanState scanState = getScanState();
|
||||||
// L.i("jjia-----------timer--"+scanState);
|
L.i("jjia-----------timer--"+scanState);
|
||||||
// if (BleScanState.STATE_IDLE.equals(scanState)){
|
if (BleScanState.STATE_IDLE.equals(scanState)){
|
||||||
// if (isShowIng){
|
if (isShowIng){
|
||||||
// L.i("jjia-----已经扫描到设备了,等待反馈-");
|
L.i("jjia-----已经扫描到设备了,等待反馈-");
|
||||||
// closeDownTimer();
|
closeDownTimer();
|
||||||
// }else {
|
}else {
|
||||||
// initBooth();
|
initBooth();
|
||||||
// L.i("jjia-----开始扫描-");
|
L.i("jjia-----开始扫描-");
|
||||||
// }
|
}
|
||||||
// }else {
|
}else {
|
||||||
// L.i("jjia----timer--上一次的扫描还在继续中-");
|
L.i("jjia----timer--上一次的扫描还在继续中-");
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
dowmCount++;
|
dowmCount++;
|
||||||
}
|
}
|
||||||
|
|
@ -2083,10 +2083,10 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
||||||
countDownTimer = null;
|
countDownTimer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// private BleScanState getScanState(){
|
private BleScanState getScanState(){
|
||||||
// return BleManager.getInstance().getScanSate();
|
return BleManager.getInstance().getScanSate();
|
||||||
// }
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
|
|
@ -2096,14 +2096,14 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
||||||
|
|
||||||
private void oonPause(){
|
private void oonPause(){
|
||||||
closeDownTimer();
|
closeDownTimer();
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
// BleScanState scanState = getScanState();
|
BleScanState scanState = getScanState();
|
||||||
// if (BleScanState.STATE_SCANNING.equals(scanState)) {
|
if (BleScanState.STATE_SCANNING.equals(scanState)) {
|
||||||
// BleManager.getInstance().cancelScan();
|
BleManager.getInstance().cancelScan();
|
||||||
// L.i("jjia---扫描暂停----------");
|
L.i("jjia---扫描暂停----------");
|
||||||
// } else {
|
} else {
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
// L.i("jjia---扫描暂停-"+scanState);
|
L.i("jjia---扫描暂停-"+scanState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
//jjia-push
|
//jjia-xpush
|
||||||
//import com.clj.fastble.BleManager;
|
import com.clj.fastble.BleManager;
|
||||||
import com.ifish.activity.AboutActivity;
|
import com.ifish.activity.AboutActivity;
|
||||||
import com.ifish.activity.BindTwoDeviceActivity;
|
import com.ifish.activity.BindTwoDeviceActivity;
|
||||||
import com.ifish.activity.CaptureActivity;
|
import com.ifish.activity.CaptureActivity;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue