resUpdateGoGPSUpBodyListWithHeaderPeakIndoor function
void
resUpdateGoGPSUpBodyListWithHeaderPeakIndoor(
- Pointer<
PERIPHERAL_GOGPS_HEADER_V2> pGogpsHeader, - Pointer<
PERIPHERAL_GOGPS_BODY_PEAK_INDOOR> pGoGPSBody, - int size,
- int bHeaderUpdated,
Implementation
void resUpdateGoGPSUpBodyListWithHeaderPeakIndoor(
Pointer<PERIPHERAL_GOGPS_HEADER_V2> pGogpsHeader,
Pointer<PERIPHERAL_GOGPS_BODY_PEAK_INDOOR> pGoGPSBody,
int size,
int bHeaderUpdated) {
updateGoGpsHeader(CLCmdGogpsHeaderV2.from(pGogpsHeader.ref), bHeaderUpdated);
for (int i = 0; i < size; i ++) {
var body = pGoGPSBody[i];
for (int j = 0; j < GOGPS_BODY_ENTRY_NUM; j ++) {
var entry = body.gpsDataIndoor[j];
double speed = 0;
double deltaDistance = 0;
int elapsed = entry.secIndex - GoGpsParam.mlLastSecIndex;
deltaDistance = entry.distance - GoGpsParam.mfGOGPSPreDis;
if (deltaDistance < 0) {
deltaDistance = 0;
}
if (elapsed > 0) {
speed = deltaDistance / elapsed;
}
int bodytimestamp = body.timestamp;
slog('resUpdateGoGPSUpBodyListWithHeaderPeakIndoor body.timestamp is $bodytimestamp');
int timestmp = body.timestamp + entry.secIndex;
slog('resUpdateGoGPSUpBodyListWithHeaderPeakIndoor out timestamp is $timestmp');
CLCmdGoGpsUpStreamData.subject.add(CLCmdGoGpsUpStreamData.from(
pGogpsHeader.ref, entry, timestmp, body.type, deltaDistance, speed));
GoGpsParam.mlLastSecIndex = entry.secIndex;
GoGpsParam.mfGOGPSPreDis = entry.distance.toDouble();
}
}
slog('resUpdateGoGPSUpBodyListWithHeaderPeakIndoor: entered');
}