| @@ -7,8 +7,8 @@ android { | |||
| applicationId "aicare.net.cn.sdk.ailinksdkdemoandroid" | |||
| minSdkVersion 19 | |||
| targetSdkVersion 29 | |||
| versionCode 11 | |||
| versionName "1.9.8" | |||
| versionCode 15 | |||
| versionName "1.10.2" | |||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||
| } | |||
| buildTypes { | |||
| @@ -35,9 +35,9 @@ dependencies { | |||
| implementation 'androidx.appcompat:appcompat:1.2.0' | |||
| implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | |||
| testImplementation 'junit:junit:4.12' | |||
| implementation 'com.github.elinkthings:AILinkSDKRepositoryAndroid:1.9.8'//蓝牙核心库 | |||
| implementation 'com.github.elinkthings:AILinkSDKRepositoryAndroid:1.10.2'//蓝牙核心库 | |||
| implementation 'com.github.elinkthings:AILinkSDKOtaLibraryAndroid:1.0.3'//OTA库,需要依赖核心库 | |||
| implementation 'com.github.elinkthings:AILinkSDKParsingLibraryAndroid:1.6.6'//蓝牙解析库 | |||
| implementation 'com.github.elinkthings:AILinkSDKParsingLibraryAndroid:1.6.8'//蓝牙解析库 | |||
| implementation 'androidx.recyclerview:recyclerview:1.1.0' | |||
| implementation 'com.jakewharton:butterknife:10.2.0' | |||
| annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0' | |||
| @@ -160,7 +160,7 @@ public class BleCmdActivity extends BleBaseActivity implements OnCallbackBle, On | |||
| break; | |||
| case R.id.btnHandshake: | |||
| if (mBleDevice != null) { | |||
| mBleDevice.setHandshakeStatus(true); | |||
| mBleDevice.setHandshake(true); | |||
| // mBleDevice.sendHandshake(); | |||
| mList.add(TimeUtils.getTime() + "发送握手"); | |||
| mHandler.sendEmptyMessage(REFRESH_DATA); | |||
| @@ -469,8 +469,9 @@ public class BleCmdActivity extends BleBaseActivity implements OnCallbackBle, On | |||
| return; | |||
| } | |||
| String data = ""; | |||
| if (hex != null) | |||
| if (hex != null) { | |||
| data = BleStrUtils.byte2HexStr(hex); | |||
| } | |||
| if (type == 100) { | |||
| mList.add(TimeUtils.getTime() + "cid=" + type + "\nsend->" + data); | |||
| } else { | |||
| @@ -0,0 +1,74 @@ | |||
| package aicare.net.cn.sdk.ailinksdkdemoandroid.utils; | |||
| import com.elinkthings.toothscore.ToothScoreUtil; | |||
| /** | |||
| * @author xing<br> | |||
| * @date 2022/11/10<br> | |||
| * 牙刷工具类 | |||
| */ | |||
| public class ToothBrushUtils { | |||
| private ToothScoreUtil mToothScoreUtil; | |||
| /** | |||
| * 刷牙时长得分 | |||
| * | |||
| * @param defalutTime 默认时长 | |||
| * @param totaltime 刷牙时长 | |||
| * @return int | |||
| */ | |||
| public int getDurationGrade(int defalutTime, int totaltime){ | |||
| if (mToothScoreUtil==null){ | |||
| mToothScoreUtil=new ToothScoreUtil(); | |||
| } | |||
| return mToothScoreUtil.getDurationGrade(defalutTime,totaltime); | |||
| } | |||
| /** | |||
| * 范围得分 | |||
| * | |||
| * @param defalutTime 默认时长 | |||
| * @param lTime 左边刷牙时长 | |||
| * @param rTime 右边刷牙时长 | |||
| * @return int | |||
| */ | |||
| public int getRangeGrade(int defalutTime, int lTime, int rTime){ | |||
| if (mToothScoreUtil==null){ | |||
| mToothScoreUtil=new ToothScoreUtil(); | |||
| } | |||
| return mToothScoreUtil.getRangeGrade(defalutTime,lTime,rTime); | |||
| } | |||
| /** | |||
| * 均匀度得分 | |||
| * | |||
| * @param defalutTime 默认时长 | |||
| * @param lTime 左边刷牙时长 | |||
| * @param rTime 右边刷牙时长 | |||
| * @return int | |||
| */ | |||
| public int getAvgGrade(int defalutTime, int lTime, int rTime){ | |||
| if (mToothScoreUtil==null){ | |||
| mToothScoreUtil=new ToothScoreUtil(); | |||
| } | |||
| return mToothScoreUtil.getAvgGrade(defalutTime,lTime,rTime); | |||
| } | |||
| /** | |||
| * 获取总分 | |||
| * | |||
| * @param defalutTime 默认时长 | |||
| * @param totalTime 刷牙时长 | |||
| * @param lTime 左边刷牙时长 | |||
| * @param rTime 右边刷牙时长 | |||
| * @return int | |||
| */ | |||
| public int getGrade(int defalutTime, int totalTime, int lTime, int rTime){ | |||
| if (mToothScoreUtil==null){ | |||
| mToothScoreUtil=new ToothScoreUtil(); | |||
| } | |||
| return mToothScoreUtil.getGrade(defalutTime,totalTime,lTime,rTime); | |||
| } | |||
| } | |||