-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.1","enabled":true,"outputFile":"IcL02WorkService_V59_202106201614_release.apk","fullName":"IcL02WorkServiceRelease","baseName":"IcL02WorkService-release"},"path":"IcL02WorkService_V59_202106201614_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.1","enabled":true,"outputFile":"IcL02WorkService_V59_202106301150_release.apk","fullName":"IcL02WorkServiceRelease","baseName":"IcL02WorkService-release"},"path":"IcL02WorkService_V59_202106301150_release.apk","properties":{}}]
\ No newline at end of file
* and return values in AIDL.
*/
void updatePedCount(int count);
+ void updateCalorie(float count);
void updatePedRecord(in List<RecordParcelable> record);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(PedCountEvent event) {
if (pedProcess != null) {
- pedProcess.sendPedCount(event.getPedCount());
+ pedProcess.sendPedCount(event.getPedCount(),event.getCalorie());
}
if (akProcess != null) {
public class PedCountEvent {
private int pedCount;
+ private float calorie;
- public PedCountEvent(int count) {
+ public float getCalorie() {
+ return calorie;
+ }
+
+ public void setCalorie(float calorie) {
+ this.calorie = calorie;
+ }
+
+ public PedCountEvent(int count, float calorie) {
this.pedCount = count;
+ this.calorie = calorie;
}
public int getPedCount() {
return entity;
}
- private String getCalorieValue(int number) {
+ protected String getCalorieValue(int number) {
BigDecimal bg = new BigDecimal(PedUtil.calcConsumeEnergy(mHeight, mWeight, number));
String value = String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
//保存一份到数据库中
import com.ic.work.event.PedCountEvent;
import com.ic.work.event.TaskFinishedEvent;
import com.ic.work.utils.HardwareUtils;
+import com.ic.work.utils.ICLogger;
import com.ic.work.utils.IcLog;
import org.greenrobot.eventbus.EventBus;
int ped = HardwareUtils.getNdkStepCountValue();
IcLog.i(TAG, "Get Ped Count" + ped);
//发送给主线程。主线更新数据UI
- EventBus.getDefault().post(new PedCountEvent(ped));
+ String calorieValue = getCalorieValue(ped);
+ try {
+ ICLogger.d("calorieValue == > " + calorieValue);
+ float calorie = Float.parseFloat(calorieValue);
+ EventBus.getDefault().post(new PedCountEvent(ped, calorie));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
updateCountDB(ped, getOffsetDateTime());
//add by TrillGates notify task finished.
EventBus.getDefault().post(new TaskFinishedEvent());
import com.ic.aidl.ped.RecordParcelable;
import com.ic.work.event.PedSettingEvent;
import com.ic.work.event.ThreadPoolEvent;
+import com.ic.work.utils.ICLogger;
import com.ic.work.utils.IcLog;
import org.greenrobot.eventbus.EventBus;
}
};
- public void sendPedCount(int count) {
+ public void sendPedCount(int count, float calorie) {
int N = 0;
try {
N = mCallbacks.beginBroadcast();
for (int i = 0; i < N; i++) {
mCallbacks.getBroadcastItem(i).updatePedCount(count);
+ //卡路里分发一下
+ //换算一下
+ ICLogger.d(count + " calorie == > " + calorie);
+ mCallbacks.getBroadcastItem(i).updateCalorie(calorie);
}
} catch (NullPointerException e) {
IcLog.e(TAG, "", e);
IcLog.e(TAG, "", ll);
}
}
+
}
public void sendPedRecord(List<RecordParcelable> record) {