public static interface Debug.InstructionListener
Modifier and Type | Method and Description |
---|---|
void |
onInstruction(org.json.JSONObject nextInstruction)
Callback with a new instruction or an update to an instruction.
|
void onInstruction(org.json.JSONObject nextInstruction)
nextInstruction
- The next instructionFormat of the returned JSON
{ current_instruction : { instruction_id : "<running id for the instructions>", instruction : { driving_side : "right|left", type : "turn|departure|arrival|arrival_waypoint|road_change|follow_lane|direction_info", junction_type : "regular|roundabout|bifurcation", angle : "<turn angle (-180 - 180)>", roundabout_exit : "<exit number from roundabout>", offset : "<offset on the trip>" distance : "<distance to instruction>" }, road : { type : "regular|freeway|ferry|toll|unpaved|hov|noncommercial_vehicles", name : "<name of road>", number : "<road number>" }, display_hint : { instruction : "straight|bear_left|left|sharp_left|u_turn_left|bear_right|etc...", distance : { value : "<value>", unit : "<units>" } } }, next_instruction : { "<data for the following instruction (if present), contains the same format as the 'current_instruction'>" }, combined_display_hint : { junction_type : "regular|roundabout|bifurcation|bifurcation_multi_carriageway", instruction : "straight|bear_left|left|sharp_left|u_turn_left|bear_right|etc...", show_road_info : "true|false" distance : { value : "<value>", unit : "<units>" } } }
The message consists of three elements
current_instruction
—
The data for the current instruction.
next_instruction
—
The data for the following instruction.
This element has the same format as the current_instruction
element.
combined_display_hint
—
Contains simplified data that matches the StockNavApp implementation on the screen.
For example; an interpretation of a 90 degree angle as a simple 'right
'.
Or any combined instructions where applicable (e.g. 'right_then_left
').
Also contains the distance to the current instruction (rounded and localised to the units matching the StockNavApp implementation).
current_instruction (and next_instruction)
instruction_id
—
Unique ID for each new instruction (but not necessarily sequential).
If an instruction changes, the same ID will be used and only the updates will be sent.
instruction
—
Contains detailed info about the instruction:
driving_side
— Driving side of the road (right|left)
.type
— Type of instruction (turn|departure|arrival|arrival_waypoint|road_change|follow_lane|direction_info)
.junction_type
— Type of junction of the instruction (regular|roundabout|bifurcation)
.angle
— The angle of the instruction (-180 - 180)
.roundabout_exit
— The exit number from the roundabout (where applicable).offset
— Offset along the trip (in metres).distance
— Distance to the instruction (in metres).road
—
Road information for the instruction.
Contains road-number, road-name and the road-type (regular|freeway|ferry|toll|unpaved|hov|noncommercial_vehicles)
.
display_hint
—
Contains simplified data and distance for the instruction.
Note this does not contained any combined instructions, but only info about the enclosing instruction.
The possible values for the instruction
element are the same as the instruction
element
in the combined_display_hint
(apart from the combined ones).
combined_display_hint
— Should be used in conjunction with the road-info from the current_instruction
.
junction_type
—
The type of junction for the current instruction (regular|roundabout|bifurcation|bifurcation_multi_carriageway)
.
instruction
—
Simplified instruction for the current instruction
(straight|bear_left|bear_right|left|right|sharp_left|sharp_right|u_turn_left|u_turn_right|
arrival|arrival_waypoint|arrival_track_start|left_then_arrival|left_then_arrival_track_start|
left_then_left|left_then_right|right_then_arrival|right_then_arrival_track_start|right_then_left|
right_then_right|ferry|freeway|left_then_ferry|right_then_ferry|left_then_freeway|
right_then_freeway|second_left|third_left|second_right|third_right)
.
show_road_info
—
An indication whether the road-info should be shown on the screen or not (true|false)
.
distance
—
Distance to the current instruction.
Contains the rounded value and the localised units.