| compileSdkVersion 33 | compileSdkVersion 33 | ||||
| defaultConfig { | defaultConfig { | ||||
| applicationId "aicare.net.cn.sdk.ailinksdkdemoandroid" | applicationId "aicare.net.cn.sdk.ailinksdkdemoandroid" | ||||
| minSdkVersion 19 | |||||
| minSdkVersion 21 | |||||
| targetSdkVersion 33 | targetSdkVersion 33 | ||||
| versionName "1.11.11" | |||||
| versionName "1.11.14" | |||||
| versionCode getVersionCodeNumber(versionName) | versionCode getVersionCodeNumber(versionName) | ||||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||||
| } | } | ||||
| implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | ||||
| implementation 'androidx.cardview:cardview:1.0.0' | implementation 'androidx.cardview:cardview:1.0.0' | ||||
| testImplementation 'junit:junit:4.12' | testImplementation 'junit:junit:4.12' | ||||
| implementation 'com.github.elinkthings:AILinkSDKRepositoryAndroid:1.14.5'//蓝牙核心库 | |||||
| // implementation 'com.github.elinkthings:AILinkSDKOtaLibraryAndroid:1.1.4'//OTA库,需要依赖核心库 | |||||
| implementation 'com.github.elinkthings:AILinkSDKParsingLibraryAndroid:1.9.3'//蓝牙解析库 | |||||
| implementation 'com.github.elinkthings:AILinkSDKRepositoryAndroid:1.14.6'//蓝牙核心库 | |||||
| //OTA库,需要依赖核心库 | |||||
| // implementation 'com.github.elinkthings:AILinkSDKOtaLibraryAndroid:1.1.6' | |||||
| implementation 'com.github.elinkthings:AILinkSDKParsingLibraryAndroid:1.9.4'//蓝牙解析库 | |||||
| implementation 'androidx.recyclerview:recyclerview:1.3.2' | implementation 'androidx.recyclerview:recyclerview:1.3.2' | ||||
| implementation 'com.jakewharton:butterknife:10.2.3' | implementation 'com.jakewharton:butterknife:10.2.3' | ||||
| annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3' | annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3' |
| android:theme="@style/AppTheme" | android:theme="@style/AppTheme" | ||||
| android:usesCleartextTraffic="true" | android:usesCleartextTraffic="true" | ||||
| tools:targetApi="q"> | tools:targetApi="q"> | ||||
| <activity android:name=".ClearShakeHandsActivity" /> | |||||
| <activity android:name=".MainActivity" | |||||
| <activity android:name=".home.MainActivity" | |||||
| android:exported="true"> | android:exported="true"> | ||||
| <intent-filter> | <intent-filter> | ||||
| <action android:name="android.intent.action.VIEW" /> | <action android:name="android.intent.action.VIEW" /> | ||||
| <category android:name="android.intent.category.LAUNCHER" /> | <category android:name="android.intent.category.LAUNCHER" /> | ||||
| </intent-filter> | </intent-filter> | ||||
| </activity> | </activity> | ||||
| <activity android:name=".ClearShakeHandsActivity" /> | |||||
| <activity android:name=".ShowBleActivity" /> | <activity android:name=".ShowBleActivity" /> | ||||
| <activity android:name=".BabyCmdActivity" /> | <activity android:name=".BabyCmdActivity" /> | ||||
| <activity android:name=".TempGunCmdActivity" /> | <activity android:name=".TempGunCmdActivity" /> | ||||
| <activity android:name=".ConnectBleTestActivity" /> | <activity android:name=".ConnectBleTestActivity" /> | ||||
| <activity android:name=".ADWeightScaleCmdActivity" /> | <activity android:name=".ADWeightScaleCmdActivity" /> | ||||
| <activity android:name=".ADWeightScaleUserActivity" /> | <activity android:name=".ADWeightScaleUserActivity" /> | ||||
| <activity android:name=".WeightScaleWifiBleActivity" /> | |||||
| <activity android:name=".WeightScaleBleActivity" /> | <activity android:name=".WeightScaleBleActivity" /> | ||||
| <activity android:name=".WifiConfigActivity" /> | <activity android:name=".WifiConfigActivity" /> | ||||
| <activity android:name=".EightBodyfatActivity" /> | <activity android:name=".EightBodyfatActivity" /> |
| package aicare.net.cn.sdk.ailinksdkdemoandroid; | package aicare.net.cn.sdk.ailinksdkdemoandroid; | ||||
| import android.content.Context; | import android.content.Context; | ||||
| import android.content.Intent; | |||||
| import android.net.Uri; | |||||
| import android.os.Bundle; | import android.os.Bundle; | ||||
| import android.os.Handler; | import android.os.Handler; | ||||
| import android.os.Looper; | import android.os.Looper; | ||||
| import android.os.Message; | import android.os.Message; | ||||
| import android.text.TextUtils; | import android.text.TextUtils; | ||||
| import android.view.Menu; | |||||
| import android.view.MenuItem; | |||||
| import android.view.View; | import android.view.View; | ||||
| import android.view.WindowManager; | import android.view.WindowManager; | ||||
| import android.widget.ArrayAdapter; | import android.widget.ArrayAdapter; | ||||
| import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
| import androidx.annotation.Nullable; | import androidx.annotation.Nullable; | ||||
| import com.pingwang.bluetoothlib.bean.BleValueBean; | |||||
| import com.pingwang.bluetoothlib.bean.SupportUnitBean; | import com.pingwang.bluetoothlib.bean.SupportUnitBean; | ||||
| import com.pingwang.bluetoothlib.config.BleConfig; | |||||
| import com.pingwang.bluetoothlib.config.CmdConfig; | import com.pingwang.bluetoothlib.config.CmdConfig; | ||||
| import com.pingwang.bluetoothlib.device.BleDevice; | import com.pingwang.bluetoothlib.device.BleDevice; | ||||
| import com.pingwang.bluetoothlib.device.BleSendCmdUtil; | import com.pingwang.bluetoothlib.device.BleSendCmdUtil; | ||||
| import com.pingwang.bluetoothlib.utils.BleLog; | import com.pingwang.bluetoothlib.utils.BleLog; | ||||
| import com.pingwang.bluetoothlib.utils.BleStrUtils; | import com.pingwang.bluetoothlib.utils.BleStrUtils; | ||||
| import java.io.File; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Locale; | import java.util.Locale; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.AppPhoneInfoUtils; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.FileProvider7; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.L; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.TimeUtils; | import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.TimeUtils; | ||||
| private BleSendCmdUtil mBleSendCmdUtil; | private BleSendCmdUtil mBleSendCmdUtil; | ||||
| private BleDataUtils bleDataUtils; | private BleDataUtils bleDataUtils; | ||||
| private BleDevice mBleDevice; | private BleDevice mBleDevice; | ||||
| private int type; | |||||
| private int mCid; | |||||
| private int mVid; | |||||
| private int mPid; | |||||
| private String mDeviceVersion; | |||||
| /** | /** | ||||
| * 是否暂停显示数据 | * 是否暂停显示数据 | ||||
| */ | */ | ||||
| private void addShowData(String data) { | private void addShowData(String data) { | ||||
| mId++; | mId++; | ||||
| mList.add("ID:" +mId+" " + TimeUtils.getTimeSSS() + data); | |||||
| mList.add("ID:" + mId + " " + TimeUtils.getTimeSSS() + data); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | mHandler.sendEmptyMessage(REFRESH_DATA); | ||||
| } | } | ||||
| getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); | ||||
| mContext = this; | mContext = this; | ||||
| mAddress = getIntent().getStringExtra("mac"); | mAddress = getIntent().getStringExtra("mac"); | ||||
| type = getIntent().getIntExtra("type", -1); | |||||
| mCid = getIntent().getIntExtra("cid", -1); | |||||
| mVid = getIntent().getIntExtra("vid", -1); | |||||
| mPid = getIntent().getIntExtra("pid", -1); | |||||
| mBleSendCmdUtil = BleSendCmdUtil.getInstance(); | mBleSendCmdUtil = BleSendCmdUtil.getInstance(); | ||||
| init(); | init(); | ||||
| BleConfig.setHandshakeStatus((int[]) null, mAddress, true); | |||||
| } | } | ||||
| private void init() { | private void init() { | ||||
| addShowData("断开连接"); | addShowData("断开连接"); | ||||
| break; | break; | ||||
| case R.id.btnConnect: | case R.id.btnConnect: | ||||
| mAILinkBleManager.connectDevice(mAddress); | |||||
| mAILinkBleManager.connectDevice(new BleValueBean(mAddress, mCid, mVid, mPid)); | |||||
| addShowData("连接设备"); | addShowData("连接设备"); | ||||
| break; | break; | ||||
| case R.id.btnClear: | case R.id.btnClear: | ||||
| case R.id.btnVersion: | case R.id.btnVersion: | ||||
| if (mBleDevice != null) { | if (mBleDevice != null) { | ||||
| String version = mBleDevice.getVersion(); | |||||
| if (TextUtils.isEmpty(version)) { | |||||
| sendBleBean = new SendBleBean(); | |||||
| sendBleBean.setHex(mBleSendCmdUtil.getBleVersion()); | |||||
| sendData(sendBleBean); | |||||
| addShowData("正在获取版本号."); | |||||
| return; | |||||
| } | |||||
| addShowData("版本号:" + version); | |||||
| sendBleBean = new SendBleBean(); | |||||
| sendBleBean.setHex(mBleSendCmdUtil.getBleVersion()); | |||||
| sendData(sendBleBean); | |||||
| addShowData("正在获取版本号."); | |||||
| } | } | ||||
| break; | break; | ||||
| case R.id.btnBattery: | case R.id.btnBattery: | ||||
| for (int i = 0; i < 10; i++) { | |||||
| sendBleBean = new SendBleBean(); | |||||
| sendBleBean.setHex(mBleSendCmdUtil.getMcuBatteryStatus()); | |||||
| sendData(sendBleBean); | |||||
| } | |||||
| sendBleBean = new SendBleBean(); | |||||
| sendBleBean.setHex(mBleSendCmdUtil.getMcuBatteryStatus()); | |||||
| sendData(sendBleBean); | |||||
| addShowData("读取电量"); | addShowData("读取电量"); | ||||
| break; | break; | ||||
| case R.id.btnTimeRead: | case R.id.btnTimeRead: | ||||
| sendBleBean = new SendBleBean(); | sendBleBean = new SendBleBean(); | ||||
| public void unbindServices() { | public void unbindServices() { | ||||
| CallbackDisIm.getInstance().removeListener(this); | CallbackDisIm.getInstance().removeListener(this); | ||||
| mAILinkBleManager.disconnectAll(); | mAILinkBleManager.disconnectAll(); | ||||
| if (mAILinkBleManager !=null) { | |||||
| if (mAILinkBleManager != null) { | |||||
| mAILinkBleManager.removeOnCallbackBle(this); | mAILinkBleManager.removeOnCallbackBle(this); | ||||
| } | } | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void onConnecting(@NonNull String mac) { | public void onConnecting(@NonNull String mac) { | ||||
| //TODO 连接中 | //TODO 连接中 | ||||
| BleLog.i(TAG, "连接中"); | |||||
| L.iw(TAG, "连接中"); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void onDisConnected(@NonNull String mac, int code) { | public void onDisConnected(@NonNull String mac, int code) { | ||||
| //TODO 连接断开 | //TODO 连接断开 | ||||
| BleLog.i(TAG, "连接断开"); | |||||
| L.iw(TAG, "连接断开"); | |||||
| if (mAddress.equals(mac)) { | if (mAddress.equals(mac)) { | ||||
| Toast.makeText(mContext, "连接断开:" + code, Toast.LENGTH_SHORT).show(); | Toast.makeText(mContext, "连接断开:" + code, Toast.LENGTH_SHORT).show(); | ||||
| mBleDevice = null; | mBleDevice = null; | ||||
| @Override | @Override | ||||
| public void onServicesDiscovered(@NonNull String mac) { | public void onServicesDiscovered(@NonNull String mac) { | ||||
| //TODO 连接成功(获取服务成功) | //TODO 连接成功(获取服务成功) | ||||
| BleLog.i(TAG, "连接成功(获取服务成功)"); | |||||
| L.iw(TAG, "连接成功(获取服务成功):" + mac); | |||||
| connectSuccess(); | connectSuccess(); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void bleClose() { | public void bleClose() { | ||||
| BleLog.i(TAG, "蓝牙未开启,可请求开启"); | |||||
| L.iw(TAG, "蓝牙未开启,可请求开启"); | |||||
| addShowData("蓝牙未开启"); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void onNotifyOtherData(byte[] data) { | |||||
| public void onNotifyOtherData(String uuid, byte[] data) { | |||||
| L.iw(TAG, "透传数据(完整):" + BleStrUtils.byte2HexStr(data)); | |||||
| if (mPauseShowCmd) { | if (mPauseShowCmd) { | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void onNotifyDataA6(byte[] hex) { | |||||
| public void onNotifyDataA6(String uuid, byte[] hex) { | |||||
| L.iw(TAG, "收到A6(payload):" + BleStrUtils.byte2HexStr(hex)); | |||||
| if (hex != null && hex.length > 0) { | if (hex != null && hex.length > 0) { | ||||
| switch (hex[0]) { | switch (hex[0]) { | ||||
| case CmdConfig.SET_DEVICE_INFO: { | case CmdConfig.SET_DEVICE_INFO: { | ||||
| @Override | @Override | ||||
| public void onNotifyData(String uuid, byte[] hex, int type) { | public void onNotifyData(String uuid, byte[] hex, int type) { | ||||
| L.iw(TAG, "收到A7:\nCID:" + type + "\npayload:" + BleStrUtils.byte2HexStr(hex)); | |||||
| if (mPauseShowCmd) { | if (mPauseShowCmd) { | ||||
| return; | return; | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void onHandshake(boolean status) { | public void onHandshake(boolean status) { | ||||
| L.iw(TAG, "握手:" + status); | |||||
| addShowData("握手:" + status); | addShowData("握手:" + status); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void onBmVersion(String version) { | public void onBmVersion(String version) { | ||||
| mDeviceVersion = version; | |||||
| addShowData("版本号:" + version); | addShowData("版本号:" + version); | ||||
| } | } | ||||
| super.onDestroy(); | super.onDestroy(); | ||||
| BleLog.i(TAG, "onDestroy"); | BleLog.i(TAG, "onDestroy"); | ||||
| } | } | ||||
| @Override | |||||
| public boolean onCreateOptionsMenu(Menu menu) { | |||||
| getMenuInflater().inflate(R.menu.toolbar_menu_share, menu); | |||||
| return super.onCreateOptionsMenu(menu); | |||||
| } | |||||
| @Override | |||||
| public boolean onOptionsItemSelected(@NonNull MenuItem item) { | |||||
| if (item.getItemId() == R.id.toolbar_right_menu) { | |||||
| shareData(); | |||||
| return true; | |||||
| } | |||||
| return super.onOptionsItemSelected(item); | |||||
| } | |||||
| private void shareData() { | |||||
| int systemBattery = AppPhoneInfoUtils.getSystemBattery(mContext); | |||||
| String appData = "包名:" + BuildConfig.APPLICATION_ID + | |||||
| "\nApp版本:" + AppPhoneInfoUtils.getVersionName(mContext) + | |||||
| "\n设备版本:" + mDeviceVersion + | |||||
| "\n设备:CID=0x" + Integer.toHexString(mCid) + " VID=0x" + Integer.toHexString(mVid) + " PID=0x" + Integer.toHexString(mPid) + | |||||
| "\n手机型号:" + AppPhoneInfoUtils.getPhoneInfo() + " " + AppPhoneInfoUtils.getBrand() + | |||||
| "\n手机系统:" + AppPhoneInfoUtils.getSystemVersionString()+ | |||||
| "\n手机电量:" + systemBattery; | |||||
| L.iw(appData); | |||||
| String logPath = L.getDefaultLogPath(mContext); | |||||
| String logName = L.getDefaultLogName(); | |||||
| File file = new File(logPath, logName); | |||||
| Uri uriForFile = FileProvider7.getUriForFile(mContext, file); | |||||
| Intent sendIntent = new Intent(); | |||||
| sendIntent.setAction(Intent.ACTION_SEND); | |||||
| sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||||
| sendIntent.putExtra(Intent.EXTRA_STREAM, uriForFile); | |||||
| sendIntent.setType("*/*"); | |||||
| startActivity(sendIntent); | |||||
| } | |||||
| } | } |
| package aicare.net.cn.sdk.ailinksdkdemoandroid; | |||||
| import android.os.Bundle; | |||||
| import android.view.View; | |||||
| import android.widget.ArrayAdapter; | |||||
| import android.widget.Button; | |||||
| import android.widget.CompoundButton; | |||||
| import android.widget.ListView; | |||||
| import android.widget.RadioButton; | |||||
| import androidx.annotation.Nullable; | |||||
| import com.pingwang.bluetoothlib.bean.SupportUnitBean; | |||||
| import com.pingwang.bluetoothlib.device.BleDevice; | |||||
| import com.pingwang.bluetoothlib.listener.OnCallbackBle; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import cn.net.aicare.modulelibrary.module.BloodGlucose.BloodGlucoseBleDeviceData; | |||||
| import cn.net.aicare.modulelibrary.module.BloodGlucose.BloodGlucoseUtil; | |||||
| public class BloodGlucoseActivity extends aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity implements OnCallbackBle ,BloodGlucoseBleDeviceData.BloodGlucoseCallback{ | |||||
| private Button support_unit, quest_status,showdata; | |||||
| private RadioButton mmol, mg; | |||||
| private ListView log_list; | |||||
| private List<String> mLogList; | |||||
| private ArrayAdapter listAdapter; | |||||
| private String mAddress; | |||||
| private boolean isShowData=false; | |||||
| private BloodGlucoseBleDeviceData mBloodGlucoseBleDeviceData; | |||||
| @Override | |||||
| protected void onCreate(@Nullable Bundle savedInstanceState) { | |||||
| super.onCreate(savedInstanceState); | |||||
| setContentView(R.layout.activity_blood_glucose); | |||||
| mAddress = getIntent().getStringExtra("mac"); | |||||
| support_unit = findViewById(R.id.support_unit); | |||||
| quest_status = findViewById(R.id.quest_status); | |||||
| showdata=findViewById(R.id.showdata); | |||||
| mmol = findViewById(R.id.mmol); | |||||
| mg = findViewById(R.id.mg); | |||||
| log_list = findViewById(R.id.log_list); | |||||
| mLogList = new ArrayList<>(); | |||||
| listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mLogList); | |||||
| log_list.setAdapter(listAdapter); | |||||
| mmol.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | |||||
| @Override | |||||
| public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { | |||||
| if (isChecked) | |||||
| if (mBloodGlucoseBleDeviceData != null) | |||||
| mBloodGlucoseBleDeviceData.setUnit(BloodGlucoseUtil.UNIT_MMOL_L); | |||||
| } | |||||
| }); | |||||
| mg.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | |||||
| @Override | |||||
| public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { | |||||
| if (isChecked) | |||||
| if (mBloodGlucoseBleDeviceData != null) | |||||
| mBloodGlucoseBleDeviceData.setUnit(BloodGlucoseUtil.UNIT_MG_DL); | |||||
| } | |||||
| }); | |||||
| showdata.setOnClickListener(new View.OnClickListener() { | |||||
| @Override | |||||
| public void onClick(View v) { | |||||
| if (!isShowData){ | |||||
| showdata.setText("隐藏Data数据"); | |||||
| isShowData=true; | |||||
| }else { | |||||
| showdata.setText("显示Data数据"); | |||||
| isShowData=false; | |||||
| } | |||||
| } | |||||
| }); | |||||
| quest_status.setOnClickListener(new View.OnClickListener() { | |||||
| @Override | |||||
| public void onClick(View v) { | |||||
| if (mBloodGlucoseBleDeviceData != null) | |||||
| mBloodGlucoseBleDeviceData.queryStatus(); | |||||
| } | |||||
| }); | |||||
| } | |||||
| @Override | |||||
| public void onServiceSuccess() { | |||||
| mLogList.add(0, "绑定服务成功"); | |||||
| listAdapter.notifyDataSetChanged(); | |||||
| if (mAILinkBleManager != null) { | |||||
| mAILinkBleManager.setOnCallbackBle(this); | |||||
| BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||||
| if (bleDevice != null) { | |||||
| mBloodGlucoseBleDeviceData = new BloodGlucoseBleDeviceData(bleDevice); | |||||
| mBloodGlucoseBleDeviceData.setBloodGlucoseCallback(this); | |||||
| } | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onServiceErr() { | |||||
| } | |||||
| @Override | |||||
| public void unbindServices() { | |||||
| } | |||||
| @Override | |||||
| public void onVersion(String version) { | |||||
| mLogList.add(0, "版本号:"+version); | |||||
| listAdapter.notifyDataSetChanged(); | |||||
| } | |||||
| @Override | |||||
| public void onSupportUnit(List<SupportUnitBean> list) { | |||||
| mLogList.add(0, "支持单位:"); | |||||
| for (SupportUnitBean supportUnitBean:list) { | |||||
| mLogList.add(0, supportUnitBean.toString()); | |||||
| } | |||||
| listAdapter.notifyDataSetChanged(); | |||||
| } | |||||
| @Override | |||||
| public void onDeviceStatus(int status) { | |||||
| switch (status){ | |||||
| case BloodGlucoseUtil.STATUS_STATELESS: | |||||
| mLogList.add(0,status+" 无状态"); | |||||
| break; | |||||
| case BloodGlucoseUtil.STATUS_WAIT_TEST_PAPER: | |||||
| mLogList.add(0,status+" 设备等待插入试纸"); | |||||
| break; | |||||
| case BloodGlucoseUtil.STATUS_WAIT_BLOOD_SAMPLES: | |||||
| mLogList.add(0,status+" 设备已插入试纸,等待获取血样"); | |||||
| break; | |||||
| case BloodGlucoseUtil.STATUS_ANALYSIS_BLOOD_SAMPLES: | |||||
| mLogList.add(0,status+" 血样已获取,分析血样中"); | |||||
| break; | |||||
| case BloodGlucoseUtil.STATUS_TEST_FINISH: | |||||
| mLogList.add(0,status+" 上发数据完成,测量完成"); | |||||
| break; | |||||
| } | |||||
| listAdapter.notifyDataSetChanged(); | |||||
| } | |||||
| @Override | |||||
| public void onResult(int originalValue, float value, int unit, int decimal) { | |||||
| mLogList.add(0,"原始数据:"+originalValue+" 值:"+value+" 单位:"+unit+" 小数点位:"+decimal); | |||||
| listAdapter.notifyDataSetChanged(); | |||||
| } | |||||
| @Override | |||||
| public void onErrorCode(int code) { | |||||
| switch (code){ | |||||
| case BloodGlucoseUtil.ERROR_CODE_NO_ELECTRICITY: | |||||
| mLogList.add(0,code+" 电池没电"); | |||||
| break; | |||||
| case BloodGlucoseUtil.ERROR_CODE_USED_TEST_PAPER: | |||||
| mLogList.add(0,code+" 已使用过的试纸"); | |||||
| break; | |||||
| case BloodGlucoseUtil.ERROR_CODE_TEMPERATURE_OUT_OF_RANGE: | |||||
| mLogList.add(0,code+" 环境温度超出使用范围"); | |||||
| break; | |||||
| case BloodGlucoseUtil.ERROR_CODE_WITHDRAWN_TEST_PAPER: | |||||
| mLogList.add(0,code+" 试纸施加血样后测试未完成,被退出试纸"); | |||||
| break; | |||||
| case BloodGlucoseUtil.ERROR_CODE_SELF_CHECK_FAIL: | |||||
| mLogList.add(0,code+" 机器自检未通过"); | |||||
| break; | |||||
| case BloodGlucoseUtil.ERROR_CODE_RESULT_LOWER: | |||||
| mLogList.add(0,code+" 测量结果过低,超出测量范围"); | |||||
| break; | |||||
| case BloodGlucoseUtil.ERROR_CODE_RESULT_OVERTOP: | |||||
| mLogList.add(0,code+" 测量结果过高,超出测量范围"); | |||||
| break; | |||||
| default: | |||||
| mLogList.add(0,"错误码:"+code); | |||||
| break; | |||||
| } | |||||
| listAdapter.notifyDataSetChanged(); | |||||
| } | |||||
| @Override | |||||
| public void onSetUnitResult(int result) { | |||||
| switch (result){ | |||||
| case BloodGlucoseUtil.SUCCESS: | |||||
| mLogList.add(0,result+" 成功"); | |||||
| break; | |||||
| case BloodGlucoseUtil.FAILED: | |||||
| mLogList.add(0,result+" 失败"); | |||||
| break; | |||||
| case BloodGlucoseUtil.NONSUPPORT: | |||||
| mLogList.add(0,result+" 不支持"); | |||||
| break; | |||||
| } | |||||
| listAdapter.notifyDataSetChanged(); | |||||
| } | |||||
| @Override | |||||
| public void onData(String data) { | |||||
| if (isShowData) | |||||
| mLogList.add(0,data); | |||||
| } | |||||
| } |
| import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.EightBodyFatAlgorithms; | import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.EightBodyFatAlgorithms; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.EightBodyFatBean; | import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.EightBodyFatBean; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.L; | |||||
| import cn.net.aicare.modulelibrary.module.EightBodyfatscale.EightBodyFatBleDeviceData; | import cn.net.aicare.modulelibrary.module.EightBodyfatscale.EightBodyFatBleDeviceData; | ||||
| import cn.net.aicare.modulelibrary.module.EightBodyfatscale.EightBodyFatUtil; | import cn.net.aicare.modulelibrary.module.EightBodyfatscale.EightBodyFatUtil; | ||||
| loglist = new ArrayList<>(); | loglist = new ArrayList<>(); | ||||
| listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, loglist); | listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, loglist); | ||||
| log_list.setAdapter(listAdapter); | log_list.setAdapter(listAdapter); | ||||
| weight = 60; | |||||
| if (mEightBodyfatAdc == null) { | |||||
| mEightBodyfatAdc = new EightBodyfatAdc(); | |||||
| } | |||||
| mEightBodyfatAdc.setAdcFoot(5784349); | |||||
| mEightBodyfatAdc.setAdcHand(5121114); | |||||
| mEightBodyfatAdc.setAdcLeftHand(12854746); | |||||
| mEightBodyfatAdc.setAdcRightHand(15738341); | |||||
| mEightBodyfatAdc.setAdcLeftFoot(1074604); | |||||
| mEightBodyfatAdc.setAdcRightFoot(13046299); | |||||
| mEightBodyfatAdc.setAdcLeftBody(7480094); | |||||
| mEightBodyfatAdc.setAdcRightBody(7480094); | |||||
| kaimengJieMi(mEightBodyfatAdc); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void unbindServices() { | public void unbindServices() { | ||||
| if (mAILinkBleManager !=null) { | |||||
| if (mAILinkBleManager != null) { | |||||
| mAILinkBleManager.removeOnCallbackBle(this); | mAILinkBleManager.removeOnCallbackBle(this); | ||||
| } | } | ||||
| } | } | ||||
| case EightBodyFatUtil.MEASUREMENT_END: | case EightBodyFatUtil.MEASUREMENT_END: | ||||
| loglist.add(0, "测量完成"); | loglist.add(0, "测量完成"); | ||||
| //测量完成 | //测量完成 | ||||
| if (mEightBodyfatAdc!=null)kaimengJieMi(mEightBodyfatAdc); | |||||
| if (mEightBodyfatAdc != null) { | |||||
| kaimengJieMi(mEightBodyfatAdc); | |||||
| } | |||||
| break; | break; | ||||
| case EightBodyFatUtil.MUC_CALL_BACK_RESULT: | case EightBodyFatUtil.MUC_CALL_BACK_RESULT: | ||||
| } else if (state == EightBodyFatUtil.WEIGHT_STABILIZATION_WEIGHT) { | } else if (state == EightBodyFatUtil.WEIGHT_STABILIZATION_WEIGHT) { | ||||
| stateStr = "稳定体重"; | stateStr = "稳定体重"; | ||||
| } | } | ||||
| this.weight=weight; | |||||
| this.weight = weight; | |||||
| if (unit == EightBodyFatUtil.ST) { | if (unit == EightBodyFatUtil.ST) { | ||||
| loglist.add(0, "测量状态:" + state + stateStr + " 体重:" + EightBodyFatUtil.lbtostlb(weight) + " 体重单位:" + unit + " 小数点位" + decimal); | loglist.add(0, "测量状态:" + state + stateStr + " 体重:" + EightBodyFatUtil.lbtostlb(weight) + " 体重单位:" + unit + " 小数点位" + decimal); | ||||
| } else { | } else { | ||||
| @Override | @Override | ||||
| public void onImpedance(int adc, int part, int arithmetic) { | public void onImpedance(int adc, int part, int arithmetic) { | ||||
| loglist.add(0, "阻抗:" + adc + " 部位: " + part + " 算法" + arithmetic); | loglist.add(0, "阻抗:" + adc + " 部位: " + part + " 算法" + arithmetic); | ||||
| kaimeng(part,adc,arithmetic); | |||||
| kaimeng(part, adc, arithmetic); | |||||
| } | } | ||||
| @Override | @Override | ||||
| private EightBodyfatAdc mEightBodyfatAdc; | private EightBodyfatAdc mEightBodyfatAdc; | ||||
| private void kaimeng(int part, int adc,int algorithms) { | |||||
| private void kaimeng(int part, int adc, int algorithms) { | |||||
| if (mEightBodyfatAdc == null) { | if (mEightBodyfatAdc == null) { | ||||
| mEightBodyfatAdc = new EightBodyfatAdc(); | mEightBodyfatAdc = new EightBodyfatAdc(); | ||||
| } | } | ||||
| } | } | ||||
| private void kaimengJieMi(EightBodyfatAdc mEightBodyfatAdc) { | private void kaimengJieMi(EightBodyfatAdc mEightBodyfatAdc) { | ||||
| loglist.add(0,mEightBodyfatAdc.toString()); | |||||
| loglist.add(0, "默认传入用户: 性别:男,身高:180,年龄27,"+"weight "+weight+"kg"); | |||||
| EightBodyFatBean algorithmsData = | |||||
| EightBodyFatAlgorithms.getInstance().getAlgorithmsData(mEightBodyfatAdc.getAlgorithms(), 1, 180, weight, 27, mEightBodyfatAdc); | |||||
| loglist.add(0, mEightBodyfatAdc.toString()); | |||||
| loglist.add(0, "默认传入用户: 性别:男,身高:180,年龄27," + "weight " + weight + "kg"); | |||||
| EightBodyFatBean algorithmsData = EightBodyFatAlgorithms.getInstance() | |||||
| .getAlgorithmsData(mEightBodyfatAdc.getAlgorithms(), 1, 180, weight, 27, mEightBodyfatAdc); | |||||
| // EightBodyFatBean algorithmsData = | // EightBodyFatBean algorithmsData = | ||||
| // EightBodyFatAlgorithms.getInstance().getAlgorithmsData(2, 0, 165, weight, 27, mEightBodyfatAdc); | // EightBodyFatAlgorithms.getInstance().getAlgorithmsData(2, 0, 165, weight, 27, mEightBodyfatAdc); | ||||
| loglist.add(0, algorithmsData.toString()); | loglist.add(0, algorithmsData.toString()); | ||||
| L.i("算法结果" + algorithmsData.toString()); | |||||
| } | } | ||||
| } | } |
| import com.pingwang.bluetoothlib.utils.BleDensityUtil; | import com.pingwang.bluetoothlib.utils.BleDensityUtil; | ||||
| import com.pingwang.bluetoothlib.utils.BleLog; | import com.pingwang.bluetoothlib.utils.BleLog; | ||||
| import com.pingwang.bluetoothlib.utils.BleStrUtils; | import com.pingwang.bluetoothlib.utils.BleStrUtils; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.TimeUtils; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.TimeUtils; | |||||
| import cn.net.aicare.modulelibrary.module.height.HeightDeviceData; | import cn.net.aicare.modulelibrary.module.height.HeightDeviceData; | ||||
| package aicare.net.cn.sdk.ailinksdkdemoandroid; | |||||
| import android.Manifest; | |||||
| import android.content.Context; | |||||
| import android.content.Intent; | |||||
| import android.content.pm.PackageManager; | |||||
| import android.os.Build; | |||||
| import android.os.Bundle; | |||||
| import android.os.Handler; | |||||
| import android.os.Looper; | |||||
| import android.view.View; | |||||
| import android.widget.TextView; | |||||
| import androidx.annotation.NonNull; | |||||
| import androidx.annotation.Nullable; | |||||
| import androidx.appcompat.app.ActionBar; | |||||
| import androidx.appcompat.app.AppCompatActivity; | |||||
| import androidx.core.app.ActivityCompat; | |||||
| import androidx.core.content.ContextCompat; | |||||
| import com.besthealth.bhBodyComposition120.BhBodyComposition; | |||||
| import com.pingwang.bluetoothlib.AILinkBleManager; | |||||
| import com.pingwang.bluetoothlib.AILinkSDK; | |||||
| import com.pingwang.bluetoothlib.bean.AilinkLicenseBean; | |||||
| import com.pingwang.bluetoothlib.utils.BleLog; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.config.AppConfig; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.config.BleDeviceConfig; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.HintDataDialogFragment; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.find.FindDeviceNewActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.body_scale_4g.BodyScale4GActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.broadcast_height.BroadcastHeightActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.broadcast_nutrition.BroadNutritionActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.broadcast_weight_sacle.BroadcastWeightScaleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.leaone_broadcast.LeaOneBroadcastActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.ropeskipping.RopeSkippingSetActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.AppStart; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.L; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.SP; | |||||
| public class MainActivity extends AppCompatActivity { | |||||
| private static String TAG = MainActivity.class.getName(); | |||||
| private List<View> mList = new ArrayList<>(); | |||||
| private Context mContext; | |||||
| private Handler mHandler = new Handler(Looper.getMainLooper()); | |||||
| @Override | |||||
| protected void onCreate(@Nullable Bundle savedInstanceState) { | |||||
| super.onCreate(savedInstanceState); | |||||
| setContentView(R.layout.activity_main); | |||||
| mContext = this; | |||||
| initView(); | |||||
| initData(); | |||||
| initListener(); | |||||
| int bodyComposition = new BhBodyComposition().getBodyComposition(); | |||||
| L.i("bodyComposition:" + bodyComposition); | |||||
| // Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:10086")); | |||||
| // Method setDefaultSim = null; | |||||
| // try { | |||||
| // setDefaultSim = TelephonyManager.class.getDeclaredMethod("setDefaultSim", Context.class, int.class, int.class); | |||||
| // setDefaultSim.invoke(null, this, 0, 0); | |||||
| // } catch (NoSuchMethodException e) { | |||||
| // e.printStackTrace(); | |||||
| // } catch (IllegalAccessException e) { | |||||
| // e.printStackTrace(); | |||||
| // } catch (InvocationTargetException e) { | |||||
| // e.printStackTrace(); | |||||
| // } | |||||
| // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||||
| // startActivity(intent); | |||||
| } | |||||
| protected void initListener() { | |||||
| String version = getString(R.string.version) + ":" + BuildConfig.VERSION_NAME; | |||||
| ((TextView) findViewById(R.id.tv_app_version)).setText(version); | |||||
| ActionBar supportActionBar = getSupportActionBar(); | |||||
| if (supportActionBar != null) | |||||
| supportActionBar.setTitle(getString(R.string.app_name) + BuildConfig.VERSION_NAME); | |||||
| findViewById(R.id.btn_about).setOnClickListener(new View.OnClickListener() { | |||||
| @Override | |||||
| public void onClick(View v) { | |||||
| startActivity(new Intent(mContext, AboutActivity.class)); | |||||
| } | |||||
| }); | |||||
| MyListener listener = new MyListener(); | |||||
| // Button btn_shpy = findViewById(R.id.btn_sphy); | |||||
| // Button btn_tempgun = findViewById(R.id.btn_tempgun); | |||||
| // Button btn_temp = findViewById(R.id.btn_temp); | |||||
| // Button btn_baby = findViewById(R.id.btn_baby); | |||||
| // Button btn_height = findViewById(R.id.btn_height); | |||||
| // Button btn_ble = findViewById(R.id.btn_ble); | |||||
| // Button btn_weightScale = findViewById(R.id.btn_lock); | |||||
| // Button btn_ble_test = findViewById(R.id.btn_ble_test); | |||||
| // Button btnConnectTest = findViewById(R.id.btnConnectTest); | |||||
| // Button btn_ad_weight = findViewById(R.id.btn_ad_weight); | |||||
| // Button btn_ble_weight = findViewById(R.id.btn_ble_weight); | |||||
| // Button btn_wifi_ble_tooth = findViewById(R.id.btn_wifi_ble_tooth); | |||||
| // Button wifi_config = findViewById(R.id.wifi_config); | |||||
| // Button eight_scale = findViewById(R.id.eight_scale); | |||||
| // Button btn_ota = findViewById(R.id.btn_ota); | |||||
| // Button btn_wristband = findViewById(R.id.btn_wristband); | |||||
| // Button glucometer = findViewById(R.id.glucometer); | |||||
| // Button btn_broadcast_scale = findViewById(R.id.btn_broadcast_scale); | |||||
| // Button btn_broadcast_blood_oxygen = findViewById(R.id.btn_broadcast_blood_oxygen); | |||||
| // Button btn_smart_mask = findViewById(R.id.btn_smart_mask); | |||||
| // Button btn_bld = findViewById(R.id.btn_bld); | |||||
| // Button btn_bleBo = findViewById(R.id.btn_bleBo); | |||||
| // Button btn_coffeeScale = findViewById(R.id.btn_coffeeScale); | |||||
| // Button btn_scooter = findViewById(R.id.btn_scooter); | |||||
| // Button btn_shareCharger = findViewById(R.id.btn_shareCharger); | |||||
| // Button btn_transmission = findViewById(R.id.btn_transmission); | |||||
| // Button btn_wifi_ble_weight = findViewById(R.id.btn_wifi_ble_weight); | |||||
| // Button btn_baby_body_fat = findViewById(R.id.btn_baby_body_fat); | |||||
| mList.add(findViewById(R.id.btn_sphy)); | |||||
| mList.add(findViewById(R.id.btn_sphy_wifi_ble)); | |||||
| mList.add(findViewById(R.id.btn_tempgun)); | |||||
| mList.add(findViewById(R.id.btn_temp)); | |||||
| mList.add(findViewById(R.id.btn_baby)); | |||||
| mList.add(findViewById(R.id.btn_height)); | |||||
| mList.add(findViewById(R.id.btn_ble)); | |||||
| // mList.add(findViewById(R.id.btn_lock)); | |||||
| mList.add(findViewById(R.id.btn_ble_test)); | |||||
| mList.add(findViewById(R.id.btnConnectTest)); | |||||
| mList.add(findViewById(R.id.btn_ad_weight)); | |||||
| mList.add(findViewById(R.id.btn_ble_weight)); | |||||
| mList.add(findViewById(R.id.btn_wifi_ble_tooth)); | |||||
| mList.add(findViewById(R.id.wifi_config)); | |||||
| mList.add(findViewById(R.id.eight_scale)); | |||||
| mList.add(findViewById(R.id.btn_ota)); | |||||
| mList.add(findViewById(R.id.glucometer)); | |||||
| mList.add(findViewById(R.id.btn_broadcast_scale)); | |||||
| mList.add(findViewById(R.id.btn_broadcast_blood_oxygen)); | |||||
| mList.add(findViewById(R.id.btn_smart_mask)); | |||||
| mList.add(findViewById(R.id.btn_bld)); | |||||
| mList.add(findViewById(R.id.btn_bleBo)); | |||||
| mList.add(findViewById(R.id.btn_coffeeScale)); | |||||
| mList.add(findViewById(R.id.btn_scooter)); | |||||
| mList.add(findViewById(R.id.btn_shareCharger)); | |||||
| mList.add(findViewById(R.id.btn_share_socket)); | |||||
| mList.add(findViewById(R.id.btn_transmission)); | |||||
| mList.add(findViewById(R.id.btn_wifi_ble_weight)); | |||||
| mList.add(findViewById(R.id.btn_baby_body_fat)); | |||||
| mList.add(findViewById(R.id.btn_broadcast_height)); | |||||
| mList.add(findViewById(R.id.btn_hbfs)); | |||||
| mList.add(findViewById(R.id.btn_find)); | |||||
| mList.add(findViewById(R.id.btn_4g_bs)); | |||||
| mList.add(findViewById(R.id.btn_clear_shake_hands)); | |||||
| mList.add(findViewById(R.id.btn_food_temp)); | |||||
| mList.add(findViewById(R.id.btn_temp_humidity)); | |||||
| mList.add(findViewById(R.id.btn_share_condom)); | |||||
| mList.add(findViewById(R.id.btn_rope_skip)); | |||||
| mList.add(findViewById(R.id.btn_broadcast_nutrition)); | |||||
| mList.add(findViewById(R.id.btn_ble_nutrition)); | |||||
| mList.add(findViewById(R.id.btn_toothbrush_test)); | |||||
| mList.add(findViewById(R.id.btn_leaone_broadcast)); | |||||
| mList.add(findViewById(R.id.btn_fascia_gun)); | |||||
| mList.add(findViewById(R.id.btn_blood_pressure_tc)); | |||||
| mList.add(findViewById(R.id.btn_body_scale_4g)); | |||||
| mList.add(findViewById(R.id.btn_scooter_cm02)); | |||||
| mList.add(findViewById(R.id.btn_temp_instrument)); | |||||
| mList.add(findViewById(R.id.btn_public_ble_network)); | |||||
| mList.add(findViewById(R.id.btn_rope_skipping_set_mode)); | |||||
| mList.add(findViewById(R.id.btn_air_detector)); | |||||
| mList.add(findViewById(R.id.btn_mqtt_air_detector)); | |||||
| mList.add(findViewById(R.id.btn_mqtt)); | |||||
| mList.add(findViewById(R.id.btn_wifi_ble_noise_meter)); | |||||
| mList.add(findViewById(R.id.btn_ble_noise_meter)); | |||||
| mList.add(findViewById(R.id.btn_meat_probe_charger)); | |||||
| mList.add(findViewById(R.id.btn_weight_scale)); | |||||
| mList.add(findViewById(R.id.btn_broadcast_scale_weight)); | |||||
| mList.add(findViewById(R.id.btn_meat_probe)); | |||||
| mList.add(findViewById(R.id.btn_barometric_temp_humidity)); | |||||
| for (View view : mList) { | |||||
| view.setOnClickListener(listener); | |||||
| } | |||||
| List<Integer> showViewId = AppConfig.SHOW_VIEW_ID; | |||||
| if (showViewId != null) { | |||||
| for (View view : mList) { | |||||
| view.setVisibility(View.GONE); | |||||
| } | |||||
| for (Integer integer : showViewId) { | |||||
| findViewById(integer).setVisibility(View.VISIBLE); | |||||
| } | |||||
| } | |||||
| findViewById(R.id.btn_rope_skipping_set_mode).setOnClickListener(new View.OnClickListener() { | |||||
| @Override | |||||
| public void onClick(View v) { | |||||
| startActivity(new Intent(mContext, RopeSkippingSetActivity.class)); | |||||
| // Intent intent = new Intent(); | |||||
| // intent.setAction("android.media.action.STILL_IMAGE_CAMERA"); | |||||
| // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||||
| // startActivity(intent); | |||||
| // | |||||
| // mHandler.postDelayed(new Runnable() { | |||||
| // @Override | |||||
| // public void run() { | |||||
| // try { | |||||
| // L.i("按下音量+ start"); | |||||
| // String keyCommand = "input keyevent " + KeyEvent.KEYCODE_VOLUME_UP; | |||||
| // Runtime runtime = Runtime.getRuntime(); | |||||
| // Process proc = runtime.exec(keyCommand); | |||||
| // L.i("按下音量+ stop"+proc.toString()); | |||||
| // } catch (IOException e) { | |||||
| // e.printStackTrace(); | |||||
| // } | |||||
| // | |||||
| // } | |||||
| // }, 5000); | |||||
| } | |||||
| }); | |||||
| // AILinkBleManager.getInstance().init(mContext, new AILinkBleManager.onInitListener() { | |||||
| // @Override | |||||
| // public void onInitSuccess() { | |||||
| // L.i("初始化成功"); | |||||
| // AILinkBleManager.getInstance().startScan(1000); | |||||
| // AILinkBleManager.getInstance().setOnCallbackBle(new OnCallbackBle() { | |||||
| // @Override | |||||
| // public void onScanning(BleValueBean data) { | |||||
| // L.i("当前搜索到的设备:"+data.getName()+" mac="+data.getMac()); | |||||
| // AILinkBleManager.getInstance().stopScan(); | |||||
| // AILinkBleManager.getInstance().connectDevice(data); | |||||
| // } | |||||
| // | |||||
| // @Override | |||||
| // public void onServicesDiscovered(String mac) { | |||||
| // L.i("连接成功:"+mac); | |||||
| // } | |||||
| // }); | |||||
| // | |||||
| // } | |||||
| // | |||||
| // @Override | |||||
| // public void onInitFailure() { | |||||
| // L.i("初始化失败"); | |||||
| // } | |||||
| // }); | |||||
| } | |||||
| protected void initData() { | |||||
| initPermissions(); | |||||
| List<AilinkLicenseBean> list = new ArrayList<>(); | |||||
| list.add(new AilinkLicenseBean(0x2F, 0x03, 0x09)); | |||||
| AILinkSDK.getInstance().initLicense(list); | |||||
| } | |||||
| protected void initView() { | |||||
| BleLog.init(true); | |||||
| //connectDevice(BleValueBean bleValueBean);连接的时候需要传广播对象,否则返回的cid,vid,pid始终都是0 | |||||
| //sdk | |||||
| AILinkSDK.getInstance().init(mContext); | |||||
| AILinkBleManager.getInstance().init(mContext, new AILinkBleManager.onInitListener() { | |||||
| @Override | |||||
| public void onInitSuccess() { | |||||
| AILinkBleManager.getInstance().startScan(0); | |||||
| } | |||||
| @Override | |||||
| public void onInitFailure() { | |||||
| } | |||||
| }); | |||||
| SP.init(this); | |||||
| } | |||||
| private class MyListener implements View.OnClickListener { | |||||
| @Override | |||||
| public void onClick(View v) { | |||||
| // boolean onClick= initPermissions(); | |||||
| // if (!onClick){ | |||||
| // return; | |||||
| // } | |||||
| int type = 0; | |||||
| switch (v.getId()) { | |||||
| case R.id.btn_clear_shake_hands: | |||||
| type = BleDeviceConfig.CLEAR_SHAKE_HANDS; | |||||
| break; | |||||
| case R.id.btn_sphy: | |||||
| type = BleDeviceConfig.BLOOD_PRESSURE; | |||||
| break; | |||||
| case R.id.btn_sphy_wifi_ble: | |||||
| type = BleDeviceConfig.SPHY_WIFI_BLE; | |||||
| break; | |||||
| case R.id.btn_tempgun: | |||||
| type = BleDeviceConfig.INFRARED_THERMOMETER; | |||||
| break; | |||||
| case R.id.btn_temp: | |||||
| type = BleDeviceConfig.THERMOMETER; | |||||
| break; | |||||
| case R.id.btn_baby: | |||||
| type = BleDeviceConfig.BABY_SCALE; | |||||
| break; | |||||
| case R.id.btn_height: | |||||
| type = BleDeviceConfig.HEIGHT_METER; | |||||
| break; | |||||
| case R.id.btn_lock: | |||||
| type = BleDeviceConfig.SMART_LOCK; | |||||
| break; | |||||
| case R.id.btn_ad_weight: | |||||
| type = BleDeviceConfig.WEIGHT_BODY_FAT_SCALE_AD; | |||||
| break; | |||||
| case R.id.btn_wifi_ble_weight: | |||||
| type = BleDeviceConfig.WEIGHT_BODY_FAT_SCALE_WIFI_BLE; | |||||
| break; | |||||
| case R.id.btn_wifi_ble_tooth: | |||||
| type = BleDeviceConfig.TOOTHBRUSH_WIFI_BLE; | |||||
| break; | |||||
| case R.id.btn_ble_weight: | |||||
| type = BleDeviceConfig.WEIGHT_BODY_FAT_SCALE; | |||||
| break; | |||||
| case R.id.glucometer: | |||||
| type = BleDeviceConfig.BLOOD_GLUCOSE; | |||||
| break; | |||||
| case R.id.btn_baby_body_fat: | |||||
| type = BleDeviceConfig.BABY_BODY_FAT; | |||||
| break; | |||||
| case R.id.btn_temp_instrument: | |||||
| type = BleDeviceConfig.TEMP_INSTRUMENT; | |||||
| break; | |||||
| case R.id.btn_mqtt_air_detector: | |||||
| type = BleDeviceConfig.MQTT_AIR_DETECTOR; | |||||
| break; | |||||
| case R.id.btn_air_detector: | |||||
| type = BleDeviceConfig.AIR_DETECTOR; | |||||
| break; | |||||
| case R.id.btn_broadcast_scale: | |||||
| Intent intentBroadcast = new Intent(MainActivity.this, BroadcastScaleActivity.class); | |||||
| startActivity(intentBroadcast); | |||||
| return; | |||||
| case R.id.btn_broadcast_scale_weight: | |||||
| Intent intentBroadcastWeight = new Intent(MainActivity.this, BroadcastWeightScaleActivity.class); | |||||
| startActivity(intentBroadcastWeight); | |||||
| return; | |||||
| case R.id.btn_broadcast_blood_oxygen: | |||||
| Intent intentBloodOxygen = new Intent(MainActivity.this, BroadcastBloodOxygenActivity.class); | |||||
| startActivity(intentBloodOxygen); | |||||
| return; | |||||
| case R.id.btn_smart_mask: | |||||
| type = BleDeviceConfig.SMART_MASK; | |||||
| break; | |||||
| case R.id.btn_bleBo: | |||||
| type = BleDeviceConfig.BLE_BOOLD_OXYGEN; | |||||
| break; | |||||
| // case R.id.btn_bld: | |||||
| // type = BleDeviceConfig.BLD_WEIGHT; | |||||
| // break; | |||||
| case R.id.btn_ble: | |||||
| type = -1; | |||||
| break; | |||||
| case R.id.btn_ble_test: | |||||
| type = -2; | |||||
| break; | |||||
| case R.id.btn_ota: | |||||
| type = -3; | |||||
| break; | |||||
| case R.id.btn_transmission: | |||||
| type = -4; | |||||
| break; | |||||
| case R.id.btn_blood_pressure_tc: | |||||
| // 血压计透传 | |||||
| type = -10; | |||||
| break; | |||||
| case R.id.eight_scale: | |||||
| type = BleDeviceConfig.EIGHT_BODY_FAT_SCALE; | |||||
| break; | |||||
| case R.id.btnConnectTest: | |||||
| Intent intent = new Intent(MainActivity.this, ConnectBleTestActivity.class); | |||||
| startActivity(intent); | |||||
| return; | |||||
| case R.id.wifi_config: | |||||
| Intent intent1 = new Intent(MainActivity.this, WifiConfigActivity.class); | |||||
| startActivity(intent1); | |||||
| return; | |||||
| case R.id.btn_coffeeScale: | |||||
| // 咖啡秤 | |||||
| type = BleDeviceConfig.COFFEE_SCALE; | |||||
| break; | |||||
| case R.id.btn_scooter: | |||||
| type = BleDeviceConfig.SMART_SCOOTER; | |||||
| break; | |||||
| case R.id.btn_shareCharger: | |||||
| // 共享充电器 | |||||
| type = BleDeviceConfig.SHARE_CHARGER; | |||||
| break; | |||||
| case R.id.btn_share_socket: | |||||
| // 共享插座 | |||||
| type = BleDeviceConfig.SHARE_SOCKET; | |||||
| break; | |||||
| case R.id.btn_share_condom: | |||||
| // 共享插座 | |||||
| type = BleDeviceConfig.SHARE_CONDOM; | |||||
| break; | |||||
| case R.id.btn_find: | |||||
| // 寻物器 | |||||
| Intent findDeviceActivity = new Intent(MainActivity.this, FindDeviceNewActivity.class); | |||||
| startActivity(findDeviceActivity); | |||||
| return; | |||||
| case R.id.btn_broadcast_height: | |||||
| // 广播身高仪 | |||||
| Intent intentBroadcastHeight = new Intent(MainActivity.this, BroadcastHeightActivity.class); | |||||
| startActivity(intentBroadcastHeight); | |||||
| return; | |||||
| case R.id.btn_4g_bs: | |||||
| // 4G 血糖仪 | |||||
| Intent bloodSugar4GIntent = new Intent(MainActivity.this, BloodSugar4GActivity.class); | |||||
| startActivity(bloodSugar4GIntent); | |||||
| return; | |||||
| case R.id.btn_food_temp: | |||||
| // 食品温度计 | |||||
| type = BleDeviceConfig.FOOD_TEMP; | |||||
| break; | |||||
| case R.id.btn_hbfs: | |||||
| type = BleDeviceConfig.HEIGHT_BODY_FAT; | |||||
| break; | |||||
| case R.id.btn_temp_humidity: | |||||
| type = BleDeviceConfig.TEMP_Humidity; | |||||
| break; | |||||
| case R.id.btn_rope_skip: | |||||
| type = BleDeviceConfig.ROPE_SKIPPING; | |||||
| break; | |||||
| case R.id.btn_broadcast_nutrition: | |||||
| // 广播营养秤 | |||||
| Intent broadcastNutritionIntent = new Intent(MainActivity.this, BroadNutritionActivity.class); | |||||
| startActivity(broadcastNutritionIntent); | |||||
| return; | |||||
| case R.id.btn_ble_nutrition: | |||||
| // 蓝牙营养秤 | |||||
| type = BleDeviceConfig.BLE_NUTRITION_SCALE; | |||||
| break; | |||||
| case R.id.btn_toothbrush_test: | |||||
| // 牙刷测试 | |||||
| type = BleDeviceConfig.TOOTHBRUSH_TEST; | |||||
| break; | |||||
| case R.id.btn_leaone_broadcast: | |||||
| // LeaOne 广播秤 | |||||
| Intent broadcastLeaOneIntent = new Intent(MainActivity.this, LeaOneBroadcastActivity.class); | |||||
| startActivity(broadcastLeaOneIntent); | |||||
| return; | |||||
| case R.id.btn_fascia_gun: | |||||
| // 筋膜枪 | |||||
| type = BleDeviceConfig.FASCIA_GUN; | |||||
| break; | |||||
| case R.id.btn_scooter_cm02: | |||||
| type = BleDeviceConfig.SMART_SCOOTER_CM02; | |||||
| break; | |||||
| case R.id.btn_body_scale_4g: | |||||
| // 4G 体脂秤 | |||||
| Intent bodyScaleIntent = new Intent(MainActivity.this, BodyScale4GActivity.class); | |||||
| startActivity(bodyScaleIntent); | |||||
| return; | |||||
| case R.id.btn_public_ble_network: | |||||
| // BLE通用配网 | |||||
| type = BleDeviceConfig.PUBLIC_BLE_NETWORK; | |||||
| break; | |||||
| case R.id.btn_wifi_ble_noise_meter: | |||||
| // wifi+ble噪音计 | |||||
| type = BleDeviceConfig.WIFI_BLE_NOISE_METER; | |||||
| break; | |||||
| case R.id.btn_ble_noise_meter: | |||||
| // ble噪音计 | |||||
| type = BleDeviceConfig.BLE_NOISE_METER; | |||||
| break; | |||||
| case R.id.btn_meat_probe_charger: | |||||
| //食物探针充电盒 | |||||
| type = BleDeviceConfig.MEAT_PROBE_CHARGER; | |||||
| break; | |||||
| case R.id.btn_weight_scale: | |||||
| //体重秤 | |||||
| type = BleDeviceConfig.WEIGHT_SCALE; | |||||
| break; | |||||
| case R.id.btn_meat_probe: | |||||
| // 食物探针 | |||||
| type = BleDeviceConfig.MEAT_PROBE; | |||||
| break; | |||||
| case R.id.btn_barometric_temp_humidity: | |||||
| type = BleDeviceConfig.BAROMETRIC_TEMP_HUMIDITY; | |||||
| break; | |||||
| case R.id.btn_mqtt: | |||||
| return; | |||||
| default: | |||||
| return; | |||||
| } | |||||
| startActivity(type); | |||||
| } | |||||
| } | |||||
| private void startActivity(int type) { | |||||
| Intent intent = new Intent(this, ShowBleActivity.class); | |||||
| intent.putExtra("type", type); | |||||
| startActivity(intent); | |||||
| } | |||||
| @Override | |||||
| protected void onResume() { | |||||
| super.onResume(); | |||||
| } | |||||
| @Override | |||||
| protected void onDestroy() { | |||||
| super.onDestroy(); | |||||
| BleLog.quit(); | |||||
| } | |||||
| //-----------------------权限---------------------------------------- | |||||
| /** | |||||
| * 需要申请的权限 | |||||
| */ | |||||
| private String[] LOCATION_PERMISSION = new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE}; | |||||
| private final static String[] BLUETOOTH_PERMISSION = new String[]{Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_ADVERTISE, Manifest.permission.BLUETOOTH_CONNECT}; | |||||
| /** | |||||
| * 权限请求返回 | |||||
| */ | |||||
| private final int PERMISSION = 101; | |||||
| /** | |||||
| * 定位服务返回 | |||||
| */ | |||||
| protected final int LOCATION_SERVER = 102; | |||||
| private HintDataDialogFragment mHintDataDialog = null; | |||||
| protected void initPermissions() { | |||||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { | |||||
| onPermissionsOk(); | |||||
| return; | |||||
| } | |||||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { | |||||
| if (ContextCompat.checkSelfPermission(this, LOCATION_PERMISSION[0]) != PackageManager.PERMISSION_GRANTED) { | |||||
| ActivityCompat.requestPermissions(this, LOCATION_PERMISSION, PERMISSION); | |||||
| } else { | |||||
| boolean bleStatus = AppStart.isLocServiceEnable(mContext); | |||||
| if (!bleStatus) { | |||||
| //没有开启定位服务 | |||||
| mHintDataDialog = HintDataDialogFragment.newInstance() | |||||
| .setTitle("提示", 0) | |||||
| .setCancel("取消", 0) | |||||
| .setOk("确定", 0) | |||||
| .setContent("请求开启定位服务", true) | |||||
| .setOnDialogListener(new HintDataDialogFragment.onDialogListener() { | |||||
| @Override | |||||
| public void onSucceedListener(View v) { | |||||
| startLocationActivity(); | |||||
| } | |||||
| }); | |||||
| mHintDataDialog.show(getSupportFragmentManager()); | |||||
| } else { | |||||
| onPermissionsOk(); | |||||
| } | |||||
| } | |||||
| } else { | |||||
| if (ContextCompat.checkSelfPermission(this, BLUETOOTH_PERMISSION[0]) != PackageManager.PERMISSION_GRANTED) { | |||||
| ActivityCompat.requestPermissions(this, BLUETOOTH_PERMISSION, PERMISSION); | |||||
| } | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |||||
| super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |||||
| //请求权限被拒绝 | |||||
| if (requestCode != PERMISSION) | |||||
| return; | |||||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { | |||||
| if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | |||||
| initPermissions(); | |||||
| } else { | |||||
| if (ActivityCompat.shouldShowRequestPermissionRationale(this, LOCATION_PERMISSION[0])) { | |||||
| //权限请求失败,但未选中“不再提示”选项,再次请求 | |||||
| ActivityCompat.requestPermissions(this, LOCATION_PERMISSION, PERMISSION); | |||||
| } else { | |||||
| //权限请求失败,选中“不再提示”选项 | |||||
| mHintDataDialog = HintDataDialogFragment.newInstance() | |||||
| .setTitle("提示", 0) | |||||
| .setCancel("取消", 0) | |||||
| .setOk("确定", 0) | |||||
| .setContent("请求开启定位权限", true) | |||||
| .setOnDialogListener(new HintDataDialogFragment.onDialogListener() { | |||||
| @Override | |||||
| public void onSucceedListener(View v) { | |||||
| AppStart.startUseSetActivity(mContext); | |||||
| } | |||||
| }); | |||||
| mHintDataDialog.show(getSupportFragmentManager()); | |||||
| } | |||||
| } | |||||
| } else { | |||||
| if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | |||||
| initPermissions(); | |||||
| } | |||||
| } | |||||
| } | |||||
| /** | |||||
| * 启动去设置定位服务 | |||||
| */ | |||||
| protected void startLocationActivity() { | |||||
| AppStart.startLocationActivity(this, LOCATION_SERVER); | |||||
| } | |||||
| /** | |||||
| * 权限ok | |||||
| */ | |||||
| protected void onPermissionsOk() { | |||||
| } | |||||
| @Override | |||||
| protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { | |||||
| super.onActivityResult(requestCode, resultCode, data); | |||||
| if (requestCode == LOCATION_SERVER) { | |||||
| //定位服务页面返回 | |||||
| initPermissions(); | |||||
| } | |||||
| } | |||||
| } |
| import com.pingwang.bluetoothlib.device.BleDevice; | import com.pingwang.bluetoothlib.device.BleDevice; | ||||
| import com.pingwang.bluetoothlib.listener.OnCallbackBle; | import com.pingwang.bluetoothlib.listener.OnCallbackBle; | ||||
| import com.pingwang.bluetoothlib.listener.OnScanFilterListener; | import com.pingwang.bluetoothlib.listener.OnScanFilterListener; | ||||
| import com.pingwang.bluetoothlib.server.ELinkBleServer; | |||||
| import com.pingwang.bluetoothlib.utils.BleLog; | import com.pingwang.bluetoothlib.utils.BleLog; | ||||
| import com.pingwang.bluetoothlib.utils.BleStrUtils; | import com.pingwang.bluetoothlib.utils.BleStrUtils; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.config.BleDeviceConfig; | import aicare.net.cn.sdk.ailinksdkdemoandroid.config.BleDeviceConfig; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.HintDataDialogFragment; | import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.HintDataDialogFragment; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.LoadingIosDialogFragment; | import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.LoadingIosDialogFragment; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.find.FindDeviceNewActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.PublicBleNetworkCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.TempInstrument.TempInstrumentActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.airdetector.AirDetectorActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.barometric_temp_humidity.BarometricTempHygrometerActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.ble_nutrition.BleNutritionActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.blood_pressure_tc.BloodPressureTcActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.coffee_scale.CoffeeScaleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.fascia_gun.FasciaGunActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.food_temp.FoodTempActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.meat_probe.MeatProbeActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.meat_probe_charger.MeatProbeChargerActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.noise_meter.BleNoiseMeterActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.noise_meter.WifiBleNoiseMeterActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.ropeskipping.RopeSkippingActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.share_charger.ShareChargerActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.share_condom.ShareCondomActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.share_socket.ShareSocketActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.home.HomeDataManager; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.home.MainActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.toothbrush.ToothBrushWifiBleActivity; | import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.toothbrush.ToothBrushWifiBleActivity; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.toothbrush_test.ToothbrushTestActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.weight_scale.WeightScaleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.wifible_sphy.WifiBleSphyActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.CheckPermissionUtils; | import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.CheckPermissionUtils; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.view.MyItemDecoration; | import aicare.net.cn.sdk.ailinksdkdemoandroid.view.MyItemDecoration; | ||||
| import cn.net.aicare.modulelibrary.module.RopeSkipping.RopeSkippingBleData; | import cn.net.aicare.modulelibrary.module.RopeSkipping.RopeSkippingBleData; | ||||
| private int mPid; | private int mPid; | ||||
| private int mScanCid = 0; | private int mScanCid = 0; | ||||
| private String mBleName; | private String mBleName; | ||||
| private Class<?> targetClass; | |||||
| private Handler mHandler = new Handler(Looper.getMainLooper()) { | private Handler mHandler = new Handler(Looper.getMainLooper()) { | ||||
| @Override | @Override | ||||
| public void handleMessage(Message msg) { | public void handleMessage(Message msg) { | ||||
| super.onCreate(savedInstanceState); | super.onCreate(savedInstanceState); | ||||
| setContentView(R.layout.activity_show_ble); | setContentView(R.layout.activity_show_ble); | ||||
| ActionBar supportActionBar = getSupportActionBar(); | ActionBar supportActionBar = getSupportActionBar(); | ||||
| if (supportActionBar != null) | |||||
| if (supportActionBar != null) { | |||||
| supportActionBar.setTitle(getString(R.string.app_name) + BuildConfig.VERSION_NAME); | supportActionBar.setTitle(getString(R.string.app_name) + BuildConfig.VERSION_NAME); | ||||
| Intent mUserService = new Intent(this.getApplicationContext(), ELinkBleServer.class); | |||||
| //核心用户服务 | |||||
| startService(mUserService); | |||||
| } | |||||
| mContext = this; | mContext = this; | ||||
| mType = getIntent().getIntExtra("type", 0); | mType = getIntent().getIntExtra("type", 0); | ||||
| mCid = getIntent().getIntExtra("cid", 0); | |||||
| if (0 == mType) { | if (0 == mType) { | ||||
| finish(); | finish(); | ||||
| return; | return; | ||||
| } | } | ||||
| mScanCid = mType; | |||||
| mScanCid = mCid; | |||||
| targetClass = HomeDataManager.getTargetActivityClass(mType); | |||||
| if (targetClass == null) { | |||||
| return; | |||||
| } | |||||
| init(); | init(); | ||||
| initData(); | initData(); | ||||
| // 如果是蓝牙牙刷,就弹个框提醒 | // 如果是蓝牙牙刷,就弹个框提醒 | ||||
| if (mType == BleDeviceConfig.TOOTHBRUSH_TEST) { | |||||
| if (mCid == BleDeviceConfig.TOOTHBRUSH_TEST) { | |||||
| new AlertDialog.Builder(mContext).setMessage("启动牙刷,工作10秒钟,然后关闭牙刷(让牙刷处于广播状态),然后点击搜索,选中列表中的牙刷,开始测试") | new AlertDialog.Builder(mContext).setMessage("启动牙刷,工作10秒钟,然后关闭牙刷(让牙刷处于广播状态),然后点击搜索,选中列表中的牙刷,开始测试") | ||||
| .setPositiveButton("确认", null) | |||||
| .show(); | |||||
| .setPositiveButton("确认", null) | |||||
| .show(); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } else if (mCid == BleDeviceConfig.MEAT_PROBE_CHARGER) { | } else if (mCid == BleDeviceConfig.MEAT_PROBE_CHARGER) { | ||||
| //探针充电盒握手 | //探针充电盒握手 | ||||
| BleConfig.setHandshakeStatus(mac, true, mCid, mVid, mPid); | |||||
| mNoEncryptionMac = mac; | |||||
| if (mVid == 0x54) { | |||||
| BleConfig.setHandshakeStatus(mac, true, mCid, mVid, mPid); | |||||
| mNoEncryptionMac = mac; | |||||
| } | |||||
| } | } | ||||
| if (mAILinkBleManager != null) { | if (mAILinkBleManager != null) { | ||||
| mAILinkBleManager.stopScan(); | mAILinkBleManager.stopScan(); | ||||
| dismissLoading(); | dismissLoading(); | ||||
| Intent intent = new Intent(); | Intent intent = new Intent(); | ||||
| int type = mType;//默认婴儿秤 | int type = mType;//默认婴儿秤 | ||||
| switch (type) { | |||||
| case BleDeviceConfig.BABY_SCALE: | |||||
| intent.setClass(ShowBleActivity.this, BabyCmdActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.INFRARED_THERMOMETER: | |||||
| intent.setClass(ShowBleActivity.this, TempGunCmdActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.BLOOD_PRESSURE: | |||||
| intent.setClass(ShowBleActivity.this, SphyCmdActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.SPHY_WIFI_BLE: | |||||
| intent.setClass(ShowBleActivity.this, WifiBleSphyActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.THERMOMETER: | |||||
| intent.setClass(ShowBleActivity.this, TempCmdActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.HEIGHT_METER: | |||||
| intent.setClass(ShowBleActivity.this, HeightCmdActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.WEIGHT_BODY_FAT_SCALE: | |||||
| intent.setClass(ShowBleActivity.this, WeightScaleBleActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.WEIGHT_BODY_FAT_SCALE_AD: | |||||
| intent.setClass(ShowBleActivity.this, ADWeightScaleCmdActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.WEIGHT_BODY_FAT_SCALE_WIFI_BLE: | |||||
| intent.setClass(ShowBleActivity.this, WeightScaleWifiBleActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.TOOTHBRUSH_WIFI_BLE: | |||||
| intent.setClass(ShowBleActivity.this, ToothBrushWifiBleActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.EIGHT_BODY_FAT_SCALE: | |||||
| intent.setClass(ShowBleActivity.this, EightBodyfatActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.BLOOD_GLUCOSE: | |||||
| intent.setClass(ShowBleActivity.this, BloodGlucoseActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.BABY_BODY_FAT: | |||||
| intent.setClass(ShowBleActivity.this, BabyBodyFatCmdActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.SMART_MASK: | |||||
| intent.setClass(ShowBleActivity.this, SmartMaskActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.SMART_SCOOTER_CM02: | |||||
| intent.setClass(ShowBleActivity.this, AiLinkScooterActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.BLE_BOOLD_OXYGEN: | |||||
| intent.setClass(ShowBleActivity.this, BloodOxygenActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.COFFEE_SCALE: | |||||
| // 咖啡秤 | |||||
| intent.setClass(ShowBleActivity.this, CoffeeScaleActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.SHARE_CHARGER: | |||||
| // 共享充电器 | |||||
| intent.setClass(ShowBleActivity.this, ShareChargerActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.SHARE_SOCKET: | |||||
| // 共享插座 | |||||
| intent.setClass(ShowBleActivity.this, ShareSocketActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.SHARE_CONDOM: | |||||
| // 共享套套机 | |||||
| intent.setClass(ShowBleActivity.this, ShareCondomActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.FIND_DEVICE: | |||||
| // 寻物器 | |||||
| // intent.setClass(ShowBleActivity.this, FindDeviceActivity.class); | |||||
| intent.setClass(ShowBleActivity.this, FindDeviceNewActivity.class); | |||||
| BleConfig.setHandshakeStatus(mac, false); | |||||
| break; | |||||
| case BleDeviceConfig.FOOD_TEMP: | |||||
| // 食品温度计 | |||||
| intent.setClass(ShowBleActivity.this, FoodTempActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.HEIGHT_BODY_FAT: | |||||
| intent.setClass(ShowBleActivity.this, HeightWeightScaleActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.TEMP_Humidity: | |||||
| case BleDeviceConfig.TEMP_Humidity_wifi: | |||||
| intent.setClass(ShowBleActivity.this, TempHumidityActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.ROPE_SKIPPING: | |||||
| intent.setClass(ShowBleActivity.this, RopeSkippingActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.BLE_NUTRITION_SCALE: | |||||
| // 蓝牙营养秤 | |||||
| intent.setClass(ShowBleActivity.this, BleNutritionActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.TOOTHBRUSH_TEST: | |||||
| // 牙刷测试 | |||||
| intent.setClass(ShowBleActivity.this, ToothbrushTestActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.FASCIA_GUN: | |||||
| // 筋膜枪 | |||||
| intent.setClass(ShowBleActivity.this, FasciaGunActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.TEMP_INSTRUMENT: | |||||
| // 测温仪 | |||||
| intent.setClass(ShowBleActivity.this, TempInstrumentActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.PUBLIC_BLE_NETWORK: | |||||
| // 通用配网 | |||||
| intent.setClass(ShowBleActivity.this, PublicBleNetworkCmdActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.AIR_DETECTOR: | |||||
| case BleDeviceConfig.MQTT_AIR_DETECTOR: | |||||
| intent.setClass(ShowBleActivity.this, AirDetectorActivity.class); | |||||
| break; | |||||
| //wifi+ble噪音计 | |||||
| case BleDeviceConfig.WIFI_BLE_NOISE_METER: | |||||
| intent.setClass(ShowBleActivity.this, WifiBleNoiseMeterActivity.class); | |||||
| break; | |||||
| //ble噪音计 | |||||
| case BleDeviceConfig.BLE_NOISE_METER: | |||||
| intent.setClass(ShowBleActivity.this, BleNoiseMeterActivity.class); | |||||
| break; | |||||
| //探针充电盒 | |||||
| case BleDeviceConfig.MEAT_PROBE_CHARGER: | |||||
| intent.setClass(ShowBleActivity.this, MeatProbeChargerActivity.class); | |||||
| break; | |||||
| //体脂秤 | |||||
| case BleDeviceConfig.WEIGHT_SCALE: | |||||
| intent.setClass(ShowBleActivity.this, WeightScaleActivity.class); | |||||
| break; | |||||
| // case BleDeviceConfig.BLD_WEIGHT: | |||||
| // intent.setClass(ShowBleActivity.this, BLDWeightScaleBle.class); | |||||
| // break; | |||||
| case -1: | |||||
| intent.setClass(ShowBleActivity.this, BleCmdActivity.class); | |||||
| break; | |||||
| case -2: | |||||
| intent.setClass(ShowBleActivity.this, TestCmdActivity.class); | |||||
| break; | |||||
| case -3: | |||||
| // intent.setClass(ShowBleActivity.this, TestOtaActivity.class); | |||||
| break; | |||||
| case -4: | |||||
| intent.setClass(ShowBleActivity.this, TransmissionActivity.class); | |||||
| break; | |||||
| case -10: | |||||
| // 血压计透传 | |||||
| intent.setClass(ShowBleActivity.this, BloodPressureTcActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.CLEAR_SHAKE_HANDS: | |||||
| //验证不握手不加密的界面 | |||||
| intent.setClass(ShowBleActivity.this, ClearShakeHandsActivity.class); | |||||
| break; | |||||
| //食物探针 | |||||
| case BleDeviceConfig.MEAT_PROBE: | |||||
| intent.setClass(ShowBleActivity.this, MeatProbeActivity.class); | |||||
| break; | |||||
| case BleDeviceConfig.BAROMETRIC_TEMP_HUMIDITY: | |||||
| // 气压温湿度计 | |||||
| intent.setClass(ShowBleActivity.this, BarometricTempHygrometerActivity.class); | |||||
| break; | |||||
| default: | |||||
| break; | |||||
| } | |||||
| intent.setClass(ShowBleActivity.this, targetClass); | |||||
| mAILinkBleManager.removeOnCallbackBle(this); | |||||
| intent.putExtra("type", type); | intent.putExtra("type", type); | ||||
| intent.putExtra("mac", mac); | intent.putExtra("mac", mac); | ||||
| intent.putExtra("cid", mCid); | intent.putExtra("cid", mCid); |
| import com.pingwang.bluetoothlib.utils.BleLog; | import com.pingwang.bluetoothlib.utils.BleLog; | ||||
| import com.pingwang.bluetoothlib.utils.BleStrUtils; | import com.pingwang.bluetoothlib.utils.BleStrUtils; | ||||
| import com.pingwang.bluetoothlib.utils.UuidUtils; | import com.pingwang.bluetoothlib.utils.UuidUtils; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.TimeUtils; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Locale; | import java.util.Locale; | ||||
| import java.util.UUID; | import java.util.UUID; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.TimeUtils; | |||||
| /** | /** | ||||
| * xing<br> | * xing<br> |
| } | } | ||||
| @Override | @Override | ||||
| public void onIpData(String ip) { | public void onIpData(String ip) { | ||||
| import android.app.Application; | import android.app.Application; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.L; | |||||
| public class MyApplication extends Application { | public class MyApplication extends Application { | ||||
| private static MyApplication sInstance; | private static MyApplication sInstance; | ||||
| public void onCreate() { | public void onCreate() { | ||||
| super.onCreate(); | super.onCreate(); | ||||
| sInstance = this; | sInstance = this; | ||||
| initLog(); | |||||
| } | |||||
| private void initLog() { | |||||
| String logPath = L.getDefaultLogPath(this); | |||||
| String fileName = L.getDefaultLogName(); | |||||
| L.init(logPath, fileName, true); | |||||
| } | } | ||||
| public static MyApplication getInstance(){ | public static MyApplication getInstance(){ |
| package aicare.net.cn.sdk.ailinksdkdemoandroid.config; | |||||
| import java.util.List; | |||||
| /** | |||||
| * xing<br> | |||||
| * 2021/3/5<br> | |||||
| * java类作用描述 | |||||
| */ | |||||
| public class AppConfig { | |||||
| /** | |||||
| * 是否为客户专用OTA | |||||
| */ | |||||
| public static boolean APP_TYPE_OTA=false; | |||||
| /** | |||||
| * 支持显示的ID,null表示所有的都显示,ID是按钮的ID不是CID | |||||
| */ | |||||
| public static List<Integer> SHOW_VIEW_ID = null; | |||||
| } |
| public static final int BAROMETRIC_TEMP_HUMIDITY = 0x005C; | public static final int BAROMETRIC_TEMP_HUMIDITY = 0x005C; | ||||
| //------------------特殊 | //------------------特殊 | ||||
| /** | |||||
| * Ble通用设置 | |||||
| */ | |||||
| public static final int BLE_GENERAL_SETTINGS = -1; | |||||
| /** | |||||
| * Ble test | |||||
| */ | |||||
| public static final int BLE_TEST = -2; | |||||
| /** | |||||
| * OTA通用 | |||||
| */ | |||||
| public static final int OTA = -3; | |||||
| /** | |||||
| * 透传 | |||||
| */ | |||||
| public static final int PENETRATE = -4; | |||||
| /** | /** | ||||
| * 验证不握手不加密的id | * 验证不握手不加密的id | ||||
| * 通用配网 | * 通用配网 | ||||
| */ | */ | ||||
| public final static int PUBLIC_BLE_NETWORK = -7; | public final static int PUBLIC_BLE_NETWORK = -7; | ||||
| /** | |||||
| * 血压计透传 | |||||
| */ | |||||
| public static final int SPHYGMOMETER_PENETRATE = -10; | |||||
| /** | |||||
| * wifi_ble_OTA | |||||
| */ | |||||
| public final static int WIFI_BLE_OTA = -11; | |||||
| } | } |
| import aicare.net.cn.sdk.ailinksdkdemoandroid.R; | import aicare.net.cn.sdk.ailinksdkdemoandroid.R; | ||||
| public class WifiDialog extends DialogFragment implements View.OnClickListener { | public class WifiDialog extends DialogFragment implements View.OnClickListener { | ||||
| /** | /** |
| package aicare.net.cn.sdk.ailinksdkdemoandroid.home; | |||||
| import java.util.ArrayList; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.ADWeightScaleCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.AiLinkScooterActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.BabyBodyFatCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.BabyCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.BleCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.BloodOxygenActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.BloodSugar4GActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.BroadcastBloodOxygenActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.BroadcastScaleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.ClearShakeHandsActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.ConnectBleTestActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.EightBodyfatActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.HeightCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.HeightWeightScaleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.R; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.SmartMaskActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.SphyCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.TempCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.TempGunCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.TempHumidityActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.TestCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.TransmissionActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.WeightScaleBleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.WifiConfigActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.config.BleDeviceConfig; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.find.FindDeviceNewActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.PublicBleNetworkCmdActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.TempInstrument.TempInstrumentActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.airdetector.AirDetectorActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.barometric_temp_humidity.BarometricTempHygrometerActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.ble_nutrition.BleNutritionActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.blood_glucose.BloodGlucoseActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.blood_pressure_tc.BloodPressureTcActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.body_scale_4g.BodyScale4GActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.broadcast_height.BroadcastHeightActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.broadcast_nutrition.BroadNutritionActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.broadcast_weight_sacle.BroadcastWeightScaleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.coffee_scale.CoffeeScaleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.fascia_gun.FasciaGunActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.food_temp.FoodTempActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.leaone_broadcast.LeaOneBroadcastActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.meat_probe.MeatProbeActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.meat_probe_charger.MeatProbeChargerActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.noise_meter.BleNoiseMeterActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.noise_meter.WifiBleNoiseMeterActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.ropeskipping.RopeSkippingActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.ropeskipping.RopeSkippingSetActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.share_charger.ShareChargerActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.share_condom.ShareCondomActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.share_socket.ShareSocketActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.toothbrush.ToothBrushWifiBleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.toothbrush_test.ToothbrushTestActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.weight_scale.WeightScaleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.wifi_ble_scale.WeightScaleWifiBleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.modules.wifible_sphy.WifiBleSphyActivity; | |||||
| /** | |||||
| * 说明: | |||||
| * | |||||
| * @author yesp | |||||
| * 2024/1/5 | |||||
| */ | |||||
| public class HomeDataManager { | |||||
| public static final int IGNORE_TYPE = -1000; | |||||
| /** | |||||
| * 获取 item 集合 | |||||
| */ | |||||
| public static ArrayList<JumpBean> getHomeDataList() { | |||||
| ArrayList<JumpBean> beanList = new ArrayList<>(); | |||||
| // Ble通用设置 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.BLE_GENERAL_SETTINGS, R.string.item_ble_general_settings, null, BleCmdActivity.class)); | |||||
| // BLE通用配网 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.PUBLIC_BLE_NETWORK, R.string.item_ble_universal_distribution_network, null, PublicBleNetworkCmdActivity.class)); | |||||
| // Ble test | |||||
| beanList.add(new JumpBean(BleDeviceConfig.BLE_TEST, R.string.item_ble_test, null, TestCmdActivity.class)); | |||||
| // Ble connect test | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_ble_connect_test, ConnectBleTestActivity.class, null)); | |||||
| // 透传 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.PENETRATE, R.string.item_penetrate, null, TransmissionActivity.class)); | |||||
| // 广播秤 | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_body_fat_scale_broadcast, BroadcastScaleActivity.class, null)); | |||||
| // Ble体脂秤 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.WEIGHT_BODY_FAT_SCALE, R.string.item_body_fat_scale_ble, null, WeightScaleBleActivity.class)); | |||||
| // 4G体脂秤 | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_body_fat_scale_4g, BodyScale4GActivity.class, null)); | |||||
| // WiFi+Ble体脂秤 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.WEIGHT_BODY_FAT_SCALE_WIFI_BLE, R.string.item_body_fat_scale_wifi_ble, null, WeightScaleWifiBleActivity.class)); | |||||
| // 八极秤 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.EIGHT_BODY_FAT_SCALE, R.string.item_body_fat_scale_eight, null, EightBodyfatActivity.class)); | |||||
| // 艾迪体脂秤 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.WEIGHT_BODY_FAT_SCALE_AD, R.string.item_body_fat_scale_aidi, null, ADWeightScaleCmdActivity.class)); | |||||
| // 婴儿秤 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.BABY_SCALE, R.string.item_baby_scale, null, BabyCmdActivity.class)); | |||||
| // 婴儿体脂两用秤 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.BABY_BODY_FAT, R.string.item_baby_body_fat_scale, null, BabyBodyFatCmdActivity.class)); | |||||
| // Ble体重秤 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.WEIGHT_SCALE, R.string.item_weight_scale_ble, null, WeightScaleActivity.class)); | |||||
| // 广播体重秤 | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_weight_scale_broadcast, BroadcastWeightScaleActivity.class, null)); | |||||
| // 蓝牙营养秤 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.BLE_NUTRITION_SCALE, R.string.item_nutritional_scale_ble, null, BleNutritionActivity.class)); | |||||
| // 广播营养秤 | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_nutritional_scale_broadcast, BroadNutritionActivity.class, null)); | |||||
| // 咖啡秤 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.COFFEE_SCALE, R.string.item_coffee_scale, null, CoffeeScaleActivity.class)); | |||||
| // 身高体脂秤 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.HEIGHT_BODY_FAT, R.string.item_height_body_fat_scale, null, HeightWeightScaleActivity.class)); | |||||
| // 身高仪 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.HEIGHT_METER, R.string.item_height_measuring_ble, null, HeightCmdActivity.class)); | |||||
| // 广播身高仪 | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_height_measuring_broadcast, BroadcastHeightActivity.class, null)); | |||||
| // BLE血压计 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.BLOOD_PRESSURE, R.string.item_sphygmometer_ble, null, SphyCmdActivity.class)); | |||||
| // wifi血压计 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.SPHY_WIFI_BLE, R.string.item_sphygmometer_wifi, null, WifiBleSphyActivity.class)); | |||||
| // 血压计透传 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.SPHYGMOMETER_PENETRATE, R.string.item_sphygmometer_penetrate, null, BloodPressureTcActivity.class)); | |||||
| // 血糖仪 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.BLOOD_GLUCOSE, R.string.item_blood_glucose_meter_ble, null, BloodGlucoseActivity.class)); | |||||
| // 4G血糖仪 | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_blood_glucose_meter_4g, BloodSugar4GActivity.class, null)); | |||||
| // 血氧仪(广播) | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_oximeter_broadcast, BroadcastBloodOxygenActivity.class, null)); | |||||
| // 血氧(连接) | |||||
| beanList.add(new JumpBean(BleDeviceConfig.BLE_BOOLD_OXYGEN, R.string.item_oximeter_ble, null, BloodOxygenActivity.class)); | |||||
| // 额温枪 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.INFRARED_THERMOMETER, R.string.item_infrared_thermometer, null, TempGunCmdActivity.class)); | |||||
| // 体温计 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.THERMOMETER, R.string.item_thermometer, null, TempCmdActivity.class)); | |||||
| // 测温仪 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.TEMP_INSTRUMENT, R.string.item_auto_thermometer, null, TempInstrumentActivity.class)); | |||||
| // 食品温度计 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.FOOD_TEMP, R.string.item_food_thermometer, null, FoodTempActivity.class)); | |||||
| // 食物探针 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.MEAT_PROBE, R.string.item_meat_probe, null, MeatProbeActivity.class)); | |||||
| // 探针充电盒 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.MEAT_PROBE_CHARGER, R.string.item_probe_charging_box, null, MeatProbeChargerActivity.class)); | |||||
| // 牙刷(wifi+ble) | |||||
| beanList.add(new JumpBean(BleDeviceConfig.TOOTHBRUSH_WIFI_BLE, R.string.item_toothbrush_wifi_ble, null, ToothBrushWifiBleActivity.class)); | |||||
| // 牙刷测试 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.TOOTHBRUSH_TEST, R.string.item_toothbrush_test, null, ToothbrushTestActivity.class)); | |||||
| // 口罩 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.SMART_MASK, R.string.item_smart_mask, null, SmartMaskActivity.class)); | |||||
| // 筋膜枪 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.FASCIA_GUN, R.string.item_fascia_gun, null, FasciaGunActivity.class)); | |||||
| // 跳绳 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.ROPE_SKIPPING, R.string.item_rope_skipping, null, RopeSkippingActivity.class)); | |||||
| // 跳绳设置模式 | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_rope_skipping_set_mode, RopeSkippingSetActivity.class, null)); | |||||
| // 温湿度计 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.TEMP_Humidity, R.string.item_hygrothermograph, null, TempHumidityActivity.class)); | |||||
| // 气压温湿度计 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.BAROMETRIC_TEMP_HUMIDITY, R.string.item_barothermohygrograph, null, BarometricTempHygrometerActivity.class)); | |||||
| // ble噪音计 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.BLE_NOISE_METER, R.string.item_noise_meter_ble, null, BleNoiseMeterActivity.class)); | |||||
| // wifi+ble噪音计 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.WIFI_BLE_NOISE_METER, R.string.item_noise_meter_wifi_ble, null, WifiBleNoiseMeterActivity.class)); | |||||
| // 空气检测仪 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.MQTT_AIR_DETECTOR, R.string.item_air_Detector, null, AirDetectorActivity.class)); | |||||
| // 电滑板Cm02 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.SMART_SCOOTER_CM02, R.string.item_scooter_cm02, null, AiLinkScooterActivity.class)); | |||||
| // 共享充电器 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.SHARE_CHARGER, R.string.item_shared_charger, null, ShareChargerActivity.class)); | |||||
| // 共享插座 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.SHARE_SOCKET, R.string.item_shared_socket, null, ShareSocketActivity.class)); | |||||
| // 共享套套机 | |||||
| beanList.add(new JumpBean(BleDeviceConfig.SHARE_CONDOM, R.string.item_condom, null, ShareCondomActivity.class)); | |||||
| // 寻物器 | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_finder, FindDeviceNewActivity.class, null)); | |||||
| // LeaOne测试 | |||||
| beanList.add(new JumpBean(IGNORE_TYPE, R.string.item_leaone, LeaOneBroadcastActivity.class, null)); | |||||
| return beanList; | |||||
| } | |||||
| public static ArrayList<JumpBean> getHideDataList() { | |||||
| ArrayList<JumpBean> hideList = new ArrayList<>(); | |||||
| // 不握手不加密 | |||||
| hideList.add(new JumpBean(BleDeviceConfig.CLEAR_SHAKE_HANDS, R.string.item_no_handshake_encryption, null, ClearShakeHandsActivity.class)); | |||||
| // wifi 配置 | |||||
| hideList.add(new JumpBean(IGNORE_TYPE, R.string.item_wifi_config, WifiConfigActivity.class, null)); | |||||
| return hideList; | |||||
| } | |||||
| /** | |||||
| * 要跳转的目标Activity | |||||
| * @param type | |||||
| * @return | |||||
| */ | |||||
| public static Class<?> getTargetActivityClass(int type) { | |||||
| ArrayList<JumpBean> dataList = getHomeDataList(); | |||||
| for (JumpBean bean : dataList) { | |||||
| if (bean.getItemType() == type) { | |||||
| return bean.getTargetActivityClass(); | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| } |
| package aicare.net.cn.sdk.ailinksdkdemoandroid.home; | |||||
| import android.content.Context; | |||||
| import android.view.LayoutInflater; | |||||
| import android.view.View; | |||||
| import android.view.ViewGroup; | |||||
| import android.widget.TextView; | |||||
| import androidx.annotation.NonNull; | |||||
| import androidx.recyclerview.widget.RecyclerView; | |||||
| import java.util.ArrayList; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.R; | |||||
| /** | |||||
| * 说明: | |||||
| * | |||||
| * @author yesp | |||||
| * 2024/1/5 | |||||
| */ | |||||
| public class HomeListAdapter extends RecyclerView.Adapter<HomeListAdapter.MyHolder> { | |||||
| private Context context; | |||||
| private ArrayList<JumpBean> list; | |||||
| private ItemClickListener itemClickListener; | |||||
| public HomeListAdapter(Context context, ArrayList<JumpBean> list) { | |||||
| this.context = context; | |||||
| this.list = list; | |||||
| } | |||||
| public void setList(ArrayList<JumpBean> list) { | |||||
| this.list = list; | |||||
| } | |||||
| public void setItemClickListener(ItemClickListener itemClickListener) { | |||||
| this.itemClickListener = itemClickListener; | |||||
| } | |||||
| @NonNull | |||||
| @Override | |||||
| public MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||||
| MyHolder holder = new MyHolder(LayoutInflater.from(context).inflate(R.layout.item_home_list, parent, false)); | |||||
| holder.itemView.setOnClickListener(v -> { | |||||
| if (itemClickListener != null) { | |||||
| int position = holder.getBindingAdapterPosition(); | |||||
| if (position < 0 || position >= list.size()) { | |||||
| return; | |||||
| } | |||||
| itemClickListener.onItemClick(list.get(position)); | |||||
| } | |||||
| }); | |||||
| return holder; | |||||
| } | |||||
| @Override | |||||
| public void onBindViewHolder(@NonNull MyHolder holder, int position) { | |||||
| holder.tvContent.setText(context.getString(list.get(position).getItemNameResId())); | |||||
| } | |||||
| @Override | |||||
| public int getItemCount() { | |||||
| if (list != null && list.size() > 0) { | |||||
| return list.size(); | |||||
| } else { | |||||
| return 0; | |||||
| } | |||||
| } | |||||
| class MyHolder extends RecyclerView.ViewHolder { | |||||
| private TextView tvContent; | |||||
| public MyHolder(@NonNull View itemView) { | |||||
| super(itemView); | |||||
| tvContent = itemView.findViewById(R.id.tv_content); | |||||
| } | |||||
| } | |||||
| public interface ItemClickListener { | |||||
| /** | |||||
| * item 点击 | |||||
| * | |||||
| * @param bean bean | |||||
| */ | |||||
| void onItemClick(JumpBean bean); | |||||
| } | |||||
| } |
| package aicare.net.cn.sdk.ailinksdkdemoandroid.home; | |||||
| /** | |||||
| * 说明: | |||||
| * | |||||
| * @author yesp | |||||
| * 2024/1/5 | |||||
| */ | |||||
| public class JumpBean { | |||||
| private int itemType; | |||||
| /** | |||||
| * cid | |||||
| */ | |||||
| private int cid; | |||||
| /** | |||||
| * 显示名称 | |||||
| */ | |||||
| private int itemNameResId; | |||||
| /** | |||||
| * 需要单独跳转的 Activity | |||||
| */ | |||||
| private Class<?> jumpActivityClass; | |||||
| /** | |||||
| * 目的跳转的 Activity | |||||
| */ | |||||
| private Class<?> targetActivityClass; | |||||
| public JumpBean(int itemType, int itemNameResId, Class<?> jumpActivityClass, Class<?> targetActivityClass) { | |||||
| this.itemType = itemType; | |||||
| this.cid = itemType; | |||||
| this.itemNameResId = itemNameResId; | |||||
| this.jumpActivityClass = jumpActivityClass; | |||||
| this.targetActivityClass = targetActivityClass; | |||||
| } | |||||
| public JumpBean(int itemType, int cid, int itemNameResId, Class<?> jumpActivityClass, Class<?> targetActivityClass) { | |||||
| this.itemType = itemType; | |||||
| this.cid = cid; | |||||
| this.itemNameResId = itemNameResId; | |||||
| this.jumpActivityClass = jumpActivityClass; | |||||
| this.targetActivityClass = targetActivityClass; | |||||
| } | |||||
| public int getItemType() { | |||||
| return itemType; | |||||
| } | |||||
| public void setItemType(int itemType) { | |||||
| this.itemType = itemType; | |||||
| } | |||||
| public int getItemNameResId() { | |||||
| return itemNameResId; | |||||
| } | |||||
| public void setItemNameResId(int itemNameResId) { | |||||
| this.itemNameResId = itemNameResId; | |||||
| } | |||||
| public Class<?> getJumpActivityClass() { | |||||
| return jumpActivityClass; | |||||
| } | |||||
| public void setJumpActivityClass(Class<?> jumpActivityClass) { | |||||
| this.jumpActivityClass = jumpActivityClass; | |||||
| } | |||||
| public Class<?> getTargetActivityClass() { | |||||
| return targetActivityClass; | |||||
| } | |||||
| public void setTargetActivityClass(Class<?> targetActivityClass) { | |||||
| this.targetActivityClass = targetActivityClass; | |||||
| } | |||||
| public int getCid() { | |||||
| return cid; | |||||
| } | |||||
| public void setCid(int cid) { | |||||
| this.cid = cid; | |||||
| } | |||||
| } |
| package aicare.net.cn.sdk.ailinksdkdemoandroid.home; | |||||
| import android.Manifest; | |||||
| import android.content.Context; | |||||
| import android.content.Intent; | |||||
| import android.content.pm.PackageManager; | |||||
| import android.graphics.Canvas; | |||||
| import android.graphics.Rect; | |||||
| import android.os.Build; | |||||
| import android.os.Bundle; | |||||
| import android.view.Menu; | |||||
| import android.view.MenuItem; | |||||
| import android.view.View; | |||||
| import androidx.annotation.NonNull; | |||||
| import androidx.annotation.Nullable; | |||||
| import androidx.appcompat.app.ActionBar; | |||||
| import androidx.appcompat.app.AppCompatActivity; | |||||
| import androidx.core.app.ActivityCompat; | |||||
| import androidx.core.content.ContextCompat; | |||||
| import androidx.recyclerview.widget.LinearLayoutManager; | |||||
| import androidx.recyclerview.widget.RecyclerView; | |||||
| import com.besthealth.bhBodyComposition120.BhBodyComposition; | |||||
| import com.pingwang.bluetoothlib.AILinkBleManager; | |||||
| import com.pingwang.bluetoothlib.AILinkSDK; | |||||
| import com.pingwang.bluetoothlib.bean.AilinkLicenseBean; | |||||
| import com.pingwang.bluetoothlib.utils.BleLog; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.AboutActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.BuildConfig; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.R; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.ShowBleActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.HintDataDialogFragment; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.AppStart; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.L; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.SP; | |||||
| public class MainActivity extends AppCompatActivity { | |||||
| private Context mContext; | |||||
| private RecyclerView rvList; | |||||
| @Override | |||||
| protected void onCreate(@Nullable Bundle savedInstanceState) { | |||||
| super.onCreate(savedInstanceState); | |||||
| setContentView(R.layout.activity_main); | |||||
| mContext = this; | |||||
| initView(); | |||||
| initData(); | |||||
| initListener(); | |||||
| int bodyComposition = new BhBodyComposition().getBodyComposition(); | |||||
| L.i("bodyComposition:" + bodyComposition); | |||||
| } | |||||
| protected void initListener() { | |||||
| ActionBar supportActionBar = getSupportActionBar(); | |||||
| if (supportActionBar != null) { | |||||
| supportActionBar.setTitle(getString(R.string.app_name) + BuildConfig.VERSION_NAME); | |||||
| } | |||||
| } | |||||
| protected void initData() { | |||||
| initPermissions(); | |||||
| List<AilinkLicenseBean> list = new ArrayList<>(); | |||||
| list.add(new AilinkLicenseBean(0x2F, 0x03, 0x09)); | |||||
| list.add(new AilinkLicenseBean(0x2F, 0x03, 0x01)); | |||||
| list.add(new AilinkLicenseBean(65544, 103, 0)); | |||||
| AILinkSDK.getInstance().initLicense(list); | |||||
| } | |||||
| protected void initView() { | |||||
| BleLog.init(true); | |||||
| //connectDevice(BleValueBean bleValueBean);连接的时候需要传广播对象,否则返回的cid,vid,pid始终都是0 | |||||
| //sdk | |||||
| AILinkSDK.getInstance().init(mContext); | |||||
| AILinkBleManager.getInstance().init(mContext, new AILinkBleManager.onInitListener() { | |||||
| @Override | |||||
| public void onInitSuccess() { | |||||
| AILinkBleManager.getInstance().startScan(0); | |||||
| } | |||||
| @Override | |||||
| public void onInitFailure() { | |||||
| } | |||||
| }); | |||||
| SP.init(this); | |||||
| rvList = findViewById(R.id.rv_list); | |||||
| rvList.setLayoutManager(new LinearLayoutManager(this)); | |||||
| HomeListAdapter adapter = new HomeListAdapter(this, HomeDataManager.getHomeDataList()); | |||||
| rvList.setAdapter(adapter); | |||||
| adapter.setItemClickListener(new HomeListAdapter.ItemClickListener() { | |||||
| @Override | |||||
| public void onItemClick(JumpBean bean) { | |||||
| if (bean.getJumpActivityClass() != null) { | |||||
| startActivity(bean.getJumpActivityClass()); | |||||
| } else { | |||||
| startActivity(bean.getItemType(),bean.getCid()); | |||||
| } | |||||
| } | |||||
| }); | |||||
| rvList.addItemDecoration(new RecyclerView.ItemDecoration() { | |||||
| @Override | |||||
| public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { | |||||
| super.getItemOffsets(outRect, view, parent, state); | |||||
| if (parent.getChildAdapterPosition(view) == 0) { | |||||
| outRect.set(0, 30, 0, 0); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { | |||||
| super.onDraw(c, parent, state); | |||||
| } | |||||
| }); | |||||
| } | |||||
| private void startActivity(int type,int cid) { | |||||
| Intent intent = new Intent(this, ShowBleActivity.class); | |||||
| intent.putExtra("type", type); | |||||
| intent.putExtra("cid", cid); | |||||
| startActivity(intent); | |||||
| } | |||||
| private void startActivity(Class<?> activityClass) { | |||||
| Intent intent = new Intent(this, activityClass); | |||||
| startActivity(intent); | |||||
| } | |||||
| @Override | |||||
| protected void onResume() { | |||||
| super.onResume(); | |||||
| } | |||||
| @Override | |||||
| protected void onDestroy() { | |||||
| super.onDestroy(); | |||||
| BleLog.quit(); | |||||
| } | |||||
| @Override | |||||
| public boolean onCreateOptionsMenu(Menu menu) { | |||||
| getMenuInflater().inflate(R.menu.toolbar_menu, menu); | |||||
| return super.onCreateOptionsMenu(menu); | |||||
| } | |||||
| @Override | |||||
| public boolean onOptionsItemSelected(@NonNull MenuItem item) { | |||||
| if (item.getItemId() == R.id.toolbar_right_menu) { | |||||
| startActivity(new Intent(mContext, AboutActivity.class)); | |||||
| return true; | |||||
| } | |||||
| return super.onOptionsItemSelected(item); | |||||
| } | |||||
| //-----------------------权限---------------------------------------- | |||||
| /** | |||||
| * 需要申请的权限 | |||||
| */ | |||||
| private String[] LOCATION_PERMISSION = new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE}; | |||||
| private final static String[] BLUETOOTH_PERMISSION = new String[]{Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_ADVERTISE, Manifest.permission.BLUETOOTH_CONNECT}; | |||||
| /** | |||||
| * 权限请求返回 | |||||
| */ | |||||
| private final int PERMISSION = 101; | |||||
| /** | |||||
| * 定位服务返回 | |||||
| */ | |||||
| protected final int LOCATION_SERVER = 102; | |||||
| private HintDataDialogFragment mHintDataDialog = null; | |||||
| protected void initPermissions() { | |||||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { | |||||
| onPermissionsOk(); | |||||
| return; | |||||
| } | |||||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { | |||||
| if (ContextCompat.checkSelfPermission(this, LOCATION_PERMISSION[0]) != PackageManager.PERMISSION_GRANTED) { | |||||
| ActivityCompat.requestPermissions(this, LOCATION_PERMISSION, PERMISSION); | |||||
| } else { | |||||
| boolean bleStatus = AppStart.isLocServiceEnable(mContext); | |||||
| if (!bleStatus) { | |||||
| //没有开启定位服务 | |||||
| mHintDataDialog = HintDataDialogFragment.newInstance() | |||||
| .setTitle("提示", 0) | |||||
| .setCancel("取消", 0) | |||||
| .setOk("确定", 0) | |||||
| .setContent("请求开启定位服务", true) | |||||
| .setOnDialogListener(new HintDataDialogFragment.onDialogListener() { | |||||
| @Override | |||||
| public void onSucceedListener(View v) { | |||||
| startLocationActivity(); | |||||
| } | |||||
| }); | |||||
| mHintDataDialog.show(getSupportFragmentManager()); | |||||
| } else { | |||||
| onPermissionsOk(); | |||||
| } | |||||
| } | |||||
| } else { | |||||
| if (ContextCompat.checkSelfPermission(this, BLUETOOTH_PERMISSION[0]) != PackageManager.PERMISSION_GRANTED) { | |||||
| ActivityCompat.requestPermissions(this, BLUETOOTH_PERMISSION, PERMISSION); | |||||
| } | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |||||
| super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |||||
| //请求权限被拒绝 | |||||
| if (requestCode != PERMISSION) { | |||||
| return; | |||||
| } | |||||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { | |||||
| if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | |||||
| initPermissions(); | |||||
| } else { | |||||
| if (ActivityCompat.shouldShowRequestPermissionRationale(this, LOCATION_PERMISSION[0])) { | |||||
| //权限请求失败,但未选中“不再提示”选项,再次请求 | |||||
| ActivityCompat.requestPermissions(this, LOCATION_PERMISSION, PERMISSION); | |||||
| } else { | |||||
| //权限请求失败,选中“不再提示”选项 | |||||
| mHintDataDialog = HintDataDialogFragment.newInstance() | |||||
| .setTitle("提示", 0) | |||||
| .setCancel("取消", 0) | |||||
| .setOk("确定", 0) | |||||
| .setContent("请求开启定位权限", true) | |||||
| .setOnDialogListener(new HintDataDialogFragment.onDialogListener() { | |||||
| @Override | |||||
| public void onSucceedListener(View v) { | |||||
| AppStart.startUseSetActivity(mContext); | |||||
| } | |||||
| }); | |||||
| mHintDataDialog.show(getSupportFragmentManager()); | |||||
| } | |||||
| } | |||||
| } else { | |||||
| if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | |||||
| initPermissions(); | |||||
| } | |||||
| } | |||||
| } | |||||
| /** | |||||
| * 启动去设置定位服务 | |||||
| */ | |||||
| protected void startLocationActivity() { | |||||
| AppStart.startLocationActivity(this, LOCATION_SERVER); | |||||
| } | |||||
| /** | |||||
| * 权限ok | |||||
| */ | |||||
| protected void onPermissionsOk() { | |||||
| } | |||||
| @Override | |||||
| protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { | |||||
| super.onActivityResult(requestCode, resultCode, data); | |||||
| if (requestCode == LOCATION_SERVER) { | |||||
| //定位服务页面返回 | |||||
| initPermissions(); | |||||
| } | |||||
| } | |||||
| } |
| * | * | ||||
| * @author xing | * @author xing | ||||
| */ | */ | ||||
| public class BleDemoActivity extends BleBaseActivity { | |||||
| public class BleDemoActivity extends BleBaseActivity { | |||||
| private ListView list_view; | private ListView list_view; | ||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | mHandler.sendEmptyMessage(REFRESH_DATA); | ||||
| } | } | ||||
| if (type == CmdConfig.SET_WIFI_PAW) { | |||||
| if (type == CmdConfig.SET_WIFI_PWD) { | |||||
| mList.add("设置的密码状态 " + status); | mList.add("设置的密码状态 " + status); | ||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | mHandler.sendEmptyMessage(REFRESH_DATA); | ||||
| if (status == BodyFatDataUtil.STATUS_SUCCESS && issetMac) { | if (status == BodyFatDataUtil.STATUS_SUCCESS && issetMac) { | ||||
| if (password != null) { | if (password != null) { | ||||
| length = password.length + 1; | length = password.length + 1; | ||||
| bytes1 = new byte[length + 1]; | bytes1 = new byte[length + 1]; | ||||
| bytes1[0] = (byte) CmdConfig.SET_WIFI_PAW; | |||||
| bytes1[0] = (byte) CmdConfig.SET_WIFI_PWD; | |||||
| bytes1[1] = (byte) subpackage; | bytes1[1] = (byte) subpackage; | ||||
| System.arraycopy(password, 0, bytes1, 2, password.length); | System.arraycopy(password, 0, bytes1, 2, password.length); | ||||
| package aicare.net.cn.sdk.ailinksdkdemoandroid.modules; | |||||
| import android.content.Context; | |||||
| import android.os.Bundle; | |||||
| import android.os.Handler; | |||||
| import android.os.Looper; | |||||
| import android.os.Message; | |||||
| import android.text.TextUtils; | |||||
| import android.view.View; | |||||
| import android.widget.ArrayAdapter; | |||||
| import android.widget.Button; | |||||
| import android.widget.ListView; | |||||
| import android.widget.TextView; | |||||
| import androidx.annotation.NonNull; | |||||
| import androidx.annotation.Nullable; | |||||
| import com.pingwang.bluetoothlib.device.BleDevice; | |||||
| import com.pingwang.bluetoothlib.device.BleSendCmdUtil; | |||||
| import com.pingwang.bluetoothlib.device.SendBleBean; | |||||
| import com.pingwang.bluetoothlib.listener.CallbackDisIm; | |||||
| import com.pingwang.bluetoothlib.listener.OnBleCompanyListener; | |||||
| import com.pingwang.bluetoothlib.listener.OnBleDeviceDataListener; | |||||
| import com.pingwang.bluetoothlib.listener.OnBleVersionListener; | |||||
| import com.pingwang.bluetoothlib.listener.OnCallbackDis; | |||||
| import com.pingwang.bluetoothlib.listener.OnMcuParameterListener; | |||||
| import com.pingwang.bluetoothlib.utils.BleLog; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.R; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.DialogStringImageBean; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.MoveDataDialogFragment; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.ShowListDialogFragment; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.L; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.SP; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.utils.TimeUtils; | |||||
| import cn.net.aicare.modulelibrary.module.wifibleDevice.WifiBleDeviceData; | |||||
| import cn.net.aicare.modulelibrary.module.wifibleDevice.WifiBleInfoBean; | |||||
| /** | |||||
| * wifi ble 血压计界面 | |||||
| * | |||||
| * @author xing | |||||
| * @date 2023/10/07 | |||||
| */ | |||||
| public class PublicWifiBleOtaActivity extends BleBaseActivity implements OnCallbackDis, OnBleVersionListener, OnMcuParameterListener, OnBleCompanyListener, View.OnClickListener { | |||||
| private static String TAG = PublicWifiBleOtaActivity.class.getName(); | |||||
| private final String WIFI_BLE_SSID = "WIFI_BLE_SSID_KEY"; | |||||
| private final String WIFI_BLE_SSID_MAC = "WIFI_BLE_SSID_MAC"; | |||||
| private final String WIFI_BLE_PWD = "WIFI_BLE_PWD"; | |||||
| private final int REFRESH_DATA = 3; | |||||
| private List<String> mList; | |||||
| private ArrayAdapter listAdapter; | |||||
| private TextView tv_wifi_ssid, tv_wifi_status, tv_wifi_info; | |||||
| private Context mContext; | |||||
| private WifiBleDeviceData mWifiBleDeviceData; | |||||
| private List<DialogStringImageBean> mWifiList = new ArrayList<>(); | |||||
| private String mAddress; | |||||
| private int mType; | |||||
| private int mCid; | |||||
| private byte unit = 0; | |||||
| private String mSsid = ""; | |||||
| private String mMac = ""; | |||||
| private String mPwd = ""; | |||||
| private Handler mHandler = new Handler(Looper.getMainLooper()) { | |||||
| @Override | |||||
| public void handleMessage(Message msg) { | |||||
| if (msg.what == REFRESH_DATA) { | |||||
| if (listAdapter != null) | |||||
| listAdapter.notifyDataSetChanged(); | |||||
| } | |||||
| } | |||||
| }; | |||||
| @Override | |||||
| protected void onCreate(@Nullable Bundle savedInstanceState) { | |||||
| super.onCreate(savedInstanceState); | |||||
| setContentView(R.layout.activity_wifi_ble_ota); | |||||
| mContext = this; | |||||
| mAddress = getIntent().getStringExtra("mac"); | |||||
| mType = getIntent().getIntExtra("type", -1); | |||||
| mCid = getIntent().getIntExtra("cid", -1); | |||||
| mSsid = (String) SP.getInstance().get(WIFI_BLE_SSID, ""); | |||||
| mMac = (String) SP.getInstance().get(WIFI_BLE_SSID_MAC, ""); | |||||
| mPwd = (String) SP.getInstance().get(WIFI_BLE_PWD, ""); | |||||
| init(); | |||||
| } | |||||
| private void init() { | |||||
| mList = new ArrayList<>(); | |||||
| ListView listView = findViewById(R.id.listview); | |||||
| listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mList); | |||||
| listView.setAdapter(listAdapter); | |||||
| Button clear = findViewById(R.id.clear); | |||||
| clear.setOnClickListener(new View.OnClickListener() { | |||||
| @Override | |||||
| public void onClick(View v) { | |||||
| if (mList != null) | |||||
| mList.clear(); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| }); | |||||
| tv_wifi_ssid = findViewById(R.id.tv_wifi_ssid); | |||||
| tv_wifi_info = findViewById(R.id.tv_wifi_info); | |||||
| tv_wifi_status = findViewById(R.id.tv_wifi_status); | |||||
| findViewById(R.id.clear).setOnClickListener(this); | |||||
| findViewById(R.id.btn_wifi).setOnClickListener(this); | |||||
| findViewById(R.id.btn_read_wifi_status).setOnClickListener(this); | |||||
| findViewById(R.id.btn_start_ota).setOnClickListener(this); | |||||
| if (tv_wifi_info != null) { | |||||
| tv_wifi_info.setText(mSsid + "\n" + mPwd); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onClick(View v) { | |||||
| switch (v.getId()) { | |||||
| case R.id.clear: | |||||
| if (mList != null) | |||||
| mList.clear(); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| SP.getInstance().put(WIFI_BLE_SSID, ""); | |||||
| SP.getInstance().put(WIFI_BLE_SSID_MAC, ""); | |||||
| SP.getInstance().put(WIFI_BLE_PWD, ""); | |||||
| mSsid = ""; | |||||
| mMac = ""; | |||||
| mPwd = ""; | |||||
| if (tv_wifi_info != null) { | |||||
| tv_wifi_info.setText(""); | |||||
| } | |||||
| break; | |||||
| case R.id.btn_read_wifi_status: | |||||
| if (mWifiBleDeviceData != null) { | |||||
| mWifiBleDeviceData.getWifiCurrentState(); | |||||
| } | |||||
| break; | |||||
| case R.id.btn_start_ota: | |||||
| if (mWifiBleDeviceData != null) { | |||||
| setConnectWifi(mMac, mPwd); | |||||
| } | |||||
| break; | |||||
| case R.id.btn_wifi: | |||||
| if (mWifiBleDeviceData != null) { | |||||
| mWifiBleDeviceData.getWifiList(); | |||||
| mList.add(TimeUtils.getTime() + "正在扫描附近可用的wifi..."); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| showWifiList(); | |||||
| break; | |||||
| default: | |||||
| break; | |||||
| } | |||||
| } | |||||
| private ShowListDialogFragment mShowListDialogFragment; | |||||
| private void showWifiList() { | |||||
| if (mShowListDialogFragment == null) { | |||||
| mShowListDialogFragment = ShowListDialogFragment.newInstance(); | |||||
| mShowListDialogFragment.setList(mWifiList); | |||||
| mShowListDialogFragment.setTitle("选择WIFI"); | |||||
| mShowListDialogFragment.setCancel("取消", 0); | |||||
| mShowListDialogFragment.setOnDialogListener(new ShowListDialogFragment.onDialogListener() { | |||||
| @Override | |||||
| public void onItemListener(int position) { | |||||
| WifiBleInfoBean wifiBleInfoBean = mWifiBleInfoBeanList.get(position); | |||||
| mSsid = wifiBleInfoBean.getSsid(); | |||||
| MoveDataDialogFragment.newInstance() | |||||
| .setTitle(mSsid, "") | |||||
| .setContent("", "请输入密码", MoveDataDialogFragment.NAME) | |||||
| .setOk("OK", 0) | |||||
| .setCancel("取消", 0) | |||||
| .setOnDialogListener(new MoveDataDialogFragment.OnDialogListener() { | |||||
| @Override | |||||
| public void onSucceedListener(View v, String data) { | |||||
| mMac = wifiBleInfoBean.getMac(); | |||||
| mPwd = data.trim(); | |||||
| SP.getInstance().put(WIFI_BLE_SSID, mSsid); | |||||
| SP.getInstance().put(WIFI_BLE_SSID_MAC, mMac); | |||||
| SP.getInstance().put(WIFI_BLE_PWD, mPwd); | |||||
| setConnectWifi(mMac, mPwd); | |||||
| } | |||||
| }) | |||||
| .show(getSupportFragmentManager()); | |||||
| } | |||||
| @Override | |||||
| public void onCancelListener(View v) { | |||||
| } | |||||
| }); | |||||
| } | |||||
| mShowListDialogFragment.show(getSupportFragmentManager()); | |||||
| } | |||||
| //-------------------BLE send--------------- | |||||
| /** | |||||
| * 设置连接wifi | |||||
| * | |||||
| * @param mac mac | |||||
| * @param pwd 密码 | |||||
| */ | |||||
| private void setConnectWifi(String mac, String pwd) { | |||||
| if (mWifiBleDeviceData != null) { | |||||
| mWifiBleDeviceData.setConnectWifiMac(mac, pwd); | |||||
| mList.add(TimeUtils.getTime() + "正在连接wifi..."); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| if (tv_wifi_info != null) { | |||||
| tv_wifi_info.setText(mSsid + "\n" + mPwd); | |||||
| } | |||||
| } | |||||
| //---------------------------------服务--------------------------------------------------- | |||||
| @Override | |||||
| public void onServiceSuccess() { | |||||
| CallbackDisIm.getInstance().addListListener(this); | |||||
| BleLog.i(TAG, "服务与界面建立连接成功"); | |||||
| //与服务建立连接 | |||||
| if (mAILinkBleManager != null) { | |||||
| BleDevice bleDevice = mAILinkBleManager.getBleDevice(mAddress); | |||||
| if (bleDevice != null) { | |||||
| mWifiBleDeviceData = WifiBleDeviceData.getInstance(bleDevice); | |||||
| mWifiBleDeviceData.setOnWiFiBleCallback(new WifiBleDeviceListener()); | |||||
| bleDevice.setOnBleDeviceDataListener(new OnBleDeviceDataListener() { | |||||
| @Override | |||||
| public void onNotifyDataA6(String uuid, byte[] hex) { | |||||
| int cmd = hex[0] & 0xff; | |||||
| if (cmd == 0x91) { | |||||
| int status = hex[1] & 0xff; | |||||
| if (status == 0) { | |||||
| mList.add(TimeUtils.getTime() + "WIFI OTA成功"); | |||||
| } else if (status == 1) { | |||||
| mList.add(TimeUtils.getTime() + "WIFI OTA失败"); | |||||
| } else if (status == 2) { | |||||
| mList.add(TimeUtils.getTime() + "不支持WIFI OTA"); | |||||
| } else { | |||||
| mList.add(TimeUtils.getTime() + "模块主动开始 WIFI OTA"); | |||||
| } | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| } | |||||
| }); | |||||
| bleDevice.setOnBleVersionListener(this); | |||||
| //获取版本号 | |||||
| bleDevice.sendData(new SendBleBean(BleSendCmdUtil.getInstance().getBleVersion())); | |||||
| mWifiBleDeviceData.getWifiCurrentState(); | |||||
| mList.add(TimeUtils.getTime() + "获取版本号指令"); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onServiceErr() { | |||||
| BleLog.i(TAG, "服务与界面连接断开"); | |||||
| //与服务断开连接 | |||||
| mAILinkBleManager = null; | |||||
| } | |||||
| @Override | |||||
| public void unbindServices() { | |||||
| CallbackDisIm.getInstance().removeListener(this); | |||||
| mAILinkBleManager.disconnect(mAddress); | |||||
| } | |||||
| private void startOta() { | |||||
| mList.add(TimeUtils.getTime() + "发送开始OTA指令"); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| SendBleBean sendBleBean = new SendBleBean(); | |||||
| sendBleBean.setHex(new byte[]{(byte) 0x91, 0x01}); | |||||
| mWifiBleDeviceData.getBleDevice().sendData(sendBleBean); | |||||
| } | |||||
| //-----------------状态------------------- | |||||
| @Override | |||||
| public void onConnecting(@NonNull String mac) { | |||||
| //TODO 连接中 | |||||
| if (mAddress.equals(mac)) { | |||||
| BleLog.i(TAG, "连接中"); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onDisConnected(@NonNull String mac, int code) { | |||||
| //TODO 连接断开 | |||||
| if (mAddress.equals(mac)) { | |||||
| BleLog.i(TAG, "连接断开"); | |||||
| finish(); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onServicesDiscovered(@NonNull String mac) { | |||||
| //TODO 连接成功(获取服务成功) | |||||
| if (mAddress.equals(mac)) | |||||
| BleLog.i(TAG, "连接成功(获取服务成功)"); | |||||
| } | |||||
| @Override | |||||
| public void bleOpen() { | |||||
| } | |||||
| @Override | |||||
| public void bleClose() { | |||||
| BleLog.i(TAG, "蓝牙未开启,可请求开启"); | |||||
| finish(); | |||||
| } | |||||
| //-----------------通知------------------- | |||||
| private List<WifiBleInfoBean> mWifiBleInfoBeanList; | |||||
| private class WifiBleDeviceListener implements WifiBleDeviceData.OnWiFiBleCallback { | |||||
| /** | |||||
| * 在ble和wifi状态 | |||||
| * | |||||
| * @param bleStatus ble状态 | |||||
| * @param wifiStatus wifi状态 | |||||
| * @param workStatus 工作状态 | |||||
| */ | |||||
| @Override | |||||
| public void onBleAndWifiStatus(int bleStatus, int wifiStatus, int workStatus) { | |||||
| String wifiStatusStr = ""; | |||||
| switch (wifiStatus) { | |||||
| case 0: | |||||
| wifiStatusStr = "未配置AP"; | |||||
| break; | |||||
| case 1: | |||||
| wifiStatusStr = "连接AP失败"; | |||||
| break; | |||||
| case 2: | |||||
| wifiStatusStr = "连接的AP信号不好"; | |||||
| break; | |||||
| case 3: | |||||
| wifiStatusStr = "成功连接上AP"; | |||||
| break; | |||||
| case 4: | |||||
| wifiStatusStr = "正在连接AP"; | |||||
| break; | |||||
| } | |||||
| mList.add(TimeUtils.getTime() + "蓝牙状态:" + bleStatus + "\nwifi状态:" + wifiStatusStr + "\n工作状态:" + workStatus); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| if (tv_wifi_status != null) { | |||||
| tv_wifi_status.setText(wifiStatusStr); | |||||
| } | |||||
| if (wifiStatus == 3) { | |||||
| startOta(); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onWifiScanStatus(int status) { | |||||
| } | |||||
| @Override | |||||
| public void onConnectWifiName(String name) { | |||||
| if (tv_wifi_ssid != null) { | |||||
| tv_wifi_ssid.setText(name); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onWifiScanBean(WifiBleInfoBean wifiBleInfoBean) { | |||||
| L.i("扫描到的wifi信息:" + wifiBleInfoBean.toString()); | |||||
| } | |||||
| @Override | |||||
| public void onWifiScanFinish(List<WifiBleInfoBean> list) { | |||||
| if (mWifiBleInfoBeanList == null) { | |||||
| mWifiBleInfoBeanList = new ArrayList<>(); | |||||
| } | |||||
| mWifiBleInfoBeanList.clear(); | |||||
| mWifiList.clear(); | |||||
| for (WifiBleInfoBean wifiBleInfoBean : list) { | |||||
| String ssid = wifiBleInfoBean.getSsid(); | |||||
| if (TextUtils.isEmpty(ssid)) { | |||||
| continue; | |||||
| } | |||||
| mWifiList.add(new DialogStringImageBean(ssid, wifiBleInfoBean.getType())); | |||||
| mWifiBleInfoBeanList.add(wifiBleInfoBean); | |||||
| } | |||||
| if (mShowListDialogFragment != null) { | |||||
| mShowListDialogFragment.setList(mWifiList); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * 设置wifi名字或密码的状态回调 | |||||
| * | |||||
| * @param type 类型 | |||||
| * @param status 状态 | |||||
| */ | |||||
| @Override | |||||
| public void onSetWifiNameOrPwdOrConnectCallback(int type, int status) { | |||||
| } | |||||
| @Override | |||||
| public void onWifiConnecting(int status) { | |||||
| L.i("wifi正在连接中:" + status); | |||||
| mList.add(TimeUtils.getTime() + "wifi正在连接中..."); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| /** | |||||
| * 当前连接的wifi mac地址 | |||||
| * | |||||
| * @param mac mac | |||||
| */ | |||||
| @Override | |||||
| public void onConnectWifiMac(String mac) { | |||||
| } | |||||
| @Override | |||||
| public void onConnectWifiPwd(String pwd) { | |||||
| } | |||||
| @Override | |||||
| public void onDeviceSn(long sn) { | |||||
| //主要用于查询设备是否在服务器注册成功 | |||||
| mList.add(TimeUtils.getTime() + "设备SN号:" + sn); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| @Override | |||||
| public void onServerIp(String ip) { | |||||
| mList.add(TimeUtils.getTime() + "设备ip地址:" + ip); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| @Override | |||||
| public void onServerPort(int port) { | |||||
| mList.add(TimeUtils.getTime() + "设备端口:" + port); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| @Override | |||||
| public void onServerPath(String path) { | |||||
| mList.add(TimeUtils.getTime() + "设备路径地址:" + path); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| @Override | |||||
| public void onServerSettingInfo(boolean status) { | |||||
| mList.add(TimeUtils.getTime() + "服务器配置:" + (status ? "成功" : "失败")); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onBmVersion(String version) { | |||||
| mList.add(TimeUtils.getTime() + "版本号:" + version); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| @Override | |||||
| public void OnDID(int cid, int vid, int pid) { | |||||
| String didStr = "cid:" + cid + "||vid:" + vid + "||pid:" + pid; | |||||
| mList.add(TimeUtils.getTime() + "ID:" + didStr); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| @Override | |||||
| public void onMcuBatteryStatus(int status, int battery) { | |||||
| mList.add(TimeUtils.getTime() + "电量:" + battery + "%"); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| @Override | |||||
| public void onSysTime(int status, int[] times) { | |||||
| String time = times[0] + "-" + times[1] + "-" + times[2] + " " + times[3] + ":" + times[4] + ":" + times[5]; | |||||
| mList.add(TimeUtils.getTime() + "系统时间:" + time); | |||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||||
| } | |||||
| @Override | |||||
| protected void onDestroy() { | |||||
| super.onDestroy(); | |||||
| BleLog.i(TAG, "onDestroy"); | |||||
| } | |||||
| } |
| import aicare.net.cn.sdk.ailinksdkdemoandroid.R; | import aicare.net.cn.sdk.ailinksdkdemoandroid.R; | ||||
| public class EditParamsDialog extends DialogFragment implements View.OnClickListener { | public class EditParamsDialog extends DialogFragment implements View.OnClickListener { | ||||
| /** | /** |
| log_list = findViewById(R.id.log_list); | log_list = findViewById(R.id.log_list); | ||||
| mLogList = new ArrayList<>(); | mLogList = new ArrayList<>(); | ||||
| listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mLogList); | listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mLogList); | ||||
| log_list.setAdapter(listAdapter); | |||||
| log_list.setAdapter(listAdapter); | |||||
| mmol.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | mmol.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | ||||
| @Override | @Override | ||||
| public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| btn_probe_version.postDelayed(new Runnable() { | btn_probe_version.postDelayed(new Runnable() { | ||||
| @Override | @Override | ||||
| public void run() { | public void run() { | ||||
| mBleDevice.setMtu(247); | |||||
| mBleDevice.setMtu(517); | |||||
| } | } | ||||
| }, 200); | }, 200); | ||||
| } | } |
| mMHandler.sendEmptyMessage(ConnectWifi); | mMHandler.sendEmptyMessage(ConnectWifi); | ||||
| } | } | ||||
| } | } | ||||
| if (type == CmdConfig.DISCONNECT_WIFI) { | |||||
| if (type == CmdConfig.DIS_OR_CON_WIFI) { | |||||
| mList.add(0, "发起连接 " + status); | mList.add(0, "发起连接 " + status); | ||||
| mMHandler.sendEmptyMessage(ToRefreUi); | mMHandler.sendEmptyMessage(ToRefreUi); | ||||
| } | } |
| addText("版本号:" + version); | addText("版本号:" + version); | ||||
| } | } | ||||
| /** | |||||
| * 请求同步时间 | |||||
| * | |||||
| * @param quest 1-请求同步时间 | |||||
| */ | |||||
| // /** | |||||
| // * 请求同步时间 | |||||
| // * | |||||
| // * @param quest 1-请求同步时间 | |||||
| // */ | |||||
| // @Override | // @Override | ||||
| // public void onSyncTime(int quest) { | // public void onSyncTime(int quest) { | ||||
| // if (quest == 1) { | // if (quest == 1) { |
| package aicare.net.cn.sdk.ailinksdkdemoandroid; | |||||
| package aicare.net.cn.sdk.ailinksdkdemoandroid.modules.wifi_ble_scale; | |||||
| import android.content.Intent; | import android.content.Intent; | ||||
| import java.util.Arrays; | import java.util.Arrays; | ||||
| import java.util.List; | import java.util.List; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.R; | |||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | import aicare.net.cn.sdk.ailinksdkdemoandroid.base.BleBaseActivity; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.config.BleDeviceConfig; | import aicare.net.cn.sdk.ailinksdkdemoandroid.config.BleDeviceConfig; | ||||
| import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.DialogStringImageBean; | import aicare.net.cn.sdk.ailinksdkdemoandroid.dialog.DialogStringImageBean; | ||||
| private EditText et_ip, et_path, et_port; | private EditText et_ip, et_path, et_port; | ||||
| private TextView tv_path; | private TextView tv_path; | ||||
| private byte[] testIp = new byte[]{0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x72, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x61, 0x69, 0x63, 0x61, 0x72, 0x65, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x63, 0x6e}; | |||||
| private byte[] productIp = new byte[]{0x61, 0x69, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x69, 0x6f, 0x74, 0x2e, 0x61, 0x69, 0x63, 0x61, 0x72, 0x65, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x63, 0x6e}; | |||||
| private byte[] IpUrl = new byte[]{0x2f, 0x64, 0x65, 0x76, 0x69, 0x76, 0x63, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x64, 0x72, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x2f}; | |||||
| private boolean isTest = false; | |||||
| private ArrayList<DialogStringImageBean> mDialogList; | private ArrayList<DialogStringImageBean> mDialogList; | ||||
| private ActivityResultLauncher<Boolean> launcher; | private ActivityResultLauncher<Boolean> launcher; | ||||
| private WifiBleDeviceData mWifiBleDeviceData; | private WifiBleDeviceData mWifiBleDeviceData; | ||||
| private User selectUser; | |||||
| @Override | @Override | ||||
| protected void onCreate(@Nullable Bundle savedInstanceState) { | protected void onCreate(@Nullable Bundle savedInstanceState) { | ||||
| FileUtils.init(); | FileUtils.init(); | ||||
| mDialogList = new ArrayList<>(); | mDialogList = new ArrayList<>(); | ||||
| initLauncher(); | initLauncher(); | ||||
| selectUser = getDefault(); | |||||
| } | } | ||||
| break; | break; | ||||
| case BodyFatDataUtil.MUC_REQUEST_USER_INFO: | case BodyFatDataUtil.MUC_REQUEST_USER_INFO: | ||||
| mList.add(0, getString(R.string.measurement_status) + status + "\n" + getString(R.string.request_user_information)); | mList.add(0, getString(R.string.measurement_status) + status + "\n" + getString(R.string.request_user_information)); | ||||
| if (bodyFatBleUtilsData != null) { | |||||
| bodyFatBleUtilsData.sendData(BodyFatDataUtil.getInstance().setUserInfo(selectUser, BleDeviceConfig.WEIGHT_BODY_FAT_SCALE)); | |||||
| } | |||||
| break; | break; | ||||
| default: | default: | ||||
| mList.add(0, getString(R.string.measurement_status) + status); | mList.add(0, getString(R.string.measurement_status) + status); | ||||
| mMHandler.sendEmptyMessage(REFRESH_DATA); | mMHandler.sendEmptyMessage(REFRESH_DATA); | ||||
| } | } | ||||
| if (type == CmdConfig.SET_WIFI_PAW) { | |||||
| if (type == CmdConfig.SET_WIFI_PWD) { | |||||
| mList.add(0, getString(R.string.get_set_password_status) + status); | mList.add(0, getString(R.string.get_set_password_status) + status); | ||||
| mMHandler.sendEmptyMessage(REFRESH_DATA); | mMHandler.sendEmptyMessage(REFRESH_DATA); | ||||
| } | } | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void onDeviceSn(String sn) { | |||||
| public void onDeviceSn(long sn) { | |||||
| L.i(TAG, "设备sn: " + sn); | L.i(TAG, "设备sn: " + sn); | ||||
| mList.add(0, "sn: " + sn); | mList.add(0, "sn: " + sn); | ||||
| mMHandler.sendEmptyMessage(REFRESH_DATA); | mMHandler.sendEmptyMessage(REFRESH_DATA); |
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public void onConnectWifiPwd(String pwd) { | |||||
| } | |||||
| @Override | @Override | ||||
| public void onWifiScanBean(WifiBleInfoBean wifiBleInfoBean) { | public void onWifiScanBean(WifiBleInfoBean wifiBleInfoBean) { | ||||
| L.i("扫描到的wifi信息:" + wifiBleInfoBean.toString()); | L.i("扫描到的wifi信息:" + wifiBleInfoBean.toString()); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void onDeviceSn(String sn) { | |||||
| public void onConnectWifiPwd(String pwd) { | |||||
| } | |||||
| @Override | |||||
| public void onDeviceSn(long sn) { | |||||
| //主要用于查询设备是否在服务器注册成功 | //主要用于查询设备是否在服务器注册成功 | ||||
| mList.add("设备SN号:" + sn); | mList.add("设备SN号:" + sn); | ||||
| mHandler.sendEmptyMessage(REFRESH_DATA); | mHandler.sendEmptyMessage(REFRESH_DATA); |
| package aicare.net.cn.sdk.ailinksdkdemoandroid.utils; | |||||
| import android.annotation.SuppressLint; | |||||
| import android.app.ActivityManager; | |||||
| import android.content.Context; | |||||
| import android.content.Intent; | |||||
| import android.content.IntentFilter; | |||||
| import android.content.pm.PackageInfo; | |||||
| import android.content.pm.PackageManager; | |||||
| import android.net.Uri; | |||||
| import android.os.Build; | |||||
| import android.telephony.TelephonyManager; | |||||
| import java.io.BufferedReader; | |||||
| import java.io.IOException; | |||||
| import java.io.InputStreamReader; | |||||
| import java.util.List; | |||||
| /** | |||||
| * APP和手机信息获取工具类 | |||||
| */ | |||||
| public class AppPhoneInfoUtils { | |||||
| private AppPhoneInfoUtils() { | |||||
| /* cannot be instantiated */ | |||||
| throw new UnsupportedOperationException("cannot be instantiated"); | |||||
| } | |||||
| /** | |||||
| * 版本名--给用户看 | |||||
| */ | |||||
| public static String getVersionName(Context context) { | |||||
| PackageInfo mPackageInfo = getPackageInfo(context.getApplicationContext()); | |||||
| if (mPackageInfo != null) { | |||||
| return mPackageInfo.versionName; | |||||
| } | |||||
| return "1.0.0"; | |||||
| } | |||||
| /** | |||||
| * 版本号---主要用于程序升级检测 | |||||
| */ | |||||
| public static int getVersionCode(Context context) { | |||||
| PackageInfo mPackageInfo = getPackageInfo(context.getApplicationContext()); | |||||
| if (mPackageInfo != null) { | |||||
| return mPackageInfo.versionCode; | |||||
| } | |||||
| return 1; | |||||
| } | |||||
| private static PackageInfo getPackageInfo(Context context) { | |||||
| PackageInfo pi = null; | |||||
| try { | |||||
| PackageManager pm = context.getPackageManager(); | |||||
| pi = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_CONFIGURATIONS); | |||||
| return pi; | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return pi; | |||||
| } | |||||
| public static String getSystemVersion() { | |||||
| try { | |||||
| if (getPhoneBrand().toLowerCase().equalsIgnoreCase("xiaomi")) { | |||||
| return getMIUI(); | |||||
| } else if (getPhoneBrand().toLowerCase().equalsIgnoreCase("huawei") || getPhoneBrand().toLowerCase().equals("honor")) { | |||||
| return getEMUI(); | |||||
| } else if (getPhoneBrand().toLowerCase().equalsIgnoreCase("vivo")) { | |||||
| String[] vivo = getVivo(); | |||||
| if (vivo != null && vivo.length > 1) { | |||||
| return vivo[0] + "_" + vivo[1]; | |||||
| } | |||||
| return ""; | |||||
| } else if (getPhoneBrand().toLowerCase().equalsIgnoreCase("oppo")) { | |||||
| return getOppo(); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| return "解析错误"; | |||||
| } | |||||
| return "不是HMOV,没有做解析"; | |||||
| } | |||||
| public static String getSystemVersionString() { | |||||
| try { | |||||
| if (getPhoneBrand().toLowerCase().equalsIgnoreCase("xiaomi")) { | |||||
| return getSystemProperty("ro.miui.ui.version.name"); | |||||
| } else if (getPhoneBrand().toLowerCase().equalsIgnoreCase("huawei") || getPhoneBrand().toLowerCase().equals("honor")) { | |||||
| return getSystemProperty("ro.build.version.emui"); | |||||
| } else if (getPhoneBrand().toLowerCase().equalsIgnoreCase("vivo")) { | |||||
| return getSystemProperty("ro.vivo.os.build.display.id"); | |||||
| } else if (getPhoneBrand().toLowerCase().equalsIgnoreCase("oppo") || getPhoneBrand().toLowerCase().equals("realme")) { | |||||
| return getSystemProperty("ro.build.version.opporom"); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| return "解析错误"; | |||||
| } | |||||
| return "不是HMOV,没有做解析"; | |||||
| } | |||||
| /** | |||||
| * 获取华为手机emui版本 | |||||
| * | |||||
| * @return String | |||||
| */ | |||||
| public static String getEMUI() { | |||||
| String systemProperty = ""; | |||||
| try { | |||||
| systemProperty = getSystemProperty("ro.build.version.emui"); | |||||
| //EmotionUI_11.1.0=harmonyOS2.0 | |||||
| return systemProperty != null ? systemProperty.substring(systemProperty.indexOf("_") + 1).trim() : ""; | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return systemProperty; | |||||
| } | |||||
| /** | |||||
| * 获取小米手机版本 | |||||
| * | |||||
| * @return String | |||||
| */ | |||||
| public static String getMIUI() { | |||||
| String systemProperty = ""; | |||||
| try { | |||||
| systemProperty = getSystemProperty("ro.miui.ui.version.name"); | |||||
| return systemProperty != null ? systemProperty.substring(systemProperty.indexOf("V") + 1).trim() : ""; | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return systemProperty; | |||||
| } | |||||
| /** | |||||
| * 获取vivo手机版本 | |||||
| * | |||||
| * @return String | |||||
| */ | |||||
| public static String[] getVivo() { | |||||
| try { | |||||
| String systemProperty = getSystemProperty("ro.vivo.os.build.display.id"); | |||||
| if (systemProperty != null) { | |||||
| if (!systemProperty.contains("_")) { | |||||
| systemProperty = systemProperty.replace(" ", "_"); | |||||
| } | |||||
| return systemProperty.split("_"); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| //OriginOS 1.0 | |||||
| //Funtouch OS | |||||
| return null; | |||||
| } | |||||
| public static String getOppo() { | |||||
| //ro.build.version.opporom | |||||
| String systemProperty = ""; | |||||
| try { | |||||
| systemProperty = getSystemProperty("ro.build.version.opporom"); | |||||
| return systemProperty != null ? systemProperty.substring(systemProperty.indexOf("V") + 1).trim() : ""; | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return systemProperty; | |||||
| } | |||||
| public static String getSystemProperty(String propName) { | |||||
| String line; | |||||
| BufferedReader input = null; | |||||
| try { | |||||
| Process p = Runtime.getRuntime().exec("getprop " + propName); | |||||
| input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024); | |||||
| line = input.readLine(); | |||||
| input.close(); | |||||
| } catch (IOException ex) { | |||||
| return null; | |||||
| } finally { | |||||
| if (input != null) { | |||||
| try { | |||||
| input.close(); | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| } | |||||
| return line; | |||||
| } | |||||
| public static String getPhoneInfo() { | |||||
| return Build.MANUFACTURER +//手机厂商 | |||||
| " " + Build.MODEL; //手机型号 | |||||
| } | |||||
| public static String getBrand() { | |||||
| return Build.BRAND; | |||||
| } | |||||
| public static String getPhoneBrand() { | |||||
| return Build.MANUFACTURER;//手机厂商 | |||||
| } | |||||
| /** | |||||
| * 返回手机型号 | |||||
| */ | |||||
| public static String getPhoneModel() { | |||||
| return Build.MODEL; | |||||
| } | |||||
| /** | |||||
| * 返回手机系统版本 | |||||
| */ | |||||
| public static String getPhoneVersion() { | |||||
| return "android " + Build.VERSION.RELEASE;//系统版本; | |||||
| } | |||||
| /** | |||||
| * 读取手机电话号码 | |||||
| * | |||||
| * @param context context | |||||
| * @return 手机号, 空代表读取失败 | |||||
| */ | |||||
| @SuppressLint({"MissingPermission", "HardwareIds"}) | |||||
| public static String getPhoneNumber(Context context) { | |||||
| String phoneNumber = ""; | |||||
| try { | |||||
| TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); | |||||
| phoneNumber = telephonyManager.getLine1Number(); | |||||
| if (phoneNumber.startsWith("+86")) { | |||||
| phoneNumber = phoneNumber.substring(3); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| return phoneNumber; | |||||
| } | |||||
| return phoneNumber; | |||||
| } | |||||
| /** | |||||
| * 检测应用是否安装 | |||||
| * | |||||
| * @param context Context | |||||
| * @param packagename 包名 | |||||
| * @return boolean | |||||
| */ | |||||
| public static boolean checkMapAppsIsExist(Context context, String packagename) { | |||||
| PackageInfo packageInfo; | |||||
| try { | |||||
| packageInfo = context.getPackageManager().getPackageInfo(packagename, 0); | |||||
| } catch (Exception e) { | |||||
| packageInfo = null; | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return packageInfo != null; | |||||
| } | |||||
| /** | |||||
| * 安装apk | |||||
| */ | |||||
| public static void install(Context mContext, Uri uri) { | |||||
| Intent install = new Intent(Intent.ACTION_VIEW); | |||||
| install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | |||||
| install.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | |||||
| } | |||||
| install.setDataAndType(uri, "application/vnd.android.package-archive"); | |||||
| mContext.startActivity(install); | |||||
| } | |||||
| /** | |||||
| * 获取进程名 | |||||
| * | |||||
| * @param context 上下文 | |||||
| * @return 进程名 | |||||
| */ | |||||
| public static String getProcessName(Context context) { | |||||
| ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); | |||||
| List<ActivityManager.RunningAppProcessInfo> runningApps = am.getRunningAppProcesses(); | |||||
| if (runningApps == null) { | |||||
| return null; | |||||
| } | |||||
| for (ActivityManager.RunningAppProcessInfo proInfo : runningApps) { | |||||
| if (proInfo.pid == android.os.Process.myPid()) { | |||||
| if (proInfo.processName != null) { | |||||
| return proInfo.processName; | |||||
| } | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| /** | |||||
| * 用来判断服务是否运行. | |||||
| * | |||||
| * @param className 判断的服务名字 | |||||
| * @return true 在运行 false 不在运行 | |||||
| */ | |||||
| public static boolean isServiceRunning(Context context, String className) { | |||||
| boolean isRunning = false; | |||||
| try { | |||||
| ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); | |||||
| List<ActivityManager.RunningServiceInfo> serviceList = activityManager.getRunningServices(2000); | |||||
| if (!(serviceList.size() > 0)) { | |||||
| return false; | |||||
| } | |||||
| for (int i = 0; i < serviceList.size(); i++) { | |||||
| if (serviceList.get(i).service.getClassName().equals(className)) { | |||||
| isRunning = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| } catch (SecurityException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return isRunning; | |||||
| } | |||||
| public static int getSystemBattery(Context context) { | |||||
| int level = 0; | |||||
| Intent batteryInfoIntent = context.getApplicationContext().registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); | |||||
| level = batteryInfoIntent.getIntExtra("level", 0); | |||||
| int batterySum = batteryInfoIntent.getIntExtra("scale", 100); | |||||
| int percentBattery = 100 * level / batterySum; | |||||
| return percentBattery; | |||||
| } | |||||
| } |
| package aicare.net.cn.sdk.ailinksdkdemoandroid.utils; | package aicare.net.cn.sdk.ailinksdkdemoandroid.utils; | ||||
| import android.content.Context; | |||||
| import android.os.Handler; | |||||
| import android.os.HandlerThread; | |||||
| import android.text.TextUtils; | |||||
| import android.util.Log; | import android.util.Log; | ||||
| import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
| import com.google.gson.Gson; | |||||
| import java.io.File; | |||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.Locale; | import java.util.Locale; | ||||
| /** | /** | ||||
| * 是否开启log日志 | * 是否开启log日志 | ||||
| */ | */ | ||||
| private static boolean isLog = true; | |||||
| private static boolean isLog = false; | |||||
| private static String TAG = "TagOther"; | private static String TAG = "TagOther"; | ||||
| private static MyDiskLogStrategy myDiskLogStrategy; | |||||
| private static int MAX_BYTES = 2048 * 1024;//2M | |||||
| /** | |||||
| * 缓存行数量 | |||||
| */ | |||||
| private static int CACHE_NUMBER_LINES = 100;//list大小 | |||||
| private static HandlerThread mHandlerThread; | |||||
| private static Gson mGson; | |||||
| private static long mId = 0; | |||||
| /** | |||||
| * 获取默认日志路径,不是以/ 结尾 | |||||
| * | |||||
| * @param context 上下文 | |||||
| * @return {@link String} | |||||
| */ | |||||
| public static String getDefaultLogPath(Context context) { | |||||
| if (myDiskLogStrategy!=null) { | |||||
| myDiskLogStrategy.saveCache(); | |||||
| } | |||||
| return context.getFilesDir().getPath() + File.separatorChar + "logger"; | |||||
| } | |||||
| public static String getDefaultLogName() { | |||||
| return "logs.txt"; | |||||
| } | |||||
| /** | /** | ||||
| * 日志初始化 | * 日志初始化 | ||||
| * 注意:路径只能是内置缓存路径,否则可能会导致写入失败 | |||||
| * | * | ||||
| * @param isShowLog 是否打印日志 | * @param isShowLog 是否打印日志 | ||||
| * @param diskPath 磁盘路径 | |||||
| * @param fileName 文件名称 | |||||
| */ | */ | ||||
| public static void init(boolean isShowLog) { | |||||
| public static void init(String diskPath, String fileName, boolean isShowLog) { | |||||
| isLog = isShowLog; | isLog = isShowLog; | ||||
| mGson = new Gson(); | |||||
| mHandlerThread = new HandlerThread(TAG); | |||||
| mHandlerThread.start(); | |||||
| Handler mHandler = new MyDiskLogStrategy.WriteHandler(mHandlerThread.getLooper(), diskPath, fileName, MAX_BYTES,CACHE_NUMBER_LINES); | |||||
| myDiskLogStrategy = new MyDiskLogStrategy(mHandler); | |||||
| } | } | ||||
| /** | /** | ||||
| } | } | ||||
| public static void v(String msg) { | public static void v(String msg) { | ||||
| v(TAG, msg); | |||||
| v("", msg); | |||||
| } | } | ||||
| /** | /** | ||||
| if (isLog) { | if (isLog) { | ||||
| logContent(tag, msg, 1); | logContent(tag, msg, 1); | ||||
| } | } | ||||
| L.write(msg); | |||||
| } | |||||
| /** | |||||
| * 错误日志 | |||||
| */ | |||||
| public static void eJson(String tag, String msg, Class c) { | |||||
| e(tag, mGson.toJson(msg, c)); | |||||
| } | } | ||||
| public static void e(String msg) { | public static void e(String msg) { | ||||
| e(TAG, msg); | |||||
| e("", msg); | |||||
| } | } | ||||
| /** | /** | ||||
| } | } | ||||
| public static void w(String msg) { | public static void w(String msg) { | ||||
| w(TAG, msg); | |||||
| w("", msg); | |||||
| } | } | ||||
| public static void iJson(String msg, Class c) { | |||||
| i("", mGson.toJson(msg, c)); | |||||
| } | |||||
| /** | /** | ||||
| * 信息日志 | * 信息日志 | ||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * 信息日志 | |||||
| */ | |||||
| public static void iw(String msg) { | |||||
| iw("", msg); | |||||
| } | |||||
| /** | |||||
| * 信息日志 | |||||
| */ | |||||
| public static void iw(String tag, String msg) { | |||||
| if (isLog) { | |||||
| logContent(tag, msg, 0); | |||||
| } | |||||
| L.write(msg); | |||||
| } | |||||
| /** | |||||
| * 信息日志 | |||||
| */ | |||||
| public static void iwJson(String tag, Object msg, Class c) { | |||||
| if (isLog) { | |||||
| logContent(tag, mGson.toJson(msg, c), 0); | |||||
| } | |||||
| L.writeJson(msg, c); | |||||
| } | |||||
| public static void write(String msg) { | |||||
| logContent(msg); | |||||
| } | |||||
| public static void writeJson(Object msg, Class c) { | |||||
| write(mGson.toJson(msg, c)); | |||||
| } | |||||
| public static void iNoCode(Object msg) { | |||||
| String newMsg = "未识别的指令:" + msg; | |||||
| i("", newMsg); | |||||
| } | |||||
| public static void i(String msg) { | public static void i(String msg) { | ||||
| i(TAG, msg); | |||||
| i("", msg); | |||||
| } | } | ||||
| /** | /** | ||||
| } | } | ||||
| public static void d(String msg) { | public static void d(String msg) { | ||||
| d(TAG, msg); | |||||
| d("", msg); | |||||
| } | |||||
| /** | |||||
| * 退出写文件线程 | |||||
| */ | |||||
| public static void quit() { | |||||
| if (mHandlerThread != null) | |||||
| mHandlerThread.quit(); | |||||
| } | } | ||||
| private static void logContent(String msg) { | private static void logContent(String msg) { | ||||
| logContent("", msg, 0); | |||||
| logContent("", msg, 0, true); | |||||
| } | |||||
| /** | |||||
| * @param msg 内容 | |||||
| * @param level 0=i;1=e;2=d;3=w; | |||||
| */ | |||||
| private static void logContent(String tag, String msg, int level) { | |||||
| logContent(tag, msg, level, false); | |||||
| } | } | ||||
| * @param tag tag | * @param tag tag | ||||
| * @param msg 内容 | * @param msg 内容 | ||||
| * @param level 0=i;1=e;2=d;3=w;其他=v; | * @param level 0=i;1=e;2=d;3=w;其他=v; | ||||
| * @param isW 是否写入文件 | |||||
| */ | */ | ||||
| private static void logContent(String tag, String msg, int level) { | |||||
| StackTraceElement[] trace = Thread.currentThread().getStackTrace(); | |||||
| int methodCount = 1; | |||||
| int stackOffset = getStackOffset(trace); | |||||
| if (methodCount + stackOffset > trace.length) { | |||||
| methodCount = trace.length - stackOffset - 1; | |||||
| } | |||||
| for (int i = methodCount; i > 0; i--) { | |||||
| int stackIndex = i + stackOffset; | |||||
| if (stackIndex >= trace.length) { | |||||
| continue; | |||||
| } | |||||
| StackTraceElement element = trace[stackIndex]; | |||||
| switch (level) { | |||||
| case 0: | |||||
| Log.i(tag, getLogContent(msg, element)); | |||||
| break; | |||||
| case 1: | |||||
| Log.e(tag, getLogContent(msg, element)); | |||||
| break; | |||||
| case 2: | |||||
| Log.d(tag, getLogContent(msg, element)); | |||||
| break; | |||||
| case 3: | |||||
| Log.w(tag, getLogContent(msg, element)); | |||||
| break; | |||||
| default: | |||||
| Log.v(tag, msg); | |||||
| break; | |||||
| private static void logContent(String tag, String msg, int level, boolean isW) { | |||||
| try { | |||||
| StackTraceElement[] trace = Thread.currentThread().getStackTrace(); | |||||
| int methodCount = 1; | |||||
| int stackOffset = getStackOffset(trace); | |||||
| if (methodCount + stackOffset > trace.length) { | |||||
| methodCount = trace.length - stackOffset - 1; | |||||
| } | } | ||||
| for (int i = methodCount; i > 0; i--) { | |||||
| int stackIndex = i + stackOffset; | |||||
| if (stackIndex >= trace.length) { | |||||
| continue; | |||||
| } | |||||
| StackTraceElement element = trace[stackIndex]; | |||||
| if (isW) { | |||||
| if (myDiskLogStrategy != null) { | |||||
| myDiskLogStrategy.log(getLogContent(msg, element)); | |||||
| } | |||||
| return; | |||||
| } | |||||
| if (TextUtils.isEmpty(tag)) { | |||||
| tag = getTag(element); | |||||
| } | |||||
| switch (level) { | |||||
| case 0: | |||||
| Log.i(tag, getLogContent(msg, element)); | |||||
| break; | |||||
| case 1: | |||||
| Log.e(tag, getLogContent(msg, element)); | |||||
| break; | |||||
| case 2: | |||||
| Log.d(tag, getLogContent(msg, element)); | |||||
| break; | |||||
| case 3: | |||||
| Log.w(tag, getLogContent(msg, element)); | |||||
| break; | |||||
| default: | |||||
| Log.v(tag, msg); | |||||
| break; | |||||
| } | |||||
| } | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | } | ||||
| } | } | ||||
| private static String getTag(StackTraceElement element) { | |||||
| String tag = "Tag_" + getModuleName(element.getClassName()) + "_" + getSimpleClassName(element.getClassName()); | |||||
| return tag; | |||||
| } | |||||
| private static String getLogContent(String msg, StackTraceElement element) { | private static String getLogContent(String msg, StackTraceElement element) { | ||||
| StringBuilder builder = new StringBuilder(); | StringBuilder builder = new StringBuilder(); | ||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); | ||||
| String time = sdf.format(new Date()); | String time = sdf.format(new Date()); | ||||
| builder.append("\n") | |||||
| .append("-------------------------------------------------------\n") | |||||
| .append("|") | |||||
| .append(time) | |||||
| .append("\n") | |||||
| .append("|") | |||||
| .append(getSimpleClassName(element.getClassName())) | |||||
| .append(".") | |||||
| .append(element.getMethodName()) | |||||
| .append(" ") | |||||
| .append(" (") | |||||
| .append(element.getFileName()) | |||||
| .append(":") | |||||
| .append(element.getLineNumber()) | |||||
| .append(")") | |||||
| .append("\n") | |||||
| .append("||==>") | |||||
| .append(msg) | |||||
| .append("\n") | |||||
| builder.append("-------------------------------------------------------\n") | |||||
| .append("|").append(" ID:").append(mId++).append("\n") | |||||
| .append("|").append(time).append("\n") | |||||
| .append("|").append(getSimpleClassName(element.getClassName())).append(".").append(element.getMethodName()).append(" ").append(" (").append(element.getFileName()).append(":") | |||||
| .append(element.getLineNumber()).append(")").append("\n") | |||||
| .append("||==>").append(msg).append("\n") | |||||
| .append("-------------------------------------------------------\n"); | .append("-------------------------------------------------------\n"); | ||||
| return builder.toString(); | return builder.toString(); | ||||
| } | } | ||||
| return name.substring(lastIndex + 1); | return name.substring(lastIndex + 1); | ||||
| } | } | ||||
| private static String getModuleName(@NonNull String name) { | |||||
| String[] split = name.split("\\."); | |||||
| String moduleName = ""; | |||||
| if (split.length > 2) { | |||||
| moduleName = split[2]; | |||||
| } | |||||
| return moduleName; | |||||
| } | |||||
| } | } |
| package aicare.net.cn.sdk.ailinksdkdemoandroid.utils; | |||||
| import android.os.Handler; | |||||
| import android.os.Looper; | |||||
| import android.os.Message; | |||||
| import androidx.annotation.NonNull; | |||||
| import java.io.File; | |||||
| import java.io.FileOutputStream; | |||||
| import java.io.FileWriter; | |||||
| import java.io.IOException; | |||||
| import java.io.OutputStreamWriter; | |||||
| import java.io.RandomAccessFile; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| /** | |||||
| * Abstract class that takes care of background threading the file log operation on Android. | |||||
| * implementing classes are free to directly perform I/O operations there. | |||||
| * <p> | |||||
| * Writes all logs to the disk with CSV format. | |||||
| */ | |||||
| public class MyDiskLogStrategy { | |||||
| @NonNull | |||||
| private final Handler handler; | |||||
| public MyDiskLogStrategy(@NonNull Handler handler) { | |||||
| this.handler = checkNotNull(handler); | |||||
| } | |||||
| public void log(@NonNull String message) { | |||||
| checkNotNull(message); | |||||
| handler.sendMessage(handler.obtainMessage(1, message)); | |||||
| } | |||||
| /** | |||||
| * 保存缓存 | |||||
| */ | |||||
| public void saveCache() { | |||||
| //通知直接将缓存数据写入保存 | |||||
| handler.sendMessage(handler.obtainMessage(2, "saveCache")); | |||||
| } | |||||
| static class WriteHandler extends Handler { | |||||
| @NonNull | |||||
| private final String folder; | |||||
| private final int maxFileSize; | |||||
| private final String fileName; | |||||
| private volatile List<String> mList; | |||||
| private final int mListMax; | |||||
| WriteHandler(@NonNull Looper looper, @NonNull String folder, String fileName, int maxFileSize,int listMax) { | |||||
| super(checkNotNull(looper)); | |||||
| this.folder = checkNotNull(folder); | |||||
| this.maxFileSize = maxFileSize; | |||||
| this.fileName = fileName; | |||||
| mList=new ArrayList<>(); | |||||
| mListMax=listMax; | |||||
| } | |||||
| @SuppressWarnings("checkstyle:emptyblock") | |||||
| @Override | |||||
| public void handleMessage(@NonNull Message msg) { | |||||
| if (msg.what==1) { | |||||
| //普通的保存数据,先判断缓存 | |||||
| String content = (String) msg.obj; | |||||
| mList.add(content); | |||||
| if (mList.size()<mListMax){ | |||||
| return; | |||||
| } | |||||
| } | |||||
| FileWriter fileWriter = null; | |||||
| File logFile = getLogFile(folder, fileName); | |||||
| try { | |||||
| fileWriter = new FileWriter(logFile, true); | |||||
| // fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(logFile, true), StandardCharsets.UTF_8)); | |||||
| writeLog(fileWriter, mList); | |||||
| // writeLog(fileWriter, content); | |||||
| fileWriter.flush(); | |||||
| fileWriter.close(); | |||||
| } catch (IOException e) { | |||||
| if (fileWriter != null) { | |||||
| try { | |||||
| fileWriter.flush(); | |||||
| fileWriter.close(); | |||||
| } catch (IOException e1) { /* fail silently */ } | |||||
| } | |||||
| } | |||||
| } | |||||
| private void writeLog(@NonNull OutputStreamWriter fileWriter, List<String> list) throws IOException { | |||||
| if (list!=null) { | |||||
| StringBuilder newStr= new StringBuilder(); | |||||
| for (String s : list) { | |||||
| newStr.append(s); | |||||
| } | |||||
| writeLog(fileWriter,newStr.toString()); | |||||
| list.clear(); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * This is always called on a single background thread. | |||||
| * Implementing classes must ONLY write to the fileWriter and nothing more. | |||||
| * The abstract class takes care of everything else including close the stream and catching IOException | |||||
| * | |||||
| * @param fileWriter an instance of FileWriter already initialised to the correct file | |||||
| */ | |||||
| private void writeLog(@NonNull OutputStreamWriter fileWriter, @NonNull String content) throws IOException { | |||||
| checkNotNull(fileWriter); | |||||
| checkNotNull(content); | |||||
| fileWriter.append(content); | |||||
| } | |||||
| private File getLogFile(@NonNull String folderName, @NonNull String fileName) { | |||||
| checkNotNull(folderName); | |||||
| checkNotNull(fileName); | |||||
| File folder = new File(folderName); | |||||
| if (!folder.exists()) { | |||||
| //TODO: What if folder is not created, what happens then? | |||||
| folder.mkdirs(); | |||||
| } | |||||
| File newFile; | |||||
| newFile = new File(folder, fileName); | |||||
| if (newFile.exists()) { | |||||
| long length=newFile.length(); | |||||
| if (length > maxFileSize) { | |||||
| try { | |||||
| byte[] fileByte=new byte[maxFileSize>>1]; | |||||
| RandomAccessFile randomAccessFileIn=new RandomAccessFile(newFile,"rw"); | |||||
| randomAccessFileIn.seek((length-fileByte.length)); | |||||
| randomAccessFileIn.read(fileByte); | |||||
| randomAccessFileIn.close(); | |||||
| FileOutputStream fileOutputStream=new FileOutputStream(newFile); | |||||
| fileOutputStream.write(fileByte); | |||||
| fileOutputStream.flush(); | |||||
| fileOutputStream.close(); | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| } else { | |||||
| try { | |||||
| newFile.createNewFile(); | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| return newFile; | |||||
| } | |||||
| } | |||||
| public static <T> T checkNotNull(T obj) { | |||||
| if (obj == null) { | |||||
| throw new NullPointerException(); | |||||
| } | |||||
| return obj; | |||||
| } | |||||
| } |
| <vector android:height="24dp" android:tint="#FFFFFF" | |||||
| android:viewportHeight="24" android:viewportWidth="24" | |||||
| android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | |||||
| <path android:fillColor="@android:color/white" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/> | |||||
| </vector> |
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:width="48dp" | |||||
| android:height="48dp" | |||||
| android:viewportWidth="1024" | |||||
| android:viewportHeight="1024"> | |||||
| <path | |||||
| android:pathData="M512,981.3C253.9,981.3 42.7,770.1 42.7,512S253.9,42.7 512,42.7s469.3,211.2 469.3,469.3 -211.2,469.3 -469.3,469.3zM512,136.5c-206.5,0 -375.5,169 -375.5,375.5S305.5,887.5 512,887.5s375.5,-169 375.5,-375.5S718.5,136.5 512,136.5z" | |||||
| android:fillColor="#ffffff"/> | |||||
| <path | |||||
| android:pathData="M512,796.7a46.1,46.1 0,0 1,-46.9 -46.9V480.6A46.1,46.1 0,0 1,512 433.8a46.1,46.1 0,0 1,46.9 46.9v269.1a46.1,46.1 0,0 1,-46.9 46.9zM512,364.9a46.1,46.1 0,0 1,-46.9 -46.9v-43.8A46.1,46.1 0,0 1,512 227.3a46.1,46.1 0,0 1,46.9 46.9v43.8A47,47 0,0 1,512 364.9z" | |||||
| android:fillColor="#ffffff"/> | |||||
| </vector> |
| android:id="@+id/btnVersion" | android:id="@+id/btnVersion" | ||||
| android:layout_width="wrap_content" | android:layout_width="wrap_content" | ||||
| android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
| android:text="读版本" /> | |||||
| android:text="读版本(BM)" /> | |||||
| <Button | <Button | ||||
| android:id="@+id/btnBattery" | android:id="@+id/btnBattery" |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:orientation="vertical" android:layout_width="match_parent" | |||||
| android:layout_height="match_parent"> | |||||
| <RadioGroup | |||||
| android:id="@+id/unit" | |||||
| android:layout_below="@+id/edit_Userid" | |||||
| android:layout_width="match_parent" | |||||
| android:orientation="horizontal" | |||||
| android:layout_height="wrap_content"> | |||||
| <RadioButton | |||||
| android:id="@+id/kg" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_weight="1" | |||||
| android:text="kg"/> | |||||
| <RadioButton | |||||
| android:id="@+id/jin" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_weight="1" | |||||
| android:text="斤"/> | |||||
| <RadioButton | |||||
| android:id="@+id/st_lb" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_weight="1" | |||||
| android:text="st:lb"/> | |||||
| <RadioButton | |||||
| android:id="@+id/lb" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_weight="1" | |||||
| android:text="lb"/> | |||||
| </RadioGroup> | |||||
| <RadioGroup | |||||
| android:id="@+id/temp_unit" | |||||
| android:layout_below="@+id/edit_Userid" | |||||
| android:layout_width="match_parent" | |||||
| android:orientation="horizontal" | |||||
| android:layout_height="wrap_content"> | |||||
| <RadioButton | |||||
| android:id="@+id/c" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_weight="1" | |||||
| android:text="℃"/> | |||||
| <RadioButton | |||||
| android:id="@+id/f" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_weight="1" | |||||
| android:text="℉"/> | |||||
| </RadioGroup> | |||||
| <Button | |||||
| android:id="@+id/support_unit" | |||||
| android:text="查询支持单位" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| /> | |||||
| <ListView | |||||
| android:id="@+id/log_list" | |||||
| android:layout_marginTop="20dp" | |||||
| android:layout_below="@id/unit" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent"> | |||||
| </ListView> | |||||
| </LinearLayout> |
| android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
| android:orientation="vertical"> | android:orientation="vertical"> | ||||
| <LinearLayout | |||||
| <androidx.recyclerview.widget.RecyclerView | |||||
| android:id="@+id/rv_list" | |||||
| android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
| android:layout_height="wrap_content"> | |||||
| <TextView | |||||
| android:id="@+id/tv_app_version" | |||||
| android:layout_width="0dp" | |||||
| android:layout_weight="1" | |||||
| android:layout_height="wrap_content" | |||||
| android:padding="10dp" | |||||
| android:text="@string/version" /> | |||||
| <Button | |||||
| android:id="@+id/btn_about" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="关于我们" | |||||
| /> | |||||
| </LinearLayout> | |||||
| <ScrollView | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent"> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:orientation="vertical" | |||||
| android:padding="5dp"> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_clear_shake_hands" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:visibility="gone" | |||||
| android:text="不握手不加密" /> | |||||
| <Button | |||||
| android:id="@+id/btn_rope_skipping_set_mode" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="跳绳设置模式" /> | |||||
| <Button | |||||
| android:id="@+id/btn_broadcast_scale_weight" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="广播体重秤"/> | |||||
| <Button | |||||
| android:id="@+id/btn_meat_probe" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="食物探针"/> | |||||
| <Button | |||||
| android:id="@+id/btn_meat_probe_charger" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="探针充电盒" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_sphy" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="BLE血压计" /> | |||||
| <Button | |||||
| android:id="@+id/btn_sphy_wifi_ble" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="wifi血压计" /> | |||||
| <Button | |||||
| android:id="@+id/btn_tempgun" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="额温枪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_temp" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="体温计" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_height" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="身高仪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_lock" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:visibility="gone" | |||||
| android:text="电子锁" /> | |||||
| <Button | |||||
| android:id="@+id/btn_ad_weight" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="艾迪体脂秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_smart_mask" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="口罩" /> | |||||
| <Button | |||||
| android:id="@+id/btn_baby" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="婴儿秤" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_baby_body_fat" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="婴儿体脂两用秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_broadcast_scale" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="广播秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_broadcast_blood_oxygen" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="血氧仪" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_wifi_ble_weight" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="WiFi+Ble体脂秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_ble_weight" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="Ble体脂秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_wifi_ble_tooth" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="牙刷(wifi+ble)" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_ble" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="Ble通用设置" /> | |||||
| <Button | |||||
| android:id="@+id/btn_ble_test" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="BleTest" | |||||
| /> | |||||
| <Button | |||||
| android:id="@+id/btnConnectTest" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="BleConnectTest" | |||||
| /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_public_ble_network" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="BLE通用配网" /> | |||||
| <Button | |||||
| android:id="@+id/wifi_config" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="WIFI设备(配置wifi)" | |||||
| android:visibility="gone" | |||||
| /> | |||||
| <Button | |||||
| android:id="@+id/eight_scale" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="八极秤" /> | |||||
| <Button | |||||
| android:id="@+id/glucometer" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="血糖仪" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_ota" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="OTA通用" /> | |||||
| <Button | |||||
| android:id="@+id/btn_transmission" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="透传" /> | |||||
| <Button | |||||
| android:id="@+id/btn_bld" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="百利达" | |||||
| android:visibility="gone" /> | |||||
| <Button | |||||
| android:id="@+id/btn_bleBo" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="血氧(连接)" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_coffeeScale" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="咖啡秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_scooter" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="电滑板" /> | |||||
| <Button | |||||
| android:id="@+id/btn_shareCharger" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="共享充电器" /> | |||||
| <Button | |||||
| android:id="@+id/btn_share_socket" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="共享插座" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_broadcast_height" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="广播身高仪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_hbfs" | |||||
| android:text="身高体脂秤" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content"/> | |||||
| <Button | |||||
| android:id="@+id/btn_find" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="寻物器" /> | |||||
| <Button | |||||
| android:id="@+id/btn_4g_bs" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="4G血糖仪" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_food_temp" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="食品温度计" /> | |||||
| <Button | |||||
| android:id="@+id/btn_temp_humidity" | |||||
| android:text="温湿度计" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content"/> | |||||
| <Button | |||||
| android:id="@+id/btn_share_condom" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="共享套套机" /> | |||||
| <Button | |||||
| android:id="@+id/btn_rope_skip" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="跳绳" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_broadcast_nutrition" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="广播营养秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_ble_nutrition" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="蓝牙营养秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_toothbrush_test" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="牙刷测试" /> | |||||
| <Button | |||||
| android:id="@+id/btn_leaone_broadcast" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="LeaOne测试" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_fascia_gun" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="筋膜枪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_blood_pressure_tc" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="血压计透传" /> | |||||
| <Button | |||||
| android:id="@+id/btn_body_scale_4g" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="4G体脂秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_scooter_cm02" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="电滑板Cm02" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_temp_instrument" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="测温仪" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_mqtt_air_detector" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="MQTT空气检测仪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_air_detector" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="空气检测仪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_mqtt" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="Mqtt工具" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_wifi_ble_noise_meter" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="wifi+ble噪音计" /> | |||||
| <Button | |||||
| android:id="@+id/btn_ble_noise_meter" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="ble噪音计" /> | |||||
| <Button | |||||
| android:id="@+id/btn_weight_scale" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="体重秤"/> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_barometric_temp_humidity" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="气压温湿度计" /> | |||||
| </LinearLayout> | |||||
| </LinearLayout> | |||||
| </ScrollView> | |||||
| android:layout_height="match_parent" /> | |||||
| </LinearLayout> | </LinearLayout> |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| xmlns:app="http://schemas.android.com/apk/res-auto" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent" | |||||
| android:orientation="vertical"> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <TextView | |||||
| android:id="@+id/tv_app_version" | |||||
| android:layout_width="0dp" | |||||
| android:layout_weight="1" | |||||
| android:layout_height="wrap_content" | |||||
| android:padding="10dp" | |||||
| android:text="@string/version" /> | |||||
| <Button | |||||
| android:id="@+id/btn_about" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="关于我们" | |||||
| /> | |||||
| </LinearLayout> | |||||
| <ScrollView | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent"> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:orientation="vertical" | |||||
| android:padding="5dp"> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_clear_shake_hands" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:visibility="gone" | |||||
| android:text="不握手不加密" /> | |||||
| <Button | |||||
| android:id="@+id/btn_rope_skipping_set_mode" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="跳绳设置模式" /> | |||||
| <Button | |||||
| android:id="@+id/btn_broadcast_scale_weight" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="广播体重秤"/> | |||||
| <Button | |||||
| android:id="@+id/btn_meat_probe" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="食物探针"/> | |||||
| <Button | |||||
| android:id="@+id/btn_meat_probe_charger" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="探针充电盒" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_sphy" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="BLE血压计" /> | |||||
| <Button | |||||
| android:id="@+id/btn_sphy_wifi_ble" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="wifi血压计" /> | |||||
| <Button | |||||
| android:id="@+id/btn_tempgun" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="额温枪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_temp" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="体温计" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_height" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="身高仪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_lock" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:visibility="gone" | |||||
| android:text="电子锁" /> | |||||
| <Button | |||||
| android:id="@+id/btn_ad_weight" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="艾迪体脂秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_smart_mask" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="口罩" /> | |||||
| <Button | |||||
| android:id="@+id/btn_baby" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="婴儿秤" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_baby_body_fat" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="婴儿体脂两用秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_broadcast_scale" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="广播秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_broadcast_blood_oxygen" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="血氧仪" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_wifi_ble_weight" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="WiFi+Ble体脂秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_ble_weight" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="Ble体脂秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_wifi_ble_tooth" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="牙刷(wifi+ble)" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_ble" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="Ble通用设置" /> | |||||
| <Button | |||||
| android:id="@+id/btn_ble_test" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="BleTest" | |||||
| /> | |||||
| <Button | |||||
| android:id="@+id/btnConnectTest" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="BleConnectTest" | |||||
| /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_public_ble_network" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="BLE通用配网" /> | |||||
| <Button | |||||
| android:id="@+id/wifi_config" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="WIFI设备(配置wifi)" | |||||
| android:visibility="gone" | |||||
| /> | |||||
| <Button | |||||
| android:id="@+id/eight_scale" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="八极秤" /> | |||||
| <Button | |||||
| android:id="@+id/glucometer" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="血糖仪" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_ota" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="OTA通用" /> | |||||
| <Button | |||||
| android:id="@+id/btn_transmission" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="透传" /> | |||||
| <Button | |||||
| android:id="@+id/btn_bld" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="百利达" | |||||
| android:visibility="gone" /> | |||||
| <Button | |||||
| android:id="@+id/btn_bleBo" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="血氧(连接)" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_coffeeScale" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="咖啡秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_scooter" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="电滑板" /> | |||||
| <Button | |||||
| android:id="@+id/btn_shareCharger" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="共享充电器" /> | |||||
| <Button | |||||
| android:id="@+id/btn_share_socket" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="共享插座" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_broadcast_height" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="广播身高仪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_hbfs" | |||||
| android:text="身高体脂秤" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content"/> | |||||
| <Button | |||||
| android:id="@+id/btn_find" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="寻物器" /> | |||||
| <Button | |||||
| android:id="@+id/btn_4g_bs" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="4G血糖仪" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_food_temp" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="食品温度计" /> | |||||
| <Button | |||||
| android:id="@+id/btn_temp_humidity" | |||||
| android:text="温湿度计" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content"/> | |||||
| <Button | |||||
| android:id="@+id/btn_share_condom" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="共享套套机" /> | |||||
| <Button | |||||
| android:id="@+id/btn_rope_skip" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="跳绳" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_broadcast_nutrition" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="广播营养秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_ble_nutrition" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="蓝牙营养秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_toothbrush_test" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="牙刷测试" /> | |||||
| <Button | |||||
| android:id="@+id/btn_leaone_broadcast" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="LeaOne测试" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_fascia_gun" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="筋膜枪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_blood_pressure_tc" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="血压计透传" /> | |||||
| <Button | |||||
| android:id="@+id/btn_body_scale_4g" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="4G体脂秤" /> | |||||
| <Button | |||||
| android:id="@+id/btn_scooter_cm02" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="电滑板Cm02" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_temp_instrument" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="测温仪" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_mqtt_air_detector" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="MQTT空气检测仪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_air_detector" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="空气检测仪" /> | |||||
| <Button | |||||
| android:id="@+id/btn_mqtt" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="Mqtt工具" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_wifi_ble_noise_meter" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="wifi+ble噪音计" /> | |||||
| <Button | |||||
| android:id="@+id/btn_ble_noise_meter" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="ble噪音计" /> | |||||
| <Button | |||||
| android:id="@+id/btn_weight_scale" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="体重秤"/> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <Button | |||||
| android:id="@+id/btn_barometric_temp_humidity" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="气压温湿度计" /> | |||||
| </LinearLayout> | |||||
| </LinearLayout> | |||||
| </ScrollView> | |||||
| </LinearLayout> |
| android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
| android:gravity="center_horizontal" | android:gravity="center_horizontal" | ||||
| android:orientation="vertical" | android:orientation="vertical" | ||||
| tools:context=".MainActivity"> | |||||
| tools:context=".home.MainActivity"> | |||||
| <ScrollView | <ScrollView | ||||
| android:layout_width="match_parent" | android:layout_width="match_parent" |
| android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
| android:gravity="center_horizontal" | android:gravity="center_horizontal" | ||||
| android:orientation="vertical" | android:orientation="vertical" | ||||
| tools:context=".MainActivity"> | |||||
| tools:context=".home.MainActivity"> | |||||
| <ScrollView | <ScrollView | ||||
| android:layout_width="match_parent" | android:layout_width="match_parent" |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <RelativeLayout | |||||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent" | |||||
| android:orientation="vertical"> | |||||
| <Button | |||||
| android:id="@+id/default_try_out" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginTop="5dp" | |||||
| android:text="试用" /> | |||||
| <Button | |||||
| android:id="@+id/default_mode" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_below="@+id/sn" | |||||
| android:layout_toEndOf="@id/default_try_out" | |||||
| android:layout_marginStart="9dp" | |||||
| android:layout_marginTop="5dp" | |||||
| android:text="默认档位" /> | |||||
| <EditText | |||||
| android:id="@+id/select_gears_et" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_alignTop="@id/default_mode" | |||||
| android:layout_toEndOf="@id/default_mode" | |||||
| android:hint="时长(s),档位,档位级别" | |||||
| android:textSize="14dp" /> | |||||
| <Button | |||||
| android:id="@+id/support_unit" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_below="@+id/default_mode" | |||||
| android:layout_marginTop="5dp" | |||||
| android:text="获取支持档位" /> | |||||
| <Button | |||||
| android:id="@+id/default_time_mode" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_toEndOf="@id/support_unit" | |||||
| android:layout_below="@+id/default_mode" | |||||
| android:layout_marginTop="5dp" | |||||
| android:text="获取时长和档位" /> | |||||
| <ListView | |||||
| android:id="@+id/log_list" | |||||
| android:layout_marginTop="10dp" | |||||
| android:layout_below="@id/default_time_mode" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent"> | |||||
| </ListView> | |||||
| </RelativeLayout> |
| android:inputType="text" | android:inputType="text" | ||||
| android:maxLines="1" | android:maxLines="1" | ||||
| android:hint="IP or Url" | android:hint="IP or Url" | ||||
| android:text="47.113.114.70" /> | |||||
| android:text="ailink.iot.aicare.net.cn" /> | |||||
| <EditText | <EditText | ||||
| android:id="@+id/et_port" | android:id="@+id/et_port" | ||||
| android:inputType="number" | android:inputType="number" | ||||
| android:maxLines="1" | android:maxLines="1" | ||||
| android:hint="port" | android:hint="port" | ||||
| android:text="8092" /> | |||||
| android:text="80" /> | |||||
| <EditText | <EditText | ||||
| android:id="@+id/et_path" | android:id="@+id/et_path" | ||||
| android:layout_marginEnd="10dp" | android:layout_marginEnd="10dp" | ||||
| android:inputType="text" | android:inputType="text" | ||||
| android:maxLines="1" | android:maxLines="1" | ||||
| android:hint="path" | |||||
| android:text="/index/" /> | |||||
| android:hint="ps:/index/" | |||||
| android:text="" /> | |||||
| <LinearLayout | <LinearLayout |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| xmlns:app="http://schemas.android.com/apk/res-auto" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent" | |||||
| android:focusable="true" | |||||
| android:focusableInTouchMode="true" | |||||
| android:orientation="vertical"> | |||||
| <ScrollView | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="0dp" | |||||
| android:layout_weight="1"> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginTop="10dp" | |||||
| android:orientation="vertical"> | |||||
| <androidx.constraintlayout.widget.ConstraintLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginStart="10dp" | |||||
| android:layout_marginEnd="10dp"> | |||||
| <TextView | |||||
| android:id="@+id/tv_wifi_title" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="WIFI:" | |||||
| app:layout_constraintBottom_toBottomOf="parent" | |||||
| app:layout_constraintStart_toStartOf="parent" | |||||
| app:layout_constraintTop_toTopOf="parent" /> | |||||
| <TextView | |||||
| android:id="@+id/tv_wifi_ssid" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="" | |||||
| app:layout_constraintBottom_toBottomOf="parent" | |||||
| app:layout_constraintStart_toEndOf="@id/tv_wifi_title" | |||||
| app:layout_constraintTop_toTopOf="parent" /> | |||||
| <TextView | |||||
| android:id="@+id/tv_wifi_status" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="" | |||||
| app:layout_constraintBottom_toBottomOf="parent" | |||||
| app:layout_constraintStart_toEndOf="@id/tv_wifi_title" | |||||
| app:layout_constraintTop_toTopOf="parent" /> | |||||
| <Button | |||||
| android:id="@+id/btn_wifi" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="配网" | |||||
| app:layout_constraintEnd_toStartOf="@id/btn_read_wifi_status" | |||||
| app:layout_constraintTop_toTopOf="parent" /> | |||||
| <Button | |||||
| android:id="@+id/btn_read_wifi_status" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="读状态" | |||||
| app:layout_constraintEnd_toEndOf="parent" | |||||
| app:layout_constraintTop_toTopOf="parent" /> | |||||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||||
| <androidx.constraintlayout.widget.ConstraintLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginStart="10dp" | |||||
| android:layout_marginEnd="10dp"> | |||||
| <Button | |||||
| android:id="@+id/btn_start_ota" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="重新连接WIFI" | |||||
| app:layout_constraintStart_toStartOf="parent" | |||||
| app:layout_constraintTop_toTopOf="parent" /> | |||||
| <TextView | |||||
| android:id="@+id/tv_wifi_info" | |||||
| android:layout_width="0dp" | |||||
| android:layout_height="match_parent" | |||||
| app:layout_constraintStart_toEndOf="@id/btn_start_ota" | |||||
| app:layout_constraintEnd_toEndOf="parent" | |||||
| app:layout_constraintTop_toTopOf="parent" | |||||
| android:layout_marginStart="10dp" | |||||
| android:text="SSID:\nPWD:" | |||||
| /> | |||||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||||
| </LinearLayout> | |||||
| </ScrollView> | |||||
| <Button | |||||
| android:id="@+id/clear" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginStart="10dp" | |||||
| android:text="清空" /> | |||||
| <ListView | |||||
| android:id="@+id/listview" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="0dp" | |||||
| android:layout_weight="2" | |||||
| android:padding="10dp" | |||||
| android:stackFromBottom="true" | |||||
| android:transcriptMode="alwaysScroll"> | |||||
| </ListView> | |||||
| </LinearLayout> |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| xmlns:app="http://schemas.android.com/apk/res-auto" | |||||
| xmlns:tools="http://schemas.android.com/tools" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginStart="16dp" | |||||
| android:layout_marginEnd="16dp" | |||||
| android:layout_marginBottom="10dp" | |||||
| app:cardBackgroundColor="@color/white" | |||||
| app:cardCornerRadius="8dp" | |||||
| android:foreground="?attr/selectableItemBackground" | |||||
| app:cardElevation="0dp" | |||||
| app:contentPadding="12dp"> | |||||
| <TextView | |||||
| android:id="@+id/tv_content" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:gravity="center" | |||||
| android:textColor="@color/black" | |||||
| android:textSize="18dp" | |||||
| tools:text="item" /> | |||||
| </androidx.cardview.widget.CardView> |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| xmlns:app="http://schemas.android.com/apk/res-auto"> | |||||
| <item | |||||
| android:id="@+id/toolbar_right_menu" | |||||
| android:icon="@drawable/ic_info" | |||||
| android:title="@string/about_us" | |||||
| app:showAsAction="always" /> | |||||
| </menu> |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| xmlns:app="http://schemas.android.com/apk/res-auto"> | |||||
| <item | |||||
| android:id="@+id/toolbar_right_menu" | |||||
| android:icon="@drawable/ic_baseline_share_24" | |||||
| android:title="@string/share" | |||||
| app:showAsAction="always" /> | |||||
| </menu> |
| <string name="connecting_wifi">正在连接wifi...</string> | <string name="connecting_wifi">正在连接wifi...</string> | ||||
| <string name="cancel">取消</string> | <string name="cancel">取消</string> | ||||
| <string name="select_wifi">选择WIFI</string> | <string name="select_wifi">选择WIFI</string> | ||||
| <string name="item_ble_general_settings">Ble通用设置</string> | |||||
| <string name="item_ble_universal_distribution_network">BLE通用配网</string> | |||||
| <string name="item_ble_test">Ble test</string> | |||||
| <string name="item_ble_connect_test">Ble connect test</string> | |||||
| <string name="item_ota">OTA通用</string> | |||||
| <string name="item_penetrate">透传</string> | |||||
| <string name="item_body_fat_scale_broadcast">广播秤</string> | |||||
| <string name="item_body_fat_scale_ble">Ble体脂秤</string> | |||||
| <string name="item_body_fat_scale_4g">4G体脂秤</string> | |||||
| <string name="item_body_fat_scale_wifi_ble">WiFi+Ble体脂秤</string> | |||||
| <string name="item_body_fat_scale_eight">八极秤</string> | |||||
| <string name="item_body_fat_scale_aidi">艾迪体脂秤</string> | |||||
| <string name="item_baby_scale">婴儿秤</string> | |||||
| <string name="item_baby_body_fat_scale">婴儿体脂两用秤</string> | |||||
| <string name="item_weight_scale_ble">Ble体重秤</string> | |||||
| <string name="item_weight_scale_broadcast">广播体重秤</string> | |||||
| <string name="item_nutritional_scale_ble">蓝牙营养秤</string> | |||||
| <string name="item_nutritional_scale_broadcast">广播营养秤</string> | |||||
| <string name="item_coffee_scale">咖啡秤</string> | |||||
| <string name="item_height_body_fat_scale">身高体脂秤</string> | |||||
| <string name="item_height_measuring_ble">身高仪</string> | |||||
| <string name="item_height_measuring_broadcast">广播身高仪</string> | |||||
| <string name="item_sphygmometer_ble">BLE血压计</string> | |||||
| <string name="item_sphygmometer_wifi">wifi血压计</string> | |||||
| <string name="item_sphygmometer_penetrate">血压计透传</string> | |||||
| <string name="item_blood_glucose_meter_ble">血糖仪</string> | |||||
| <string name="item_blood_glucose_meter_4g">4G血糖仪</string> | |||||
| <string name="item_oximeter_broadcast">血氧仪(广播)</string> | |||||
| <string name="item_oximeter_ble">血氧(连接)</string> | |||||
| <string name="item_infrared_thermometer">额温枪</string> | |||||
| <string name="item_thermometer">体温计</string> | |||||
| <string name="item_auto_thermometer">测温仪</string> | |||||
| <string name="item_food_thermometer">食品温度计</string> | |||||
| <string name="item_meat_probe">食物探针</string> | |||||
| <string name="item_probe_charging_box">探针充电盒</string> | |||||
| <string name="item_toothbrush_wifi_ble">牙刷(wifi+ble)</string> | |||||
| <string name="item_toothbrush_test">牙刷测试</string> | |||||
| <string name="item_smart_mask">口罩</string> | |||||
| <string name="item_fascia_gun">筋膜枪</string> | |||||
| <string name="item_rope_skipping">跳绳</string> | |||||
| <string name="item_rope_skipping_set_mode">跳绳设置模式</string> | |||||
| <string name="item_hygrothermograph">温湿度计</string> | |||||
| <string name="item_barothermohygrograph">气压温湿度计</string> | |||||
| <string name="item_noise_meter_ble">ble噪音计</string> | |||||
| <string name="item_noise_meter_wifi_ble">wifi+ble噪音计</string> | |||||
| <string name="item_air_Detector">空气检测仪</string> | |||||
| <string name="item_scooter">电滑板</string> | |||||
| <string name="item_scooter_cm02">电滑板Cm02</string> | |||||
| <string name="item_shared_charger">共享充电器</string> | |||||
| <string name="item_shared_socket">共享插座</string> | |||||
| <string name="item_condom">共享套套机</string> | |||||
| <string name="item_finder">寻物器</string> | |||||
| <string name="item_leaone">LeaOne测试</string> | |||||
| <string name="item_no_handshake_encryption">不握手不加密</string> | |||||
| <string name="item_electronic_locks">电子锁</string> | |||||
| <string name="item_wifi_config">WIFI设备(配置wifi)</string> | |||||
| <string name="about_us">关于我们</string> | |||||
| <string name="share">分享</string> | |||||
| <string name="wifi_ble_ota_tool">WIFI+BLE OTA工具</string> | |||||
| </resources> | </resources> |
| <string name="cancel">Cancel</string> | <string name="cancel">Cancel</string> | ||||
| <string name="select_wifi">Select WIFI</string> | <string name="select_wifi">Select WIFI</string> | ||||
| <string name="item_ble_general_settings">Ble general settings</string> | |||||
| <string name="item_ble_universal_distribution_network">Ble distribution network</string> | |||||
| <string name="item_ble_test">Ble test</string> | |||||
| <string name="item_ble_connect_test">Ble connect test</string> | |||||
| <string name="item_ota">OTA</string> | |||||
| <string name="item_penetrate">Penetrate</string> | |||||
| <string name="item_body_fat_scale_broadcast">Body fat scale (Broadcast)</string> | |||||
| <string name="item_body_fat_scale_ble">Body fat scale (Ble)</string> | |||||
| <string name="item_body_fat_scale_4g">Body fat scale (4G)</string> | |||||
| <string name="item_body_fat_scale_wifi_ble">Body fat scale (WiFi+Ble)</string> | |||||
| <string name="item_body_fat_scale_eight">Eight-electrode body fat scale</string> | |||||
| <string name="item_body_fat_scale_aidi">Body fat scale (Aidi)</string> | |||||
| <string name="item_baby_scale">Baby scale</string> | |||||
| <string name="item_baby_body_fat_scale">Baby body fat scale</string> | |||||
| <string name="item_weight_scale_ble">Weight scale (Ble)</string> | |||||
| <string name="item_weight_scale_broadcast">Weight scale (Broadcast)</string> | |||||
| <string name="item_nutritional_scale_ble">Nutrition scale (Ble)</string> | |||||
| <string name="item_nutritional_scale_broadcast">Nutrition scale (Broadcast)</string> | |||||
| <string name="item_coffee_scale">Coffee scale</string> | |||||
| <string name="item_height_body_fat_scale">Height body fat scale</string> | |||||
| <string name="item_height_measuring_ble">Height meter (Ble)</string> | |||||
| <string name="item_height_measuring_broadcast">Height meter (Broadcast)</string> | |||||
| <string name="item_sphygmometer_ble">Sphygmometer (Ble)</string> | |||||
| <string name="item_sphygmometer_wifi">Sphygmometer (Wifi)</string> | |||||
| <string name="item_sphygmometer_penetrate">Sphygmometer (Penetrate)</string> | |||||
| <string name="item_blood_glucose_meter_ble">Blood pressure monitor (Ble)</string> | |||||
| <string name="item_blood_glucose_meter_4g">Blood pressure monitor (4G)</string> | |||||
| <string name="item_oximeter_broadcast">Oximeter (Broadcast)</string> | |||||
| <string name="item_oximeter_ble">Oximeter (Ble)</string> | |||||
| <string name="item_infrared_thermometer">Forehead thermometer</string> | |||||
| <string name="item_thermometer">Thermometer</string> | |||||
| <string name="item_auto_thermometer">Infrared thermometer</string> | |||||
| <string name="item_food_thermometer">Food thermometer</string> | |||||
| <string name="item_meat_probe">Meat probe</string> | |||||
| <string name="item_probe_charging_box">Probe charging box</string> | |||||
| <string name="item_toothbrush_wifi_ble">Toothbrush (wifi+ble)</string> | |||||
| <string name="item_toothbrush_test">Toothbrush test</string> | |||||
| <string name="item_smart_mask">Mask</string> | |||||
| <string name="item_fascia_gun">Fascia gun</string> | |||||
| <string name="item_rope_skipping">Skipping rope</string> | |||||
| <string name="item_rope_skipping_set_mode">Skipping rope setting mode</string> | |||||
| <string name="item_hygrothermograph">Hygrothermograph</string> | |||||
| <string name="item_barothermohygrograph">Barothermohygrograph</string> | |||||
| <string name="item_noise_meter_ble">Noise meter (ble)</string> | |||||
| <string name="item_noise_meter_wifi_ble">Noise meter (WiFi+Ble)</string> | |||||
| <string name="item_air_Detector">Air detector</string> | |||||
| <string name="item_scooter">Scooter</string> | |||||
| <string name="item_scooter_cm02">Scooter cm02</string> | |||||
| <string name="item_shared_charger">Shared charger</string> | |||||
| <string name="item_shared_socket">Shared socket</string> | |||||
| <string name="item_condom">Shared condom</string> | |||||
| <string name="item_finder">Item finder</string> | |||||
| <string name="item_leaone">LeaOne test</string> | |||||
| <string name="item_no_handshake_encryption">No handshake, no encryption</string> | |||||
| <string name="item_electronic_locks">Electronic locks</string> | |||||
| <string name="item_wifi_config">WIFI config</string> | |||||
| <string name="about_us">About us</string> | |||||
| <string name="share">Share</string> | |||||
| <string name="wifi_ble_ota_tool">WIFI+BLE OTA工具</string> | |||||
| </resources> | </resources> |