void TraingModel::stop_heart_gps() {
if (gpsopen == true) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "开始关闭GPS定位服务...");
- // 关闭gps
- #if defined(SUPPORT_GNSS)
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "调用gnss_stop()关闭GPS服务");
- gnss_stop();
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gnss_stop()调用完成");
- #endif
+ // 关闭gps
+#if defined(SUPPORT_GNSS)
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "调用gnss_stop()关闭GPS服务");
+ GraphicService::GetInstance()->PostGraphicEvent([]() {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "异步执行gnss_stop()");
+ gnss_stop();
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gnss_stop()调用完成");
+ });
+#endif
//关闭心率检测
#ifdef SUPPORT_PPG_SERVICE
if (gps_timer_count < 2) {
return;
}
- if (gps_timer_count == 2) {
- #if defined(SUPPORT_GNSS)
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "开启gps");
- gnss_start();
- #endif
- }
+ if (gps_timer_count == 2) {
+#if defined(SUPPORT_GNSS)
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "开启gps");
+ GraphicService::GetInstance()->PostGraphicEvent([]() {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "异步执行gnss_start()");
+ gnss_start();
+ });
+#endif
+ }
#if defined(SUPPORT_GNSS)
gps_data_t send_gps_data = {0};
gps_data_t *gps_data = getPGPSGlobaldata();