ManeuverMapper

open class ManeuverMapper

Maps MSDK Instruction types to Android Auto Maneuver type constants.

This mapper converts the MSDK's instruction semantic data (instruction type, maneuver type, junction type, bearing type, roundabout exit number) into Android Auto's Maneuver.TYPE_* constants used by the NavigationTemplate and instrument cluster display.

Priority-Based Cascade

The mapping uses a 4-level priority cascade. The first matching level determines the result:

  1. InstructionType special cases: STOP, roundabout, motorway, ferry, ramp

  2. JunctionType special cases: BIFURCATION (fork), EXIT_LEFT/RIGHT (off-ramp)

  3. ManeuverType basic turns: STRAIGHT, LEFT, RIGHT, SHARP, SLIGHT, U_TURN

  4. BearingType refinement: STRAIGHT + LEFT/RIGHT → KEEP_LEFT/KEEP_RIGHT

Falls back to Maneuver.TYPE_UNKNOWN for any unrecognized combination.

Workaround Note

This implementation uses Route.sheet().instructions[currentRouteInstructionIndex] to access the Instruction object during guidance. The proper approach is for the MSDK to expose the Instruction directly in InstructionsListener.onNewInstruction(). This should be updated when the MSDK provides that capability.

See also

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard

Returns the roundabout exit number from the instruction, or 0 if not applicable.

Link copied to clipboard
fun toAAManeuverType(instruction: Instruction, config: ManeuverMapperConfig = ManeuverMapperConfig()): Int

Maps an MSDK Instruction to an Android Auto Maneuver type constant.