Class: EvSmartRoutingResponse

bemap.EvSmartRoutingResponse(options)

new EvSmartRoutingResponse(options)

BeNomad BeMap JavaScript API - EvSmartRoutingResponse (v1.5) Strongly-typed response parser. `fromJson()` accepts both the REST **v1.0** shape (single `journey` + `route`) and the REST **v2.0.0** shape (`journeys[]` of `{summary, events[]}`), exposing both through the same getters. Wire shapes mirror `EvSmartRoutingResponse` server-side (`bemap_idea/.../service/{v1_0_0,v2_0_0}/model/evSmartRouting/response/EvSmartRoutingResponse.java`): { logTag, journey: { distance, duration, batteryLevel, consumed, chargingTime, chargingCost, departureTime, arrivalTime, vehicle, savedCo2Emissions }, inputInfo, boundingBox, route: { stepPoints, polyline?, encodedPolyline?, events?, timeSlotWarns? } }
Parameters:
Name Type Description
options Object Parsed JSON response from the server.
Source:

Methods

(static) fromJson(json) → {bemap.EvSmartRoutingResponse}

Parse the raw JSON response into a `bemap.EvSmartRoutingResponse`.
Parameters:
Name Type Description
json Object
Source:
Returns:
Type
bemap.EvSmartRoutingResponse

getArrivalBatteryLevel() → {Number}

Remaining battery level (percent, 0-100) at the end of the trip.
Source:
Returns:
Type
Number

getBoundingBox() → {bemap.BoundingBox|null}

`bemap.BoundingBox` covering the whole journey, or `null` when absent. `fromJson` already lifts `{topLeft, bottomRight}` to a `bemap.BoundingBox`, so under normal conditions this returns a `bemap.BoundingBox`. If the BoundingBox lift failed (e.g. malformed payload), the raw JSON object is returned so callers can still inspect it.
Source:
Returns:
Type
bemap.BoundingBox | null

getChargingCost()

Source:

getChargingTime() → {Number}

Total time spent charging across all stops, in seconds.
Source:
Returns:
Type
Number

getConsumed() → {Number}

Total energy consumed across the whole journey, in kWh.
Source:
Returns:
Type
Number

getDistance() → {Number}

Distance of the whole journey, in metres.
Source:
Returns:
`0` when the journey is missing.
Type
Number

getDuration() → {Number}

Duration of the whole journey, in seconds (including charging stops).
Source:
Returns:
`0` when the journey is missing.
Type
Number

getEncodedPolyline() → {String|Array.<String>|null}

Google-encoded polyline. On a **v1** response this is a single `String`; on a **v2** response it is an `Array.` — one encoded string per ROUTE segment, since v2 splits the geometry across ROUTE events. `null` when absent.
Source:
Returns:
Type
String | Array.<String> | null

getEvents()

Source:

getJourneys()

Source:

getPolyline() → {Array.<bemap.Coordinate>}

Route polyline as an Array of `bemap.Coordinate`, or empty when the server omitted the polyline (e.g. `pl=false` in the request).
Source:
Returns:
Type
Array.<bemap.Coordinate>

getRouteConsumptions()

Source:

getSavedCo2Emissions() → {Number|null}

Saved CO2 emissions (kg), when `co2Emissions` was set in the request.
Source:
Returns:
Type
Number | null

getStepPoints() → {Array.<bemap.EvStepPoint>}

Charging stops in order along the journey, parsed into `EvStepPoint`.
Source:
Returns:
Type
Array.<bemap.EvStepPoint>

getSummary()

Source:

getTimeSlotWarnings()

Source:

getTollSumFees()

Source:

getVehicleInfo()

Source: