// // AMapNaviEleBikeManager.h // AMapNaviKit // // Created by yuanmenglong on 2021/3/31. // Copyright © 2021 Amap. All rights reserved. // #import "AMapNaviTravelManager.h" #import "AMapNaviEleBikeDataRepresentable.h" @protocol AMapNaviEleBikeManagerDelegate; NS_ASSUME_NONNULL_BEGIN ///电动车骑行导航管理类 ///Electric Vehicle Riding Navigation Management @interface AMapNaviEleBikeManager : AMapNaviTravelManager #pragma mark - Singleton /** * @brief AMapNaviEleBikeManager单例. since 8.0.0 * AMapNaviEleBikeManager singleton * @return AMapNaviEleBikeManager实例 * AMapNaviEleBikeManager instance */ + (instancetype)sharedInstance; /** * @brief 销毁AMapNaviEleBikeManager单例. since 8.0.0 * Destroy AMapNaviEleBikeManager singleton * @return 是否销毁成功. 如果返回NO,请检查单例是否被强引用 * Whether the destruction was successful. If NO is returned, please check if the singleton is strongly referenced */ + (BOOL)destroyInstance; /** * @brief 请使用单例替代. since 8.0.0 init已被禁止使用,请使用单例 [AMapNaviEleBikeManager sharedInstance] 替代 * Please use singleton instead. Since 8.0.0, init has been deprecated, please use the singleton [AMapNaviEleBikeManager sharedInstance] instead. */ - (instancetype)init __attribute__((unavailable("Since 8.0.0, init has been deprecated, please use the singleton [AMapNaviEleBikeManager sharedInstance] instead"))); #pragma mark - Delegate ///实现了 AMapNaviRideManagerDelegate 协议的类指针 ///Class pointer implementing the AMapNaviRideManagerDelegate protocol @property (nonatomic, weak) id delegate; #pragma mark - Data Representative /** * @brief 增加用于展示导航数据的DataRepresentative.注意:该方法不会增加实例对象的引用计数(Weak Reference) * Add the DataRepresentative used to display navigation data. Note: This method will not increase the reference count of the instance object (Weak Reference) * @param aRepresentative 实现了 AMapNaviRideDataRepresentable 协议的实例 * An instance that implements the AMapNaviRideDataRepresentable protocol */ - (void)addDataRepresentative:(id)aRepresentative; /** * @brief 移除用于展示导航数据的DataRepresentative * Remove the DataRepresentative used to display navigation data * @param aRepresentative 实现了 AMapNaviRideDataRepresentable 协议的实例 * An instance that implements the AMapNaviRideDataRepresentable protocol */ - (void)removeDataRepresentative:(id)aRepresentative; /** * @brief 增加用于接收导航回调事件的Listener, 效果等同于delegate. 注意:该方法不会增加实例对象的引用计数(Weak Reference). since 9.0.1 * Add a Listener to receive navigation callback events, which is equivalent to a delegate. Note: This method does not increase the reference count of the instance object (Weak Reference) * @param aListener 实现了 AMapNaviRideManagerDelegate 协议的实例 * An instance that implements the AMapNaviRideManagerDelegate protocol */ - (void)addEventListener:(id)aListener; /** * @brief 移除用于接收导航回调事件的Listener. since 9.0.1 * Remove the Listener used to receive navigation callback events * @param aListener 实现了 AMapNaviRideManagerDelegate 协议的实例 * An instance that implements the AMapNaviRideManagerDelegate protocol */ - (void)removeEventListener:(id)aListener; #pragma mark - Navi Route ///当前导航路径的ID ///The ID of the current navigation path @property (nonatomic, readonly) NSInteger naviRouteID; ///当前导航路径的信息,参考 AMapNaviRoute 类. ///The information of the current navigation path, refer to the AMapNaviRoute class @property (nonatomic, readonly, nullable) AMapNaviRoute *naviRoute; /** * @brief 多路径规划时的所有路径信息 since 8.0.0 * All path information during multi-path planning * @return 返回多路径规划时的所有路径ID和路线信息 * Returns all path IDs and route information during multi-path planning */ - (NSDictionary *)naviRoutes; /** * @brief 多路径规划时的所有路径ID,路径ID为 NSInteger 类型 since 8.0.0 * All path IDs during multi-path planning, where path IDs are of type NSInteger * @return 返回多路径规划时的所有路径ID * Returns all path IDs during multi-path planning */ - (NSArray *)naviRouteIDs; /** * @brief 多路径规划时选择路径.注意:该方法仅限于在开始导航前使用,开始导航后该方法无效 since 8.0.0 * Select route during multi-path planning.Note: This method can only be used before starting navigation and becomes invalid after navigation begins * @param routeID 路径ID * Route ID * @return 是否选择路径成功 * Whether route selection is successful */ - (BOOL)selectNaviRouteWithRouteID:(NSInteger)routeID; ///卫星定位信号强度类型,参考 AMapNaviGPSSignalStrength. 注意:只有导航中获取卫星定位信号强弱的值有效 ///Satellite positioning signal strength type, refer to AMapNaviGPSSignalStrength. Note: only the value obtained during navigation is valid. @property (nonatomic, assign, readonly) AMapNaviGPSSignalStrength gpsSignalStrength; #pragma mark - Calculate Route // 以下算路方法需要高德坐标(GCJ02) // The following routing methods require Amap coordinates(GCJ02) /** * @brief 不带起点的电动车骑行路径规划 * Electric bike route planning without a starting point * @param endPoint 终点坐标. * Destination coordinates * @return 规划路径所需条件和参数校验是否成功,不代表算路成功与否 * Whether the conditions and parameters required for route planning are successfully verified does not indicate whether the route calculation is successful */ - (BOOL)calculateEleBikeRouteWithEndPoint:(AMapNaviPoint *)endPoint; /** * @brief 带起点的电动车骑行路径规划 * Electric bike route planning with a starting point * @param startPoint 起点坐标. * Starting point coordinates * @param endPoint 终点坐标. * Destination coordinates * @return 规划路径所需条件和参数校验是否成功,不代表算路成功与否 * Whether the conditions and parameters required for route planning are successfully verified does not indicate whether the route calculation is successful */ - (BOOL)calculateEleBikeRouteWithStartPoint:(AMapNaviPoint *)startPoint endPoint:(AMapNaviPoint *)endPoint; /** * @brief 根据高德POIInfo进行电动车骑行路径规划. since 8.0.0 * Plan electric bike routes based on Amap POIInfo * @param startPOIInfo 起点POIInfo, 参考 AMapNaviPOIInfo. 如果以“我的位置”作为起点,请传nil. 如果startPOIInfo不为nil,那么POIID合法,优先使用ID参与算路,否则使用坐标点 * Starting point POIInfo, refer to AMapNaviPOIInfo. If 'My Location' is used as the starting point, please pass nil. If startPOIInfo is not nil, then the POIID is valid, and the ID is used for route calculation first; otherwise, the coordinate point is used * @param endPOIInfo 终点POIInfo, 参考 AMapNaviPOIInfo. 如果POIID合法,优先使用ID参与算路,否则使用坐标点. 注意:POIID和坐标点不能同时为空 * Destination POIInfo, refer to AMapNaviPOIInfo. If the POIID is valid, prioritize using the ID for route calculation; otherwise, use the coordinate point. Note: POIID and coordinate point cannot be empty simultaneously. * @param strategy 路径的计算策略,参考 AMapNaviTravelStrategy. * Route calculation strategy, refer to AMapNaviTravelStrategy * @return 规划路径所需条件和参数校验是否成功,不代表算路成功与否 * Whether the conditions and parameters required for route planning are successfully verified does not indicate whether the route calculation is successful */ - (BOOL)calculateEleBikeRouteWithStartPOIInfo:(nullable AMapNaviPOIInfo *)startPOIInfo endPOIInfo:(nonnull AMapNaviPOIInfo *)endPOIInfo strategy:(AMapNaviTravelStrategy)strategy; /** * @brief 根据高德POIInfo进行电动车骑行路径规划. since 10.1.111 * Plan electric bike routes based on Amap POIInfo * @param startPOIInfo 起点POIInfo, 参考 AMapNaviPOIInfo. 如果以“我的位置”作为起点,请传nil. 如果startPOIInfo不为nil,那么POIID合法,优先使用ID参与算路,否则使用坐标点 * Starting point POIInfo, refer to AMapNaviPOIInfo. If 'My Location' is used as the starting point, please pass nil. If startPOIInfo is not nil, then the POIID is valid, and the ID is used for route calculation first; otherwise, the coordinate point is used * @param endPOIInfo 终点POIInfo, 参考 AMapNaviPOIInfo. 如果POIID合法,优先使用ID参与算路,否则使用坐标点. 注意:POIID和坐标点不能同时为空 * Destination POIInfo, refer to AMapNaviPOIInfo. If the POIID is valid, prioritize using the ID for route calculation; otherwise, use the coordinate point. Note: POIID and coordinate point cannot be empty simultaneously. * @param strategy 路径的计算策略,参考 AMapNaviTravelStrategy. * Route calculation strategy, refer to AMapNaviTravelStrategy * @param callback 算路结果回调。一次算路,routeResult 中的 routeRequestId 与 算路成功、算路失败接口中返回的 routeRequestId 一致 * Route calculation result callback. For a single route calculation, the routeRequestId in the routeResult is consistent with the routeRequestId returned by the route success and route failure interfaces. * @return 规划路径所需条件和参数校验是否成功,不代表算路成功与否 * Whether the conditions and parameters required for route planning are successfully verified does not indicate whether the route calculation is successful */ - (BOOL)calculateEleBikeRouteWithStartPOIInfo:(nullable AMapNaviPOIInfo *)startPOIInfo endPOIInfo:(nonnull AMapNaviPOIInfo *)endPOIInfo strategy:(AMapNaviTravelStrategy)strategy callback:(nullable void (^)(AMapNaviCalculateRouteResult *_Nullable routeResult))callback; /** * @brief 独立算路能力接口,可用于不干扰本次导航的单独算路场景. since 8.0.0 * Independent routing capability interface, which can be used for standalone routing scenarios without interfering with the current navigation * @param startPOIInfo 起点POIInfo, 参考 AMapNaviPOIInfo. 如果以“我的位置”作为起点,请传nil. 如果startPOIInfo不为nil,那么POIID合法,优先使用ID参与算路,否则使用坐标点 * Starting point POIInfo, refer to AMapNaviPOIInfo. If 'My Location' is used as the starting point, please pass nil. If startPOIInfo is not nil, then the POIID is valid, and the ID is used for route calculation first; otherwise, the coordinate point is used * @param endPOIInfo 终点POIInfo, 参考 AMapNaviPOIInfo. 如果POIID合法,优先使用ID参与算路,否则使用坐标点. 注意:POIID和坐标点不能同时为空 * Destination POIInfo, refer to AMapNaviPOIInfo. If the POIID is valid, prioritize using the ID for route calculation; otherwise, use the coordinate point. Note: POIID and coordinate point cannot be empty simultaneously. * @param strategy 路径的计算策略,参考 AMapNaviTravelStrategy. * Route calculation strategy, refer to AMapNaviTravelStrategy * @param callback 算路完成的回调. 算路成功时,routeGroup 不为空;算路失败时,error 不为空,error.code参照 AMapNaviCalcRouteState. * Callback for route calculation completion. When the route calculation is successful, routeGroup is not empty; when it fails, error is not empty, and error.code refers to AMapNaviCalcRouteState. * @return 规划路径所需条件和参数校验是否成功,不代表算路成功与否 * Whether the conditions and parameters required for route planning are successfully verified does not indicate whether the route calculation is successful */ - (BOOL)independentCalculateEleBikeRouteWithStartPOIInfo:(nullable AMapNaviPOIInfo *)startPOIInfo endPOIInfo:(nonnull AMapNaviPOIInfo *)endPOIInfo strategy:(AMapNaviTravelStrategy)strategy callback:(nullable void (^)(AMapNaviRouteGroup *_Nullable routeGroup, NSError *_Nullable error))callback; /** * @brief 导航过程中重新规划路径(起点为当前位置,终点位置不变) * Re-planning the route during navigation (starting from the current location with the destination unchanged) * @return 重新规划路径所需条件和参数校验是否成功, 不代表算路成功与否,如非导航状态下调用此方法会返回NO. * The success of the conditions and parameter validation required for re-planning the route does not indicate whether the route calculation is successful. Calling this method outside of navigation will return NO. */ - (BOOL)recalculateEleBikeRoute; /** * @brief 导航过程中重新规划路径(起点为当前位置,终点位置不变)。since 10.1.111 * Re-planning the route during navigation (starting from the current location with the destination unchanged) * @param callback 算路结果回调。一次算路,routeResult 中的 routeRequestId 与 算路成功、算路失败接口中返回的 routeRequestId 一致 * Route calculation result callback. For a single route calculation, the routeRequestId in the routeResult is consistent with the routeRequestId returned by the route success and route failure interfaces. * @return 重新规划路径所需条件和参数校验是否成功, 不代表算路成功与否,如非导航状态下调用此方法会返回NO. * The success of the conditions and parameter validation required for re-planning the route does not indicate whether the route calculation is successful. Calling this method outside of navigation will return NO. */ - (BOOL)recalculateEleBikeRouteWithCallback:(nullable void (^)(AMapNaviCalculateRouteResult *_Nullable routeResult))callback; #pragma mark - Manual /** * @brief 开发者请根据实际情况设置外界此时是否正在进行语音播报. since 8.0.0 * Developers, please set whether external voice broadcast is currently ongoing based on the actual situation * @param playing 如果外界正在播报语音,传入YES,否则传入NO. * If external voice broadcast is ongoing, pass YES, otherwise pass NO */ - (void)setTTSPlaying:(BOOL)playing; @end #pragma mark - AMapNaviRideManagerDelegate @protocol AMapNaviEleBikeManagerDelegate @optional /** * @brief 发生错误时,会调用代理的此方法 * When an error occurs, this method of the delegate will be called * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class * @param error 错误信息 * Error message */ - (void)rideManager:(AMapNaviEleBikeManager *)eleBikeManager error:(NSError *)error; /** * @brief 骑行路径规划成功后的回调函数 * Callback function after successful cycling route planning * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class */ - (void)rideManagerOnCalculateRouteSuccess:(AMapNaviEleBikeManager *)eleBikeManager; /** * @brief 骑行路径规划成功后的回调函数。since 10.1.111 * Callback function after successful cycling route planning * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class */ - (void)rideManagerOnCalculateRouteSuccess:(AMapNaviEleBikeManager *)eleBikeManager calculateRouteResult:(AMapNaviCalculateRouteResult *)calculateRouteResult; /** * @brief 骑行路径规划失败后的回调函数. 从6.1.0版本起,算路失败后导航SDK只对外通知算路失败,SDK内部不再执行停止导航的相关逻辑.因此,当算路失败后,不会收到 driveManager:updateNaviMode: 回调; AMapNaviRideManager.naviMode 不会切换到 AMapNaviModeNone 状态, 而是会保持在 AMapNaviModeGPS or AMapNaviModeEmulator 状态 * Callback function after failed cycling route planning. Starting from version 6.1.0, the navigation SDK only notifies external parties of route calculation failure, and the SDK no longer executes the logic related to stopping navigation internally. Therefore, after the route calculation fails, the driveManager:updateNaviMode: callback will not be received. AMapNaviRideManager.naviMode will not switch to AMapNaviModeNone state, but will remain in AMapNaviModeGPS or AMapNaviModeEmulator state. * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class * @param error 错误信息,error.code参照AMapNaviCalcRouteState * Error message, error.code refers to AMapNaviCalcRouteState. */ - (void)rideManager:(AMapNaviEleBikeManager *)eleBikeManager onCalculateRouteFailure:(NSError *)error; /** * @brief 骑行路径规划失败后的回调函数. 从6.1.0版本起,算路失败后导航SDK只对外通知算路失败,SDK内部不再执行停止导航的相关逻辑.因此,当算路失败后,不会收到 driveManager:updateNaviMode: 回调; AMapNaviRideManager.naviMode 不会切换到 AMapNaviModeNone 状态, 而是会保持在 AMapNaviModeGPS or AMapNaviModeEmulator 状态。since 10.1.111 * Callback function after failed cycling route planning. Starting from version 6.1.0, the navigation SDK only notifies external parties of route calculation failure, and the SDK no longer executes the logic related to stopping navigation internally. Therefore, after the route calculation fails, the driveManager:updateNaviMode: callback will not be received. AMapNaviRideManager.naviMode will not switch to AMapNaviModeNone state, but will remain in AMapNaviModeGPS or AMapNaviModeEmulator state. * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class * @param error 错误信息,error.code参照AMapNaviCalcRouteState * Error message, error.code refers to AMapNaviCalcRouteState. */ - (void)rideManager:(AMapNaviEleBikeManager *)eleBikeManager onCalculateRouteFailure:(NSError *)error calculateRouteResult:(AMapNaviCalculateRouteResult *)calculateRouteResult; /** * @brief 启动导航后回调函数 * Callback function after starting navigation * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class * @param naviMode 导航类型,参考AMapNaviMode * Navigation type, refer to AMapNaviMode */ - (void)rideManager:(AMapNaviEleBikeManager *)eleBikeManager didStartNavi:(AMapNaviMode)naviMode; /** * @brief 停止导航后回调函数. since 10.1.300 * @param eleBikeManager 电动车骑行导航管理类 * @param isStopped 是否停止导航成功 */ - (void)rideManager:(AMapNaviEleBikeManager *)eleBikeManager didStopNavi:(BOOL)isStopped; /** * @brief 出现偏航需要重新计算路径时的回调函数.偏航后将自动重新路径规划,该方法将在自动重新路径规划前通知您进行额外的处理. * The callback function when a deviation occurs and the path needs to be recalculated. After the deviation, the path will be automatically replanned, and this method will notify you to perform additional processing before the automatic replanning. * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class */ - (void)rideManagerNeedRecalculateRouteForYaw:(AMapNaviEleBikeManager *)eleBikeManager; /** * @brief 导航播报信息回调函数 * Navigation broadcast information callback function * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class * @param soundString 播报文字 * Broadcast text * @param soundStringType 播报类型,参考 AMapNaviSoundType. 注意:since 6.0.0 AMapNaviSoundType 只返回 AMapNaviSoundTypeDefault * Broadcast type, refer to AMapNaviSoundType. Note: since 6.0.0 AMapNaviSoundType only returns AMapNaviSoundTypeDefault */ - (void)rideManager:(AMapNaviEleBikeManager *)eleBikeManager playNaviSoundString:(NSString *)soundString soundStringType:(AMapNaviSoundType)soundStringType; /** * @brief 模拟导航到达目的地停止导航后的回调函数 * Callback function after simulated navigation reaches the destination and stops navigation * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class */ - (void)rideManagerDidEndEmulatorNavi:(AMapNaviEleBikeManager *)eleBikeManager; /** * @brief 导航到达目的地后的回调函数 * Callback function after navigation reaches the destination * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class */ - (void)rideManagerOnArrivedDestination:(AMapNaviEleBikeManager *)eleBikeManager; /** * @brief 卫星定位信号强弱回调函数. since 7.4.0 * Callback function for satellite positioning signal strength * @param eleBikeManager 电动车骑行导航管理类 * Electric bike riding navigation management class * @param gpsSignalStrength 卫星定位信号强度类型,参考 AMapNaviGPSSignalStrength . * Satellite positioning signal strength type, refer to AMapNaviGPSSignalStrength. */ - (void)rideManager:(AMapNaviEleBikeManager *)eleBikeManager updateGPSSignalStrength:(AMapNaviGPSSignalStrength)gpsSignalStrength; @end NS_ASSUME_NONNULL_END