{"version":"0.1.0","code":"0000","result":true,"message":"处理成功","errdetail":"","timestamp":1671516346841,"data":{"id":71714075,"title":"5.3.3.17 续航功能","slug":"qtepn1","format":"lake","bookId":26046811,"body":null,"body_draft":null,"body_html":"

背景介绍

续航功能主要用于断电后客户下次启动时能快速获取断电前的路线信息以提升用户体验,主要有以下2种场景

SDK保存断电前的POI信息,断电后下次启动能重新规划当前坐标点到原目的地的路线

SDK保存断电前的路线信息,断电后下次启动快速还原出原始的路线信息


>=610版本,AutoSDK的GuideService接口提供了封装内聚好的续航功能接口。

区别于HMI根据路线解码接口自行实现续航功能:《路线的保存和还原》

HMI可根据自身需求,决定自行实现,或者使用SDK封装内聚好的续航接口。

本篇文档主要介绍封装内聚好的续航接口功能。


特别注意:对接了多屏一致性的项目,不可使用此功能,,强行开启是无效的,请严格按照文档时序进行实现:
《路线的保存和还原》
《续航路线一致性同步》

场景图

\"image.png\"

普通续航

时序图


核心接口

路径设置

需要可读写的目录,建议放在私有目录

//设置保存位置,需要可读写的目录\ncom.autonavi.gbl.common.model.WorkPath; // 对continueNavi成员变量赋值,路径需要确保可读可写\n//初始化时传入\nint com.autonavi.gbl.common.model.TbtCommonControl.init(WorkPath path, UserConfig cfg);

开关设置

包含续航总开关和服务区续航开关,续航总开关开启代表普通续航开启,服务区续航开关需要独立开启;

// 引导模块的续航参数\ncom.autonavi.gbl.guide.model.guidecontrol.ContinueParam;\n// 引导模块的参数设置接口\nboolean com.autonavi.gbl.guide.GuideService.setParam(Param param);

服务区续航回调

//进入服务区通知普通续航开始\nvoid com.autonavi.gbl.guide.observer.IContinueGuideInfoObserver.continueGuideStartNotify()\n//离开服务区通知退出续航\nvoid com.autonavi.gbl.guide.observer.IContinueGuideInfoObserver.exitContinueGuideNotify()

路线设置

算路成功后,HMI先保存下来二进制数据,当收到服务区续航回调通知时,设置给SDK进行路线数据保存至文件中

//设置算路结果后的二进制buffer给sdk,用于重启后还原成路线信息PathInfo\nint com.autonavi.gbl.guide.GuideService.setPathData(CalcRouteResultData CalcRoutedata, RouteRestorationResultData restorationRouteData, long mainPathIdx)

NaviPahtInfo获取

断电启动后获取NaviPathInfo信息

int com.autonavi.gbl.guide.GuideService.getContinueGuidePath(ContinueGuidePath continuePath)


示例代码

普通续航

/******** 初始化阶段 ********/\nWorkPath workPath;\nworkPath.continueNavi = xxx; //设置续航文件保存位置,需要可读写的目录\n...\n//workPath其他参数填写,参照前序文档《TBT服务初始化》\n...\nTbtCommonControl tbtCommonControl = TbtCommonControl.getInstance();\ntbtCommonControl.init(workPath, userConfig);\n\n// 获取定位服务mPosService,略。\n// 获取算路服务mRouteService,略。\n// 获取引导服务mGuideService,略。\n\n//添加续航观察者\nmGuideService.addContinueInfoObserver(IContinueInfoObserver);\n\n//开启续航开关\nContinueParam param;\n//设置续航的开关\nparam.enableContinue = True; //续航总开关,开启默认打开普通续航\nparam.enableSapaContinue = True; //服务区续航开关,true则打开服务区续航\nmGuideService.setParam(param);\n\n//发起在线算路并缓存算路结果后的二进制buffer\nmRouteService.requestRoute(RouteOption routeOption);\nIRouteResponseObserver.onNewRoute(PathResultData pathResultData, ArrayList<PathInfo> pathInfoList, RouteLimitInfo routeLimitInfo);\n\n//开始导航\nmGuideService.startNavi(int type=NaviTypeGPS)\nmGuideService.setNaviPath(NaviPathInfo);\n\n//仅开启普通续航,但未开启服务区续航,则无需任何操作,也不会收到任何服务区续航回调\n....\n\n/***** 服务区续航阶段 *********/\n//收到服务区续航通知\nIContinueInfoObserver.continueGuideStartNotify();\n//设置缓存的路线数据给sdk,并传入对应的主路线Index\nmGuideService.setPathData(pathResultData.calcRouteResultData,\n                        null,\n                        0);\n\n//监听保存定位信号的经纬度信息\nIPosLocInfoObserver.onLocInfoUpdate(LocInfo pstLocInfo);\n//缓存当前经纬度和角度heading信息即可\npstLocInfo.gpsPos,pstLocInfo.gpsCourse\n\n//离开服务区退出续航通知\nIContinueInfoObserver.exitContinueGuideNotify();\n//清除缓存中的经纬度及角度信息\n\n\n/********** 断电重启阶段 *************/\n\n\n/********普通续航场景************/\n//仅使用缓存的途经点及目的地poi进行算路\n\n//获取navipathInfo中的途经点及终点信息\nNaviPathInfo naviPathInfo = mGuideService.getContinueGuideNaviPath();\nPOIForRequest poiForRequest = naviPathInfo.getPoiRequest();\nPOI startPoi;//需要使用当前定位信号的poi信息组织\n//终点使用缓存的poi信息\nRouteRequestParam routeRequestParam = new RouteRequestParam(startPoi, poiForRequest.endPoi);\nRouteModule.requestRoute(routeRequestParam,new IRouteResultCallBack());\nIRouteResultCallBack.onNewRoute(PathResultData pathResultData, ArrayList<PathInfo> pathInfoList, RouteLimitInfo routeLimitInfo);\n//获取pathInfo信息并通知sdk进行绘制\nBizGuideRouteControl.setPathInfos(pathInfoList,0);//指定第几条路线进行绘制\nBizGuideRouteControl.updatePaths()\n    \n\n/********服务区续航场景**********/\n//使用缓存的path信息进行路线描绘,无需重新算路\n\n//使用hmi缓存的断电前的位置及调度信息设置sdk\nmPosService.setContextPos(gpsPos,gpsCourse);\n\n//获取缓存的naviPathInfo信息\nNaviPathInfo naviPathInfo = mGuideService.getContinueGuideNaviPath();\n//获取pathInfo信息并通知sdk进行绘制\nBizGuideRouteControl.setPathInfos(naviPathInfo.getVecPaths(),naviPathInfo.getMainIdx);\nBizGuideRouteControl.updatePaths();\n\n\n/*******开始导航阶段(普通续航和服务区续航都要) *******/\nGuideService.startNavi();\nGuideService.setNaviPath(naviPathInfo);\n

注意点

NaviPathInfo使用注意事项

","body_lake":null,"pub_level":null,"status":"0","updated_at":"2022-04-06 07:03:28","deleted_at":null,"nameSpace":"mnlcaa/v610","browseCount":111,"collectCount":0,"estimateDate":9,"docStatus":0,"permissions":true,"overView":false}}