@@ -6,7 +6,7 @@ android { | |||
applicationId "aicare.net.cn.sdk.ailinksdkdemoandroid" | |||
minSdkVersion 19 | |||
targetSdkVersion 33 | |||
versionName "1.11.10" | |||
versionName "1.11.11" | |||
versionCode getVersionCodeNumber(versionName) | |||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||
} | |||
@@ -66,9 +66,9 @@ dependencies { | |||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | |||
implementation 'androidx.cardview:cardview:1.0.0' | |||
testImplementation 'junit:junit:4.12' | |||
implementation 'com.github.elinkthings:AILinkSDKRepositoryAndroid:1.14.3'//蓝牙核心库 | |||
implementation 'com.github.elinkthings:AILinkSDKRepositoryAndroid:1.14.5'//蓝牙核心库 | |||
// implementation 'com.github.elinkthings:AILinkSDKOtaLibraryAndroid:1.1.4'//OTA库,需要依赖核心库 | |||
implementation 'com.github.elinkthings:AILinkSDKParsingLibraryAndroid:1.9.2'//蓝牙解析库 | |||
implementation 'com.github.elinkthings:AILinkSDKParsingLibraryAndroid:1.9.3'//蓝牙解析库 | |||
implementation 'androidx.recyclerview:recyclerview:1.3.2' | |||
implementation 'com.jakewharton:butterknife:10.2.3' | |||
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3' |
@@ -303,9 +303,9 @@ public class ADWeightScaleCmdActivity extends BleBaseActivity implements OnCallb | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mDevice = ADWeightScaleDeviceData.getInstance(bleDevice); | |||
mDevice.setOnNotifyData(this); | |||
@@ -321,7 +321,7 @@ public class ADWeightScaleCmdActivity extends BleBaseActivity implements OnCallb | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@Override | |||
@@ -331,8 +331,8 @@ public class ADWeightScaleCmdActivity extends BleBaseActivity implements OnCallb | |||
mDevice.clear(); | |||
mDevice = null; | |||
} | |||
if (mBluetoothService != null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -186,9 +186,9 @@ public class AiLinkScooterActivity extends BleBaseActivity implements View.OnCli | |||
@Override | |||
public void onServiceSuccess() { | |||
logList.add(0,"绑定服务成功"); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
AilinkScooterBleData.init(bleDevice); | |||
AilinkScooterBleData.getInstance().setScooterListener(this); | |||
@@ -205,8 +205,8 @@ public class AiLinkScooterActivity extends BleBaseActivity implements View.OnCli | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -145,9 +145,9 @@ public class BLDWeightScaleBleActivity extends BleBaseActivity implements View.O | |||
mMHandler.sendEmptyMessage(ToRefreUi); | |||
// BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
BLDBodyFatBleUtilsData.init(bleDevice, this); | |||
bodyFatBleUtilsData = BLDBodyFatBleUtilsData.getInstance(); | |||
@@ -171,8 +171,8 @@ public class BLDWeightScaleBleActivity extends BleBaseActivity implements View.O | |||
public void unbindServices() { | |||
mlogList.add(0, "服务与界面建立断开连接成功"); | |||
mMHandler.sendEmptyMessage(ToRefreUi); | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -256,9 +256,9 @@ public class BabyBodyFatCmdActivity extends BleBaseActivity implements OnCallbac | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mDevice = BabyBodyFatDeviceData.getInstance(bleDevice); | |||
mDevice.setOnNotifyData(this); | |||
@@ -273,7 +273,7 @@ public class BabyBodyFatCmdActivity extends BleBaseActivity implements OnCallbac | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@Override | |||
@@ -283,8 +283,8 @@ public class BabyBodyFatCmdActivity extends BleBaseActivity implements OnCallbac | |||
mDevice.clear(); | |||
mDevice = null; | |||
} | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -236,8 +236,8 @@ public class BabyCmdActivity extends BleBaseActivity implements OnCallbackDis, O | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
babyDevice = BabyDeviceData.getInstance(bleDevice); | |||
babyDevice.setOnNotifyData(new babyNotifyData()); | |||
@@ -252,7 +252,7 @@ public class BabyCmdActivity extends BleBaseActivity implements OnCallbackDis, O | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@Override |
@@ -153,7 +153,7 @@ public class BleCmdActivity extends BleBaseActivity implements OnCallbackBle, On | |||
addShowData("断开连接"); | |||
break; | |||
case R.id.btnConnect: | |||
mBluetoothService.connectDevice(mAddress); | |||
mAILinkBleManager.connectDevice(mAddress); | |||
addShowData("连接设备"); | |||
break; | |||
case R.id.btnClear: | |||
@@ -363,14 +363,14 @@ public class BleCmdActivity extends BleBaseActivity implements OnCallbackBle, On | |||
addShowData("服务与界面建立连接成功"); | |||
CallbackDisIm.getInstance().addListListener(this); | |||
mBluetoothService.setOnCallbackBle(this); | |||
mBluetoothService.deviceConnectListener(mAddress, true); | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
mAILinkBleManager.deviceConnectListener(mAddress, true); | |||
connectSuccess(); | |||
} | |||
private void connectSuccess() { | |||
if (mBluetoothService != null) { | |||
mBleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mBleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (mBleDevice == null) { | |||
BleLog.i(TAG, "mBleDevice==null"); | |||
@@ -404,15 +404,15 @@ public class BleCmdActivity extends BleBaseActivity implements OnCallbackBle, On | |||
} | |||
}, 3000); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@Override | |||
public void unbindServices() { | |||
CallbackDisIm.getInstance().removeListener(this); | |||
mBluetoothService.disconnectAll(); | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
mAILinkBleManager.disconnectAll(); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -88,9 +88,9 @@ public class BloodGlucoseActivity extends aicare.net.cn.sdk.ailinksdkdemoandroid | |||
public void onServiceSuccess() { | |||
mLogList.add(0, "绑定服务成功"); | |||
listAdapter.notifyDataSetChanged(); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mBloodGlucoseBleDeviceData = new BloodGlucoseBleDeviceData(bleDevice); | |||
mBloodGlucoseBleDeviceData.setBloodGlucoseCallback(this); |
@@ -207,8 +207,8 @@ public class BloodOxygenActivity extends BleBaseActivity implements OnCallbackBl | |||
@Override | |||
public void onServiceSuccess() { | |||
loglist.add(0, "连接设备成功"); | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
BleBloodOxygenDeviceData.init(bleDevice, this); | |||
mBleBloodOxygenDeviceData = BleBloodOxygenDeviceData.getInstance(); | |||
} | |||
@@ -220,8 +220,8 @@ public class BloodOxygenActivity extends BleBaseActivity implements OnCallbackBl | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -97,13 +97,13 @@ public class BroadcastBloodOxygenActivity extends BleBaseActivity implements OnC | |||
mHandler.sendEmptyMessage(REFRESH_DATA); | |||
break; | |||
case R.id.open: | |||
if (mBluetoothService != null) { | |||
mBluetoothService.startScan(0, UUID.fromString("0000F0A0-0000-1000-8000-00805F9B34FB")); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.startScan(0, UUID.fromString("0000F0A0-0000-1000-8000-00805F9B34FB")); | |||
} | |||
break; | |||
case R.id.stop: | |||
if (mBluetoothService != null) { | |||
mBluetoothService.stopScan(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.stopScan(); | |||
} | |||
break; | |||
} | |||
@@ -117,11 +117,11 @@ public class BroadcastBloodOxygenActivity extends BleBaseActivity implements OnC | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
if (mAILinkBleManager != null) { | |||
mDevice = BroadcastBloodOxygenDeviceData.getInstance(); | |||
mDevice.setOnNotifyData(this); | |||
mBluetoothService.setOnScanFilterListener(this); | |||
mBluetoothService.startScan(0, BleConfig.UUID_SERVER_BROADCAST_AILINK); | |||
mAILinkBleManager.setOnScanFilterListener(this); | |||
mAILinkBleManager.startScan(0, BleConfig.UUID_SERVER_BROADCAST_AILINK); | |||
} | |||
} | |||
@@ -129,7 +129,7 @@ public class BroadcastBloodOxygenActivity extends BleBaseActivity implements OnC | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@Override |
@@ -153,8 +153,8 @@ public class ClearShakeHandsActivity extends BleBaseActivity implements OnCallba | |||
CallbackDisIm.getInstance().addListListener(this); | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
mBleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mBleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
mBleDevice.setA7Encryption(false); | |||
mBleDevice.setOnBleDeviceDataListener(ClearShakeHandsActivity.this); | |||
mBleDevice.setOnBleVersionListener(ClearShakeHandsActivity.this); | |||
@@ -170,7 +170,7 @@ public class ClearShakeHandsActivity extends BleBaseActivity implements OnCallba | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@@ -117,9 +117,9 @@ public class EightBodyfatActivity extends BleBaseActivity implements View.OnClic | |||
@Override | |||
public void onServiceSuccess() { | |||
loglist.add(0, "绑定服务成功"); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mEightBodyFatBleDeviceData = new EightBodyFatBleDeviceData(bleDevice); | |||
mEightBodyFatBleDeviceData.setEightBodyFatCallback(this); | |||
@@ -135,8 +135,8 @@ public class EightBodyfatActivity extends BleBaseActivity implements View.OnClic | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -157,8 +157,8 @@ public class HeightCmdActivity extends BleBaseActivity implements OnCallbackDis, | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
CallbackDisIm.getInstance().addListListener(this); | |||
if (mBluetoothService != null) { | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mBleDevice = HeightDeviceData.getInstance(bleDevice); | |||
mBleDevice.setOnNotifyData(HeightCmdActivity.this); | |||
@@ -173,7 +173,7 @@ public class HeightCmdActivity extends BleBaseActivity implements OnCallbackDis, | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@@ -61,9 +61,9 @@ public class HeightWeightScaleActivity extends BleBaseActivity implements OnCall | |||
@Override | |||
public void onServiceSuccess() { | |||
logList.add(0, "绑定服务成功"); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
HeightBodyFatBleData.init(bleDevice); | |||
HeightBodyFatBleData.getInstance().setOnHeightBodyFatDataCallback(this); | |||
@@ -81,8 +81,8 @@ public class HeightWeightScaleActivity extends BleBaseActivity implements OnCall | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -174,7 +174,7 @@ public class ShowBleActivity extends BleBaseActivity implements OnCallbackBle, O | |||
btn.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View v) { | |||
if (mBluetoothService != null) { | |||
if (mAILinkBleManager != null) { | |||
BleLog.i(TAG, "搜索设备"); | |||
try { | |||
String cidStr = et_cid.getText().toString().trim(); | |||
@@ -192,10 +192,10 @@ public class ShowBleActivity extends BleBaseActivity implements OnCallbackBle, O | |||
if (mType == BleDeviceConfig.SMART_SCOOTER) { | |||
List<BleScanAddAilinkBean> list = new ArrayList<>(); | |||
list.add(new BleScanAddAilinkBean(0x37, 0x03, 0x01, SkateboardBleConfig.UUID_BROADCAST)); | |||
mBluetoothService.startScan(30 * 1000, list, BleConfig.UUID_SERVER_AILINK, SkateboardBleConfig.UUID_BROADCAST); | |||
mAILinkBleManager.startScan(30 * 1000, list, BleConfig.UUID_SERVER_AILINK, SkateboardBleConfig.UUID_BROADCAST); | |||
} else { | |||
//0000FEE7=手表 | |||
mBluetoothService.startScan(30 * 1000, BleConfig.UUID_BROADCAST_AILINK, BleConfig.UUID_SERVER_BROADCAST_AILINK, UUID.fromString("0000FEE7-0000-1000-8000-00805F9B34FB"), SkateboardBleConfig.UUID_BROADCAST); | |||
mAILinkBleManager.startScan(30 * 1000, BleConfig.UUID_BROADCAST_AILINK, BleConfig.UUID_SERVER_BROADCAST_AILINK, UUID.fromString("0000FEE7-0000-1000-8000-00805F9B34FB"), SkateboardBleConfig.UUID_BROADCAST); | |||
} | |||
mBleValueList.clear(); | |||
listAdapter.notifyDataSetChanged(); | |||
@@ -206,15 +206,15 @@ public class ShowBleActivity extends BleBaseActivity implements OnCallbackBle, O | |||
btn1.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View v) { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.stopScan(10000); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.stopScan(10000); | |||
} | |||
} | |||
}); | |||
clear.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View v) { | |||
if (mBluetoothService != null) { | |||
if (mAILinkBleManager != null) { | |||
mBleValueList.clear(); | |||
listAdapter.notifyDataSetChanged(); | |||
} | |||
@@ -233,9 +233,9 @@ public class ShowBleActivity extends BleBaseActivity implements OnCallbackBle, O | |||
if (mType == BleDeviceConfig.CLEAR_SHAKE_HANDS) { | |||
//验证不握手,不加密的界面使用 | |||
BleConfig.setHandshakeStatus(mac, false); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.stopScan(); | |||
mBluetoothService.connectDevice(new BleValueBean(mac, mCid, mVid, mPid)); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.stopScan(); | |||
mAILinkBleManager.connectDevice(new BleValueBean(mac, mCid, mVid, mPid)); | |||
showLoading(); | |||
} | |||
} else if (BleDeviceConfig.TOOTHBRUSH_WIFI_BLE == mType) { | |||
@@ -272,9 +272,9 @@ public class ShowBleActivity extends BleBaseActivity implements OnCallbackBle, O | |||
BleConfig.setHandshakeStatus(mac, true, mCid, mVid, mPid); | |||
mNoEncryptionMac = mac; | |||
} | |||
if (mBluetoothService != null) { | |||
mBluetoothService.stopScan(); | |||
mBluetoothService.connectDevice(new BleValueBean(mac, mCid, mVid, mPid)); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.stopScan(); | |||
mAILinkBleManager.connectDevice(new BleValueBean(mac, mCid, mVid, mPid)); | |||
showLoading(); | |||
} | |||
} | |||
@@ -375,7 +375,7 @@ public class ShowBleActivity extends BleBaseActivity implements OnCallbackBle, O | |||
@Override | |||
public void onServicesDiscovered(@NonNull String mac) { | |||
if (mac.equalsIgnoreCase(mNoEncryptionMac)) { | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mac); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mac); | |||
bleDevice.setA7Encryption(false); | |||
mNoEncryptionMac = ""; | |||
@@ -636,11 +636,11 @@ public class ShowBleActivity extends BleBaseActivity implements OnCallbackBle, O | |||
@Override | |||
public void onServiceSuccess() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(ShowBleActivity.this); | |||
mBluetoothService.setOnScanFilterListener(ShowBleActivity.this); | |||
mBluetoothService.initForegroundService(1, R.mipmap.ic_launcher, "前台服务", MainActivity.class); | |||
mBluetoothService.startForegroundService();//启动前台服务 | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(ShowBleActivity.this); | |||
mAILinkBleManager.setOnScanFilterListener(ShowBleActivity.this); | |||
mAILinkBleManager.initForegroundService(1, R.mipmap.ic_launcher, "前台服务", MainActivity.class); | |||
mAILinkBleManager.startForegroundService();//启动前台服务 | |||
mHandler.sendEmptyMessage(BIND_SERVER_OK); | |||
} | |||
} | |||
@@ -652,8 +652,8 @@ public class ShowBleActivity extends BleBaseActivity implements OnCallbackBle, O | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -685,17 +685,17 @@ public class ShowBleActivity extends BleBaseActivity implements OnCallbackBle, O | |||
@Override | |||
protected void onResume() { | |||
super.onResume(); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(ShowBleActivity.this); | |||
mBluetoothService.setOnScanFilterListener(ShowBleActivity.this); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(ShowBleActivity.this); | |||
mAILinkBleManager.setOnScanFilterListener(ShowBleActivity.this); | |||
} | |||
} | |||
@Override | |||
protected void onDestroy() { | |||
super.onDestroy(); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.stopScan(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.stopScan(); | |||
} | |||
} | |||
@@ -179,8 +179,8 @@ public class SmartMaskActivity extends BleBaseActivity implements OnCallbackDis, | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mDevice = SmartMaskDeviceData.getInstance(bleDevice); | |||
mDevice.setOnNotifyData(this); | |||
@@ -193,7 +193,7 @@ public class SmartMaskActivity extends BleBaseActivity implements OnCallbackDis, | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@Override |
@@ -187,8 +187,8 @@ public class SphyCmdActivity extends BleBaseActivity implements OnCallbackDis, O | |||
CallbackDisIm.getInstance().addListListener(this); | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mBleDevice = SphyDeviceData.getInstance(bleDevice); | |||
mBleDevice.setType(mCid); | |||
@@ -204,7 +204,7 @@ public class SphyCmdActivity extends BleBaseActivity implements OnCallbackDis, O | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@@ -237,8 +237,8 @@ public class TempCmdActivity extends BleBaseActivity implements OnCallbackDis, O | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
CallbackDisIm.getInstance().addListListener(this); | |||
if (mBluetoothService != null) { | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mBleDevice = TempDeviceData.getInstance(bleDevice); | |||
mBleDevice.setOnNotifyData(new NotifyData()); | |||
@@ -263,7 +263,7 @@ public class TempCmdActivity extends BleBaseActivity implements OnCallbackDis, O | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@Override |
@@ -159,8 +159,8 @@ public class TempGunCmdActivity extends BleBaseActivity implements OnCallbackDis | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
CallbackDisIm.getInstance().addListListener(this); | |||
if (mBluetoothService != null) { | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mBleDevice = TempGunDeviceData.getInstance(bleDevice); | |||
mBleDevice.setOnNotifyData(TempGunCmdActivity.this); | |||
@@ -178,7 +178,7 @@ public class TempGunCmdActivity extends BleBaseActivity implements OnCallbackDis | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@Override |
@@ -46,15 +46,15 @@ public class TempHumidityActivity extends BleBaseActivity implements OnCallbackB | |||
@Override | |||
public void onServiceSuccess() { | |||
logList.add(0, "绑定服务成功"); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
mBluetoothService.deviceConnectListener(mAddress, true); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
mAILinkBleManager.deviceConnectListener(mAddress, true); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
TempHumidityBleUtils.init(bleDevice); | |||
TempHumidityBleUtils.getInstance().setBleDataCallBack(this); | |||
} else { | |||
mBluetoothService.disconnectAll(); | |||
mAILinkBleManager.disconnectAll(); | |||
startScanBle(0); | |||
} | |||
} | |||
@@ -68,8 +68,8 @@ public class TempHumidityActivity extends BleBaseActivity implements OnCallbackB | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -115,7 +115,7 @@ public class TempHumidityActivity extends BleBaseActivity implements OnCallbackB | |||
public void onScanning(BleValueBean data) { | |||
if (data.getMac().equalsIgnoreCase(mAddress)) { | |||
stopScanBle(); | |||
mBluetoothService.connectDevice(mAddress); | |||
mAILinkBleManager.connectDevice(mAddress); | |||
} | |||
@@ -154,7 +154,7 @@ public class TempHumidityActivity extends BleBaseActivity implements OnCallbackB | |||
if (mac.equalsIgnoreCase(mAddress)) { | |||
stopScanBle(); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
TempHumidityBleUtils.init(bleDevice); | |||
TempHumidityBleUtils.getInstance().setBleDataCallBack(this); | |||
@@ -319,7 +319,7 @@ public class TempHumidityActivity extends BleBaseActivity implements OnCallbackB | |||
protected void onDestroy() { | |||
super.onDestroy(); | |||
mMHandler.removeMessages(HEART); | |||
if (mBluetoothService != null) | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
} |
@@ -205,8 +205,8 @@ public class TestCmdActivity extends BleBaseActivity implements OnCallbackDis, O | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
mBleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mBleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
CallbackDisIm.getInstance().addListListener(this); | |||
if (mBleDevice != null) { | |||
mBleDevice.setOnBleOtherDataListener(this); | |||
@@ -220,7 +220,7 @@ public class TestCmdActivity extends BleBaseActivity implements OnCallbackDis, O | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@Override |
@@ -158,8 +158,8 @@ public class TpmsConnectCmdActivity extends BleBaseActivity implements OnCallbac | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
CallbackDisIm.getInstance().addListListener(this); | |||
if (mBluetoothService != null) { | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mBleDevice = TpmsDeviceData.getInstance(bleDevice); | |||
mBleDevice.setOnNotifyData(TpmsConnectCmdActivity.this); | |||
@@ -175,7 +175,7 @@ public class TpmsConnectCmdActivity extends BleBaseActivity implements OnCallbac | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@@ -51,9 +51,9 @@ public class TransmissionActivity extends BleBaseActivity implements View.OnClic | |||
mMHandler.sendEmptyMessage(ToRefreUi); | |||
// BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
if (tv_device_info!=null) { | |||
tv_device_info.setText("MAC:"+bleDevice.getMac()); | |||
@@ -73,8 +73,8 @@ public class TransmissionActivity extends BleBaseActivity implements View.OnClic | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -220,8 +220,8 @@ public class TransmissionActivity extends BleBaseActivity implements View.OnClic | |||
@Override | |||
protected void onDestroy() { | |||
super.onDestroy(); | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
} | |||
} |
@@ -172,11 +172,11 @@ public class WeightScaleBleActivity extends BleBaseActivity implements View.OnCl | |||
mMHandler.sendEmptyMessage(ToRefreUi); | |||
// BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
BodyFatBleUtilsData.init(bleDevice, this, null); | |||
BodyFatBleUtilsData.init(bleDevice, this); | |||
bodyFatBleUtilsData = BodyFatBleUtilsData.getInstance(); | |||
if (bodyFatBleUtilsData != null) { | |||
bodyFatBleUtilsData.sendData(BodyFatDataUtil.getInstance().setWeightUnit(weighunit, BleDeviceConfig.WEIGHT_BODY_FAT_SCALE)); | |||
@@ -199,8 +199,8 @@ public class WeightScaleBleActivity extends BleBaseActivity implements View.OnCl | |||
public void unbindServices() { | |||
mlogList.add(0, "服务与界面建立断开连接成功"); | |||
mMHandler.sendEmptyMessage(ToRefreUi); | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -462,20 +462,6 @@ public class WeightScaleBleActivity extends BleBaseActivity implements View.OnCl | |||
} | |||
@Override | |||
public void onSetIpStatus(int status) { | |||
} | |||
@Override | |||
public void onSetPortStatus(int status) { | |||
} | |||
@Override | |||
public void onSetIpUrlStatus(int status) { | |||
} | |||
@Override | |||
public void onIpData(String ip) { |
@@ -26,7 +26,7 @@ public abstract class BleBaseActivity extends AppCompatActivity { | |||
private static String TAG = BleBaseActivity.class.getName(); | |||
protected AILinkBleManager mBluetoothService; | |||
protected AILinkBleManager mAILinkBleManager; | |||
private Handler mHandler = new Handler(Looper.getMainLooper()); | |||
@Override | |||
@@ -96,20 +96,20 @@ public abstract class BleBaseActivity extends AppCompatActivity { | |||
AILinkBleManager.getInstance().init(this, new AILinkBleManager.onInitListener() { | |||
@Override | |||
public void onInitSuccess() { | |||
mBluetoothService = AILinkBleManager.getInstance(); | |||
mAILinkBleManager = AILinkBleManager.getInstance(); | |||
onServiceSuccess(); | |||
} | |||
@Override | |||
public void onInitFailure() { | |||
AILinkBleManager.getInstance().clear(); | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
onServiceErr(); | |||
} | |||
}); | |||
}else { | |||
mHandler.postDelayed(()->{ | |||
mBluetoothService = AILinkBleManager.getInstance(); | |||
mAILinkBleManager = AILinkBleManager.getInstance(); | |||
onServiceSuccess(); | |||
},500); | |||
} |
@@ -142,15 +142,15 @@ public class FindDeviceActivity extends BleBaseActivity implements View.OnClickL | |||
@Override | |||
protected void onDestroy() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
mFindDeviceData = FindDeviceData.getInstance(mBleDevice); | |||
mFindDeviceData.setOnNotifyData(this); |
@@ -160,7 +160,7 @@ public class FindDeviceNewActivity extends BleAppBaseActivity implements View.On | |||
mFindDeviceAdapter.notifyDataSetChanged(); | |||
} | |||
mFindDeviceData.getConnectInfoList(); | |||
mBluetoothService.startScan(30 * 1000); | |||
mAILinkBleManager.startScan(30 * 1000); | |||
} | |||
break; | |||
@@ -185,8 +185,8 @@ public class FindDeviceNewActivity extends BleAppBaseActivity implements View.On | |||
mac.deleteCharAt(mac.length() - 1); | |||
} | |||
SP.getInstance().putFindDeviceMacList(mac.toString()); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@@ -200,10 +200,10 @@ public class FindDeviceNewActivity extends BleAppBaseActivity implements View.On | |||
// ------------------- 权限 ------------------ | |||
@Override | |||
protected void onPermissionsOk() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBluetoothService.setOnScanFilterListener(this); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
mAILinkBleManager.setOnScanFilterListener(this); | |||
if (mBleDevice != null) { | |||
mFindDeviceData = FindDeviceData.getInstance(mBleDevice); | |||
mFindDeviceData.setOnNotifyData(this); | |||
@@ -224,7 +224,7 @@ public class FindDeviceNewActivity extends BleAppBaseActivity implements View.On | |||
@Override | |||
public void onServiceSuccess() { | |||
if (mBluetoothService != null) { | |||
if (mAILinkBleManager != null) { | |||
initPermissions(); | |||
} | |||
@@ -238,11 +238,11 @@ public class FindDeviceNewActivity extends BleAppBaseActivity implements View.On | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null){ | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager !=null){ | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
mFindDeviceData = null; | |||
mBluetoothService=null; | |||
mAILinkBleManager =null; | |||
} | |||
@Override | |||
@@ -269,9 +269,9 @@ public class FindDeviceNewActivity extends BleAppBaseActivity implements View.On | |||
mMac = bleValueBean.getMac(); | |||
} else if (bleValueBean.getMac().equalsIgnoreCase(mMac) && mFindDeviceData == null) { | |||
BleConfig.setHandshakeStatus(mMac, false); | |||
mBluetoothService.stopScan(); | |||
mBluetoothService.connectDevice(mMac); | |||
mBluetoothService.setOnCallbackBle(this); | |||
mAILinkBleManager.stopScan(); | |||
mAILinkBleManager.connectDevice(mMac); | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
} else if (bleValueBean.getName() == null || !bleValueBean.getName().trim().toUpperCase().startsWith(BLE_NAME_START.toUpperCase())) { | |||
onNearbyDeviceInfo(bleValueBean.getMac(), bleValueBean.getRssi(), bleValueBean.getManufacturerData()); | |||
} | |||
@@ -292,7 +292,7 @@ public class FindDeviceNewActivity extends BleAppBaseActivity implements View.On | |||
@Override | |||
public void onServicesDiscovered(String mac) { | |||
if (mac.equalsIgnoreCase(mMac)) { | |||
mBluetoothService.stopScan(); | |||
mAILinkBleManager.stopScan(); | |||
onServiceSuccess(); | |||
} | |||
} | |||
@@ -300,14 +300,14 @@ public class FindDeviceNewActivity extends BleAppBaseActivity implements View.On | |||
@Override | |||
public void bleOpen() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.stopScan(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.stopScan(); | |||
mList.add("正在扫描连接..."); | |||
if (tv_status != null) | |||
tv_status.setText("正在连接..."); | |||
mHandler.sendEmptyMessage(REFRESH_DATA); | |||
mBluetoothService.startScan(0, BleConfig.UUID_SERVER_AILINK); | |||
mAILinkBleManager.startScan(0, BleConfig.UUID_SERVER_AILINK); | |||
} | |||
} |
@@ -243,8 +243,8 @@ public class PublicBleNetworkCmdActivity extends BleBaseActivity implements OnCa | |||
CallbackDisIm.getInstance().addListListener(this); | |||
mList.add("服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
mBleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mBleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (mBleDevice != null) { | |||
mBleDevice.setOnBleVersionListener(PublicBleNetworkCmdActivity.this); | |||
mBleDevice.setOnMcuParameterListener(PublicBleNetworkCmdActivity.this); | |||
@@ -261,7 +261,7 @@ public class PublicBleNetworkCmdActivity extends BleBaseActivity implements OnCa | |||
public void onServiceErr() { | |||
mList.add("服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
mHandler.sendEmptyMessage(REFRESH_DATA); | |||
} | |||
@@ -377,13 +377,13 @@ public class PublicBleNetworkCmdActivity extends BleBaseActivity implements OnCa | |||
} | |||
@Override | |||
public void getSelectWifiMac(String mac) { | |||
public void onConnectedWifiMac(String mac) { | |||
mList.add("获取到设置的wifi的mac地址 " + mac); | |||
mHandler.sendEmptyMessage(REFRESH_DATA); | |||
} | |||
@Override | |||
public void getSelectWifiPaw(String pwd) { | |||
public void onConnectedWifiPwd(String pwd) { | |||
mList.add("获取到设置的wifi的密码 " + pwd); | |||
mHandler.sendEmptyMessage(REFRESH_DATA); | |||
} |
@@ -419,8 +419,8 @@ public class TempInstrumentActivity extends BleBaseActivity implements OnCallbac | |||
public void onServiceSuccess() { | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
CallbackDisIm.getInstance().addListListener(this); | |||
if (mBluetoothService != null) { | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mBleDevice = TempInstrumentDeviceData.getInstance(bleDevice); | |||
mBleDevice.setOnBleVersionListener(TempInstrumentActivity.this); | |||
@@ -440,7 +440,7 @@ public class TempInstrumentActivity extends BleBaseActivity implements OnCallbac | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@Override |
@@ -270,8 +270,8 @@ public class AirDetectorActivity extends BleAppBaseActivity implements AirDetect | |||
@Override | |||
public void onServiceSuccess() { | |||
mAddress = getIntent().getStringExtra("mac"); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
if (mAirDetectorWifeBleData == null) { | |||
AirDetectorWifeBleData.init(bleDevice); | |||
mAirDetectorWifeBleData = AirDetectorWifeBleData.getInstance(); | |||
@@ -287,8 +287,8 @@ public class AirDetectorActivity extends BleAppBaseActivity implements AirDetect | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -549,8 +549,8 @@ public class AirDetectorActivity extends BleAppBaseActivity implements AirDetect | |||
if (mAirDetectorWifeBleData != null) { | |||
mAirDetectorWifeBleData = null; | |||
} | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} |
@@ -231,12 +231,12 @@ public class AirDetectorActivityTest extends BleAppBaseActivity implements AirDe | |||
@Override | |||
public void onServiceSuccess() { | |||
mAddress = getIntent().getStringExtra("mac"); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice == null) { | |||
finish(); | |||
return; | |||
} | |||
mBluetoothService.setOnCallbackBle(this); | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
if (mAirDetectorWifeBleData == null) { | |||
// AirDetectorWifeBleData.init(bleDevice); | |||
mAirDetectorWifeBleData = AirDetectorWifeBleData.getInstance(); | |||
@@ -252,8 +252,8 @@ public class AirDetectorActivityTest extends BleAppBaseActivity implements AirDe | |||
@Override | |||
public void unbindServices() { | |||
Log.i(TAG, "unbindServices"); | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -102,15 +102,15 @@ public class BleNutritionActivity extends BleBaseActivity implements View.OnClic | |||
@Override | |||
protected void onDestroy() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
mBleNutritionData = new BleNutritionData(mBleDevice); | |||
mBleNutritionData.setBleNutritionCallback(this); |
@@ -106,9 +106,9 @@ public class BloodGlucoseActivity extends BleBaseActivity implements OnCallbackB | |||
public void onServiceSuccess() { | |||
mLogList.add(0, "绑定服务成功"); | |||
listAdapter.notifyDataSetChanged(); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mBloodGlucoseBleDeviceData = new BloodGlucoseBleDeviceData(bleDevice); | |||
mBloodGlucoseBleDeviceData.setBloodGlucoseCallback(this); | |||
@@ -129,8 +129,8 @@ public class BloodGlucoseActivity extends BleBaseActivity implements OnCallbackB | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -84,9 +84,9 @@ public class BloodGlucoseTestActivity extends BleBaseActivity implements OnCallb | |||
@Override | |||
public void onServiceSuccess() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mBleDevice = new BloodGlucoseBleDeviceData(bleDevice); | |||
mBleDevice.setBloodGlucoseCallback(this); | |||
@@ -106,8 +106,8 @@ public class BloodGlucoseTestActivity extends BleBaseActivity implements OnCallb | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -49,7 +49,7 @@ public class BloodPressureTcActivity extends BleBaseActivity implements Transmis | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
mTransmissionDeviceData = new TransmissionDeviceData(mBleDevice); | |||
mTransmissionDeviceData.setMyBleCallback(this); |
@@ -380,11 +380,11 @@ public class BroadcastHeightActivity extends BleBaseActivity implements OnCallba | |||
} | |||
// 权限都有了,OK | |||
addText("权限都有,开始接收广播数据"); | |||
if (mBluetoothService != null) { | |||
if (mAILinkBleManager != null) { | |||
mBroadCastHeightDeviceData = BroadCastHeightDeviceData.getInstance(); | |||
mBroadCastHeightDeviceData.setOnNotifyHeightData(this); | |||
mBluetoothService.setOnScanFilterListener(this); | |||
mBluetoothService.startScan(0, BleConfig.UUID_SERVER_BROADCAST_AILINK); | |||
mAILinkBleManager.setOnScanFilterListener(this); | |||
mAILinkBleManager.startScan(0, BleConfig.UUID_SERVER_BROADCAST_AILINK); | |||
} | |||
} | |||
@@ -58,9 +58,9 @@ public class BroadNutritionActivity extends BleBaseActivity implements View.OnCl | |||
public void onClick(View v) { | |||
int id = v.getId(); | |||
if (id == R.id.btn_start) { | |||
mBluetoothService.startScan(0, BleConfig.UUID_SERVER_BROADCAST_AILINK); | |||
mAILinkBleManager.startScan(0, BleConfig.UUID_SERVER_BROADCAST_AILINK); | |||
} else if (id == R.id.btn_stop) { | |||
mBluetoothService.stopScan(); | |||
mAILinkBleManager.stopScan(); | |||
} else if (id == R.id.btn_clear) { | |||
clearText(); | |||
} | |||
@@ -68,15 +68,15 @@ public class BroadNutritionActivity extends BleBaseActivity implements View.OnCl | |||
@Override | |||
protected void onDestroy() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.stopScan(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.stopScan(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBluetoothService.setOnScanFilterListener(this); | |||
mAILinkBleManager.setOnScanFilterListener(this); | |||
} | |||
@Override |
@@ -206,15 +206,15 @@ public class CoffeeScaleActivity extends BleBaseActivity implements View.OnClick | |||
@Override | |||
protected void onDestroy() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
mCoffeeScaleData = new CoffeeScaleData(mBleDevice); | |||
mCoffeeScaleData.setCoffeeScaleCallback(this); |
@@ -94,15 +94,15 @@ public class FasciaGunActivity extends BleBaseActivity implements View.OnClickLi | |||
mFasciaGunData.setFasciaGunCallback(null); | |||
mFasciaGunData = null; | |||
} | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
mFasciaGunData = new FasciaGunData(mBleDevice); | |||
mFasciaGunData.setFasciaGunCallback(this); |
@@ -187,15 +187,15 @@ public class FoodTempActivity extends BleBaseActivity implements View.OnClickLis | |||
@Override | |||
protected void onDestroy() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
mFoodTempData = new FoodTempData(mBleDevice); | |||
mFoodTempData.setFoodTempCallback(this); |
@@ -58,9 +58,9 @@ public class LeaOneBroadcastActivity extends BleBaseActivity implements View.OnC | |||
public void onClick(View v) { | |||
int id = v.getId(); | |||
if (id == R.id.btn_start) { | |||
mBluetoothService.startScan(0); | |||
mAILinkBleManager.startScan(0); | |||
} else if (id == R.id.btn_stop) { | |||
mBluetoothService.stopScan(); | |||
mAILinkBleManager.stopScan(); | |||
} else if (id == R.id.btn_clear) { | |||
clearText(); | |||
} | |||
@@ -68,15 +68,15 @@ public class LeaOneBroadcastActivity extends BleBaseActivity implements View.OnC | |||
@Override | |||
protected void onDestroy() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.stopScan(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.stopScan(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBluetoothService.setOnScanFilterListener(this); | |||
mAILinkBleManager.setOnScanFilterListener(this); | |||
} | |||
@Override |
@@ -152,9 +152,9 @@ public class MeatProbeActivity extends BleBaseActivity implements OnCallbackBle, | |||
@Override | |||
public void onServiceSuccess() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mMac); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
MeatProbeBleData.init(bleDevice); | |||
mMeatProbeBleData = MeatProbeBleData.getInstance(); | |||
mMeatProbeBleData.addOnMeatProbeDataListener(this); | |||
@@ -169,8 +169,8 @@ public class MeatProbeActivity extends BleBaseActivity implements OnCallbackBle, | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -178,9 +178,9 @@ public class MeatProbeActivity extends BleBaseActivity implements OnCallbackBle, | |||
public void onServicesDiscovered(String mac) { | |||
//连接成功 | |||
Log.e("ljl", "onServicesDiscovered: mac is " + mac); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mMac); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
MeatProbeBleData.init(bleDevice); | |||
mMeatProbeBleData = MeatProbeBleData.getInstance(); | |||
mMeatProbeBleData.addOnMeatProbeDataListener(this); | |||
@@ -198,13 +198,13 @@ public class MeatProbeActivity extends BleBaseActivity implements OnCallbackBle, | |||
public void onClick(View v) { | |||
switch (v.getId()) { | |||
case R.id.btn_meat_probe_connect: | |||
if (mBluetoothService != null) { | |||
mBluetoothService.connectDevice(mMac); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.connectDevice(mMac); | |||
} | |||
break; | |||
case R.id.btn_meat_probe_disconnect: | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnect(mMac); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnect(mMac); | |||
} | |||
break; | |||
case R.id.btn_meat_probe_version: | |||
@@ -253,8 +253,8 @@ public class MeatProbeActivity extends BleBaseActivity implements OnCallbackBle, | |||
@Override | |||
protected void onDestroy() { | |||
super.onDestroy(); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnect(mMac); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnect(mMac); | |||
} | |||
} | |||
@@ -272,7 +272,7 @@ public class MeatProbeChargerActivity extends BleBaseActivity implements View.On | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
if (mMeatProbeChargerBleDevice == null) { | |||
Log.e("ljl", "onServiceSuccess: 绑定设备,设置监听"); | |||
@@ -325,8 +325,8 @@ public class MeatProbeChargerActivity extends BleBaseActivity implements View.On | |||
if (mMeatProbeChargerBleDevice != null) { | |||
mMeatProbeChargerBleDevice = null; | |||
} | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} |
@@ -82,7 +82,7 @@ public class BleNoiseMeterActivity extends BleBaseActivity implements View.OnCli | |||
@Override | |||
public void onServiceSuccess() { | |||
Log.e("ljl", "onServiceSuccess: 服务打开成功"); | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
if (mNoiseMeterBle == null) { | |||
Log.e("ljl", "NoiseMeterBleDevice绑定设备"); |
@@ -132,15 +132,15 @@ public class WifiBleNoiseMeterActivity extends BleBaseActivity implements View.O | |||
if (mNoiseMeterBle != null) { | |||
mNoiseMeterBle = null; | |||
} | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
if (mNoiseMeterBle == null) { | |||
NoiseMeterWifiBleDevice.init(mBleDevice); |
@@ -34,9 +34,9 @@ public class RopeSkippingActivity extends BleBaseActivity implements View.OnClic | |||
@Override | |||
public void onServiceSuccess() { | |||
logList.add("绑定服务成功"); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
RopeSkippingBleData.init(bleDevice); | |||
RopeSkippingBleData.getInstance().setOnRopeSkipCallBack(this); | |||
@@ -58,8 +58,8 @@ public class RopeSkippingActivity extends BleBaseActivity implements View.OnClic | |||
if (mArrayAdapter != null && logList != null) { | |||
refreshLog("解除绑定服务"); | |||
} | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -242,8 +242,8 @@ public class RopeSkippingActivity extends BleBaseActivity implements View.OnClic | |||
@Override | |||
public void finish() { | |||
super.finish(); | |||
if (mBluetoothService != null){ | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null){ | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
} | |||
} |
@@ -54,8 +54,8 @@ public class RopeSkippingSetActivity extends BleBaseActivity implements View.OnC | |||
case 1: | |||
refreshLog("正在设置下一个..."); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.startScan(0, BleConfig.UUID_BROADCAST_AILINK); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.startScan(0, BleConfig.UUID_BROADCAST_AILINK); | |||
} | |||
break; | |||
@@ -66,8 +66,8 @@ public class RopeSkippingSetActivity extends BleBaseActivity implements View.OnC | |||
@Override | |||
public void onServiceSuccess() { | |||
refreshLog("绑定服务成功"); | |||
if (mBluetoothService != null) { | |||
mBluetoothService.setOnCallbackBle(this); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
} | |||
@@ -85,8 +85,8 @@ public class RopeSkippingSetActivity extends BleBaseActivity implements View.OnC | |||
if (mArrayAdapter != null && logList != null) { | |||
refreshLog("解除绑定服务"); | |||
} | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -126,8 +126,8 @@ public class RopeSkippingSetActivity extends BleBaseActivity implements View.OnC | |||
et_set_mode.setEnabled(false); | |||
et_rssi.setEnabled(false); | |||
mSetMode = true; | |||
if (mBluetoothService != null) { | |||
mBluetoothService.startScan(0, BleConfig.UUID_BROADCAST_AILINK); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.startScan(0, BleConfig.UUID_BROADCAST_AILINK); | |||
} | |||
} else if (v.getId() == R.id.btn_start_read) { | |||
//开始读取 | |||
@@ -140,8 +140,8 @@ public class RopeSkippingSetActivity extends BleBaseActivity implements View.OnC | |||
et_set_mode.setEnabled(true); | |||
et_rssi.setEnabled(true); | |||
refreshLog("停止设置"); | |||
mBluetoothService.stopScan(); | |||
mBluetoothService.disconnectAll(); | |||
mAILinkBleManager.stopScan(); | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
} | |||
@@ -176,8 +176,8 @@ public class RopeSkippingSetActivity extends BleBaseActivity implements View.OnC | |||
@Override | |||
public void onScanning(BleValueBean data) { | |||
if (!mSet.contains(data.getMac()) && data.getCid() == 0x002F && Math.abs(mRssi) > Math.abs(data.getRssi())) { | |||
mBluetoothService.stopScan(); | |||
mBluetoothService.connectDevice(data.getMac()); | |||
mAILinkBleManager.stopScan(); | |||
mAILinkBleManager.connectDevice(data.getMac()); | |||
refreshLog("正在连接:" + data.getMac()); | |||
} | |||
@@ -195,9 +195,9 @@ public class RopeSkippingSetActivity extends BleBaseActivity implements View.OnC | |||
@Override | |||
public void onServicesDiscovered(String mac) { | |||
if (mBluetoothService != null) { | |||
if (mAILinkBleManager != null) { | |||
mSet.add(mac); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mac); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mac); | |||
bleDevice.setOnBleDeviceDataListener(this); | |||
if (mSetMode) { | |||
setMode(bleDevice); | |||
@@ -230,8 +230,8 @@ public class RopeSkippingSetActivity extends BleBaseActivity implements View.OnC | |||
break; | |||
} | |||
if (mBluetoothService!=null){ | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager !=null){ | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
} | |||
} | |||
@@ -240,9 +240,9 @@ public class RopeSkippingSetActivity extends BleBaseActivity implements View.OnC | |||
@Override | |||
public void finish() { | |||
super.finish(); | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.disconnectAll(); | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.disconnectAll(); | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
} |
@@ -155,15 +155,15 @@ public class ShareChargerActivity extends BleBaseActivity implements View.OnClic | |||
@Override | |||
protected void onDestroy() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
mShareChargerData = new ShareChargerData(mBleDevice); | |||
mShareChargerData.setShareChargerCallback(this); |
@@ -217,15 +217,15 @@ public class ShareCondomActivity extends BleBaseActivity implements View.OnClick | |||
mHandler.removeCallbacksAndMessages(null); | |||
mHandler = null; | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
mShareCondomData = new ShareCondomData(mBleDevice); | |||
mShareCondomData.setShareCondomCallback(this); |
@@ -118,7 +118,7 @@ public class ShareSocketActivity extends BleBaseActivity implements View.OnClick | |||
case MSG_TEST_START_SCAN: | |||
// 开始扫描设备 | |||
addText("准备重连,开始扫描设备:" + mMac); | |||
mBluetoothService.startScan(0); | |||
mAILinkBleManager.startScan(0); | |||
break; | |||
} | |||
} | |||
@@ -260,17 +260,17 @@ public class ShareSocketActivity extends BleBaseActivity implements View.OnClick | |||
@Override | |||
protected void onDestroy() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBluetoothService.setOnCallbackBle(this); | |||
mBluetoothService.setOnScanFilterListener(this); | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
mAILinkBleManager.setOnScanFilterListener(this); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
mShareSocketData = new ShareSocketData(mBleDevice); | |||
mShareSocketData.setShareSocketCallback(this); | |||
@@ -280,12 +280,12 @@ public class ShareSocketActivity extends BleBaseActivity implements View.OnClick | |||
@Override | |||
public void onScanning(BleValueBean data) { | |||
// 扫描到了设备 | |||
if (mIsTest && !mBluetoothService.isConnectStatus()) { | |||
if (mIsTest && !mAILinkBleManager.isConnectStatus()) { | |||
// 开始连接设备 | |||
addText("扫描到设备,开始连接"); | |||
mBluetoothService.connectDevice(mMac); | |||
mAILinkBleManager.connectDevice(mMac); | |||
// 停止扫描 | |||
mBluetoothService.stopScan(); | |||
mAILinkBleManager.stopScan(); | |||
} | |||
} | |||
@@ -302,8 +302,8 @@ public class ShareSocketActivity extends BleBaseActivity implements View.OnClick | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService!=null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
if (mAILinkBleManager !=null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
} | |||
} | |||
@@ -405,7 +405,7 @@ public class ShareSocketActivity extends BleBaseActivity implements View.OnClick | |||
@Override | |||
public void onServicesDiscovered(String mac) { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mIsTest && mBleDevice != null) { | |||
mTestConnectSuccessCount++; | |||
addText("连接成功:" + mMac + ",查询剩余充电时间"); |
@@ -91,8 +91,8 @@ public class ToothBrushWifiBleActivity extends BleBaseActivity implements View.O | |||
mList.add(0, "服务与界面建立连接成功"); | |||
// mList.add(0, "搜索设备"); | |||
mMHandler.sendEmptyMessage(ToRefreUi); | |||
mBluetoothService.setOnCallbackBle(this); | |||
mBluetoothService.startScan(30 * 1000); | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
mAILinkBleManager.startScan(30 * 1000); | |||
} | |||
@@ -105,9 +105,9 @@ public class ToothBrushWifiBleActivity extends BleBaseActivity implements View.O | |||
@Override | |||
public void unbindServices() { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.removeOnCallbackBle(this); | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.removeOnCallbackBle(this); | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
} | |||
@@ -120,9 +120,9 @@ public class ToothBrushWifiBleActivity extends BleBaseActivity implements View.O | |||
public void onScanning(BleValueBean data) { | |||
BleLog.i(TAG, "MAC=" + mAddress + "||CID=" + data.getCid() + "||VID=" + data.getVid() + "||PID=" + data.getPid()); | |||
if (data.getMac().equalsIgnoreCase(mAddress)) { | |||
if (mBluetoothService != null) { | |||
mBluetoothService.stopScan(); | |||
mBluetoothService.connectDevice(data.getMac()); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.stopScan(); | |||
mAILinkBleManager.connectDevice(data.getMac()); | |||
} | |||
} | |||
} | |||
@@ -147,8 +147,8 @@ public class ToothBrushWifiBleActivity extends BleBaseActivity implements View.O | |||
public void onServicesDiscovered(String mac) { | |||
mList.add(0, "蓝牙已连接"); | |||
mMHandler.sendEmptyMessage(ToRefreUi); | |||
mBluetoothService.setOnCallbackBle(this); | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
mAILinkBleManager.setOnCallbackBle(this); | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
ToothBrushWiFiBleUtilsData.init(bleDevice, this, this); | |||
mToothBrushWiFiBleUtilsData = ToothBrushWiFiBleUtilsData.getInstance(); |
@@ -147,15 +147,15 @@ public class ToothbrushTestActivity extends BleBaseActivity implements Toothbrus | |||
mHandler.removeCallbacksAndMessages(null); | |||
mHandler = null; | |||
} | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
mToothbrushTestData = new ToothbrushTestData(mBleDevice); | |||
mToothbrushTestData.setBleToothbrushCallback(this); |
@@ -116,7 +116,7 @@ public class WeightScaleActivity extends BleBaseActivity implements WeightScaleD | |||
@Override | |||
public void onServiceSuccess() { | |||
mBleDevice = mBluetoothService.getBleDevice(mMac); | |||
mBleDevice = mAILinkBleManager.getBleDevice(mMac); | |||
if (mBleDevice != null) { | |||
if (mWeightScaleDevice == null) { | |||
WeightScaleDevice.init(mBleDevice); | |||
@@ -331,8 +331,8 @@ public class WeightScaleActivity extends BleBaseActivity implements WeightScaleD | |||
if (mWeightScaleDevice != null) { | |||
mWeightScaleDevice = null; | |||
} | |||
if (mBluetoothService != null) { | |||
mBluetoothService.disconnectAll(); | |||
if (mAILinkBleManager != null) { | |||
mAILinkBleManager.disconnectAll(); | |||
} | |||
super.onDestroy(); | |||
} |
@@ -322,8 +322,8 @@ public class WifiBleSphyActivity extends BleBaseActivity implements OnCallbackDi | |||
CallbackDisIm.getInstance().addListListener(this); | |||
BleLog.i(TAG, "服务与界面建立连接成功"); | |||
//与服务建立连接 | |||
if (mBluetoothService != null) { | |||
BleDevice bleDevice = mBluetoothService.getBleDevice(mAddress); | |||
if (mAILinkBleManager != null) { | |||
BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||
if (bleDevice != null) { | |||
mSphyWifiBleDeviceData = SphyWifiBleDeviceData.getInstance(bleDevice); | |||
mWifiBleDeviceData = mSphyWifiBleDeviceData.getWifiBleDeviceData(); | |||
@@ -341,7 +341,7 @@ public class WifiBleSphyActivity extends BleBaseActivity implements OnCallbackDi | |||
public void onServiceErr() { | |||
BleLog.i(TAG, "服务与界面连接断开"); | |||
//与服务断开连接 | |||
mBluetoothService = null; | |||
mAILinkBleManager = null; | |||
} | |||
@@ -576,6 +576,11 @@ public class WifiBleSphyActivity extends BleBaseActivity implements OnCallbackDi | |||
} | |||
} | |||
@Override | |||
public void onConnectWifiPwd(String pwd) { | |||
} | |||
@Override | |||
public void onWifiScanBean(WifiBleInfoBean wifiBleInfoBean) { | |||
L.i("扫描到的wifi信息:" + wifiBleInfoBean.toString()); |
@@ -35,7 +35,7 @@ | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="12dp" | |||
android:layout_weight="1" | |||
android:text="@string/search_wifi_hotspots" | |||
android:text="@string/distribution_network" | |||
android:textAllCaps="false" /> | |||
<EditText | |||
@@ -46,6 +46,7 @@ | |||
android:layout_marginEnd="10dp" | |||
android:layout_weight="1" | |||
android:hint="@string/select_wifi_serial_number" | |||
android:visibility="gone" | |||
android:inputType="number" | |||
android:textSize="14dp" /> | |||
@@ -72,6 +73,7 @@ | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="13dp" | |||
android:text="@string/initiate_connection" | |||
android:visibility="gone" | |||
android:textAllCaps="false" /> | |||
<Button | |||
@@ -197,7 +199,7 @@ | |||
android:text="8092" /> | |||
<EditText | |||
android:id="@+id/et_url" | |||
android:id="@+id/et_path" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="10dp" | |||
@@ -253,12 +255,12 @@ | |||
android:orientation="horizontal"> | |||
<Button | |||
android:id="@+id/check_url" | |||
android:id="@+id/check_path" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="9dp" | |||
android:layout_marginTop="5dp" | |||
android:text="@string/view_url" | |||
android:text="@string/view_path" | |||
android:textAllCaps="false" /> | |||
</LinearLayout> |
@@ -59,7 +59,7 @@ | |||
<string name="switch_environment">切换环境</string> | |||
<string name="view_ip">查看ip</string> | |||
<string name="view_port">查看端口</string> | |||
<string name="view_url">查看url</string> | |||
<string name="view_path">查看地址</string> | |||
<string name="select_document">选择文件:</string> | |||
<string name="real_time">实时</string> | |||
<string name="stable">稳定</string> | |||
@@ -110,8 +110,12 @@ | |||
<string name="set_environment_url_success">设置环境url成功</string> | |||
<string name="set_environment_url_failure">设置环境url失败</string> | |||
<string name="password_format_err">密码格式不对</string> | |||
<string name="set_environment_ip">设置环境IP:</string> | |||
<string name="set_environment">设置环境:</string> | |||
<string name="view_environment_ip">查看环境ip</string> | |||
<string name="view_environment_port">查看环境端口</string> | |||
<string name="view_environment_url">查看环境url</string> | |||
<string name="view_environment_path">查看环境地址</string> | |||
<string name="distribution_network">配网</string> | |||
<string name="connecting_wifi">正在连接wifi...</string> | |||
<string name="cancel">取消</string> | |||
<string name="select_wifi">选择WIFI</string> | |||
</resources> |
@@ -61,7 +61,7 @@ | |||
<string name="switch_environment">Switch environment</string> | |||
<string name="view_ip">View IP</string> | |||
<string name="view_port">View port</string> | |||
<string name="view_url">View url</string> | |||
<string name="view_path">View Path</string> | |||
<string name="select_document">Select a document:</string> | |||
<string name="real_time">Real-time data</string> | |||
<string name="stable">Stable data</string> | |||
@@ -113,9 +113,13 @@ | |||
<string name="set_environment_url_success">Set environment url successfully</string> | |||
<string name="set_environment_url_failure">Failed to set environment url</string> | |||
<string name="password_format_err">Password format is wrong</string> | |||
<string name="set_environment_ip">Set environment IP:</string> | |||
<string name="set_environment">Set environment IP:</string> | |||
<string name="view_environment_ip">View environment ip</string> | |||
<string name="view_environment_port">View environment port</string> | |||
<string name="view_environment_url">View environment url</string> | |||
<string name="view_environment_path">View environment path</string> | |||
<string name="distribution_network">Distribution network</string> | |||
<string name="connecting_wifi">Connecting to wifi...</string> | |||
<string name="cancel">Cancel</string> | |||
<string name="select_wifi">Select WIFI</string> | |||
</resources> |