applicationId "aicare.net.cn.sdk.ailinksdkdemoandroid" | applicationId "aicare.net.cn.sdk.ailinksdkdemoandroid" | ||||
minSdkVersion 19 | minSdkVersion 19 | ||||
targetSdkVersion 29 | targetSdkVersion 29 | ||||
versionCode 11 | |||||
versionName "1.9.8" | |||||
versionCode 15 | |||||
versionName "1.10.2" | |||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||||
} | } | ||||
buildTypes { | buildTypes { | ||||
implementation 'androidx.appcompat:appcompat:1.2.0' | implementation 'androidx.appcompat:appcompat:1.2.0' | ||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | ||||
testImplementation 'junit:junit:4.12' | 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: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 'androidx.recyclerview:recyclerview:1.1.0' | ||||
implementation 'com.jakewharton:butterknife:10.2.0' | implementation 'com.jakewharton:butterknife:10.2.0' | ||||
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0' | annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0' |
break; | break; | ||||
case R.id.btnHandshake: | case R.id.btnHandshake: | ||||
if (mBleDevice != null) { | if (mBleDevice != null) { | ||||
mBleDevice.setHandshakeStatus(true); | |||||
mBleDevice.setHandshake(true); | |||||
// mBleDevice.sendHandshake(); | // mBleDevice.sendHandshake(); | ||||
mList.add(TimeUtils.getTime() + "发送握手"); | mList.add(TimeUtils.getTime() + "发送握手"); | ||||
mHandler.sendEmptyMessage(REFRESH_DATA); | mHandler.sendEmptyMessage(REFRESH_DATA); | ||||
return; | return; | ||||
} | } | ||||
String data = ""; | String data = ""; | ||||
if (hex != null) | |||||
if (hex != null) { | |||||
data = BleStrUtils.byte2HexStr(hex); | data = BleStrUtils.byte2HexStr(hex); | ||||
} | |||||
if (type == 100) { | if (type == 100) { | ||||
mList.add(TimeUtils.getTime() + "cid=" + type + "\nsend->" + data); | mList.add(TimeUtils.getTime() + "cid=" + type + "\nsend->" + data); | ||||
} else { | } else { |
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); | |||||
} | |||||
} |