References (iOS)

TripResponseStatus

TripResponseStatus indicates if the analyzed trip by the DriveQuant servers is valid or not (see status property) and provides information on the analysis result:

public class TripResponseStatus: NSObject {
    public let status: TripResponseStatusType
    public let itinId: String?
    public let localTripId: String?
    public let hasSafetyAndEcoDrivingScore: Bool
    public let info: [TripResponseInfo]
    public let error: TripResponseError?
    
    public func getTrip() -> Trip?
}
Attribute
Type
Description

status

TripResponseStatusType

Can be tripValid or tripError. - tripValid means that the analyzed trip is valid. - tripError means that the trip has been analyzed but an error occurred and data is not valid.

itinId

String?

The id of the trip if status equals tripValid, otherwise nil.

localTripId

String?

Local and unique trip identifier generated by DriveKit SDK

⚠️ It is different from the itinId property returned in the Trip object.

hasSafetyAndEcoDrivingScore

Bool

If false, it means that the trip is valid but too short to be analyzed. In this case, there is no safety or eco-driving score. It cannot be equals to true if status is not tripValid.

info

If status equals tripValid, the DriveQuant servers returns a list of information codes. These are not errors.

error

If status equals tripError, error gives you more information about the error that occurred.

This object also provides a method, getTrip(), to retrieve from the local database the saved Trip if status is equal to tripValid. In case of error, this method returns nil.

TripResponseInfo

Value
Description

engineSpeedNotAvailable

The engine speed is not available. The trip analysis is performed with an estimated value of the engine speed.

engineSpeedIsNull

The engine speed is always at 0 rpm while the vehicle is moving. The trip analysis is performed but with an estimated value of the engine speed.

noVehicleCharacteristics

The vehicle characteristics are not set or some values are missing. The trip analysis is performed with generic vehicle model parameters.

dataLoss

More than 25% of data loss is detected during the trip.

distanceTooShort

The trip was analysed but the distance is not sufficient to provide an accurate energy analysis.

invalidVehicleCharacteristics

The vehicle characteristics are not in the range of available values. See vehicle characteristics for range limits.

invalidVehicleId

No vehicle found for the vehicleId provided to the API request.

TripResponseError

Value
Description

noAccountSet

The account block is not set in the trip data.

noRouteObjectFound

The route block is not available in the trip data.

invalidRouteDefinition

Error when parsing the route block

noVelocityData

The vehicle or GPS velocity is not available

invalidSamplingPeriod

The input variables have an invalid acquisition period.

invalidCustomerId

Unknown account value. Unauthorised access.

noDateFound

The field vehicleDate or gpsDate is not available.

maxDailyRequestNumberReached

The trip could not be analyzed because you exceeded your daily request quota.

dataError

The service failed to process your data. There is a need to diagnose your data to determine the origin of this problem.

invalidRouteVectors

The route vectors are not of the same size, the service cannot perform the analysis

missingBeacon

The beacon has not been detected and it is required to validate the trip analysis.

invalidBeacon

A beacon was detected during the trip but it does not have the correct identifiers

duplicateTrip

The duplicate trip feature is enabled and the trip has already been analysed

insufficientGpsData

The number of GPS points is too low

userDisabled

The driver is disabled, the service cannot perform the analysis

invalidUser

The user identifier is not valid.

invalidGpsData

The dates are inconstistent, the service cannot perform the analysis

invalidTrip

The trip has already been analysed by the service and considered as invalid

accountLimitReached

The maximum number of user account reached for the customer

Trip

Field
Type
Description

itinId

String?

Trip unique identifier.

endDate

Date?

The end date of the trip.

startDate

Date?

The start date of the trip.

vehicleId

String?

The identifier of the vehicle used for this trip, if known.

transportationMode

Int32

The transportation mode used for this trip, see Transportation Mode for the description of the possible values.

declaredTransportationMode

DeclaredTransportationMode?

The transportation mode declared by the user. See DeclaredTransportationMode.

departureCity

String?

The city of the departure of the trip.

arrivalCity

String?

The city of the arrival of the trip.

departureAddress

String?

The full address of the departure of the trip.

arrivalAddress

String?

The full address of the arrival of the trip.

unscored

Bool

true if has no safety and eco-driving score.

metadata

Dictionary<String, String>?

Your specific data attached to the trip. See Custom metadata.

tripStatistics

TripStatistics?

Indicators that characterize the trip conditions. See ItineraryStatistics.

brakeWear

BrakeWear?

tireWear

TireWear?

ecoDriving

EcoDriving?

ecoDrivingContexts

NSSet<EcoDrivingContext>?

fuelEstimation

FuelEstimation?

fuelEstimationContexts

NSSet<FuelEstimationContext>?

safety

Safety?

See Safety.

safetyContexts

NSSet<SafetyContext>?

safetyEvents

NSSet<SafetyEvents>?

driverDistraction

DriverDistraction?

pollutants

Pollutants?

speedingStatistics

DBSpeedingStatistics?

speedLimitContexts

NSSet<DBSpeedLimitContext>?

calls

NSSet<Call>?

energyEstimation

DBEnergyEstimation?

advancedEnergyEstimation

NSSet<DBAdvancedEnergyEstimation>?

DeclaredTransportationMode

The user has the possibility to declare the transportation mode that was used during a trip to confirm the one detected or to change it, and to declare whether the trip was made as a passenger or as the driver.

Here is the description of the corresponding object:

Field
Type
Description

transportationMode

Int32

The transportation mode declared by the user for this trip. See Transportation Mode for the description of the possible values.

passenger

Boolean?

true if the trip was made as a passenger, false if the trip was made as the driver.

comment

String?

The comment associated to this declaration.

DKTripRecordingStartedState

This object is returned in the TripListener's tripRecordingStarted() callback.

Field
Type
Description

localTripId

String

Local and unique trip identifier generated by DriveKit SDK

⚠️ It is different from the itinId property returned in the Trip object, which corresponds to the unique trip identifier generated after the data analysis.

startMode

StartMode

Indicates how the trip started. Possible values are describe here.

recordingStartDate

Date

Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in TripResponseStatus after DriveQuant platform's analysis.

DKTripRecordingConfirmedState

This object is returned in the TripListener's tripRecordingConfirmed() callback.

Field
Type
Description

localTripId

String

Local and unique trip identifier generated by DriveKit SDK

⚠️ It is different from the itinId property returned in the Trip object, which corresponds to the unique trip identifier generated after the data analysis.

startMode

StartMode

Indicates how the trip started. Possible values are describe here.

recordingStartDate

Date

Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in TripResponseStatus after DriveQuant platform's analysis.

recordingConfirmationDate

Date

Date when the trip entered into the confirmation state.

DKTripRecordingCanceledState

This object is returned in the TripListener's tripRecordingCanceled() callback.

Field
Type
Description

localTripId

String

Local and unique trip identifier generated by DriveKit SDK

⚠️ It is different from the itinId property returned in the Trip object, which corresponds to the unique trip identifier generated after the data analysis.

startMode

StartMode

Indicates how the trip started. Possible values are describe here.

recordingStartDate

Date

Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in TripResponseStatus after DriveQuant platform's analysis.

recordingConfirmationDate

Date?

Date when the trip was confirmed if the trip entered into the confirmation state.

cancelationReason

DKTripCancelationReason

Indicates how the trip was canceled.

Possible values are described here.

DKTripRecordingFinishedState

This object is returned in the TripListener's tripRecordingFinished() callback.

Field
Type
Description

localTripId

String

Local and unique trip identifier generated by DriveKit SDK

⚠️ It is different from the itinId property returned in the Trip object, which corresponds to the unique trip identifier generated after the data analysis.

startMode

StartMode

Indicates how the trip started. Possible values are describe here.

recordingStartDate

Date

Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in TripResponseStatus after DriveQuant platform's analysis.

recordingConfirmationDate

Date

Date when the trip was confirmed if the trip entered into the confirmation state.

recordingEndDate

Date

Date when DriveKit has terminated the trip recording. ⚠️ It is not the trip end date returned in TripResponseStatus after DriveQuant platform's analysis..

StartMode

StartMode indicates how the trip is started. It is an enum with the following values:

Value
Description

gps

Automatic start when the SDK detects a change in user's position

beacon

Automatic start due to the presence of a beacon

manual

Trip started manually by calling the method startTrip

geozone

Automatic start when the SDK detects that you exit the zone where your vehicle may be parked

bluetooth

Automatic start by detecting a connection to a known vehicle's Bluetooth system

unknown_bluetooth

Automatic start by detecting a connection to an unknown vehicle's Bluetooth system

DKTripCancelationReason

Value
Description

user

Trip canceled by calling the method cancelTrip

highSpeed

Trip canceled because speed was too high (train, airplane)

noSpeed

Trip canceled because speed was too slow to be made in a vehicle

noBeacon

Trip canceled because the beacon was not detected while it was required

noBluetoothDevice

Trip canceled because the Bluetooth device was not detected while it was required.

missingConfiguration

Trip canceled because DriveKit was not configured

noLocationData

Trip canceled because no location data was recorded

reset

Trip canceled because SDK configuration has been reset.

beaconNoSpeed

Trip canceled because the beacon is near the smartphone but there was no movement (zero or low speed)

bluetoothDeviceNoSpeed

Trip canceled because the Bluetooth device is connected to the smartphone but there was no movement (zero or low speed)

appKilled

The trip recording has been canceled due to an app termination. The trip is not sent to the DriveQuant's platform for analysis because it has never entered in confirmation state, or the Bluetooth device/Beacon is required but has not been detected.

TripPoint

TripPoint is an object that contains data for each location registered by the SDK.

Attribute
Type
Description

latitude

Double

Latitude

longitude

Double

Longitude

speed

Double

Speed in km/h

accuracy

Double

Accuracy of the GPS data in meter

elevation

Double

Elevation in meter

distance

Double

Distance since the beginning of the trip in meter

heading

Double

Heading

duration

Double

Duration since the beginning of the trip in second

TripVehicle

TripVehicle is an object that contains vehicle detailed characteristics.

public class TripVehicle {
    public var carTypeIndex: Int = 1
    public var carEngineIndex: Int = 1
    public var carPower: Double = 150.0
    public var carMass: Double = 1400.0
    public var carGearboxIndex: Int = 2
    public var carConsumption: Double = 4.5
    public var carAutoGearboxNumber: Int = 0
    public var engineDisplacement: Double = 1_200.0
    public var frontTireSize: String?
    public var rearTireSize: String?
    public var length: Double
    public var width: Double
    public var height: Double
    public var engineCylinderNb: Int
    public var driveWheels: Int
}
Attribute
Type
Description
Default value, if not specified

carTypeIndex

Int

1

carEngineIndex

Int

1

carPower

Double

Vehicle power in hp. This value must be entered in horsepower. In case you only have the engine power in kW you can apply the following formula: P[hp]=P[kW]/0.7355P [hp] = P [kW] / 0.7355 (min: 40 hp, max 450 hp)

150

carMass

Double

Vehicle mass in kg (min: 700 kg, max: 3500 kg)

1400

carGearboxIndex

Int

2

carConsumption

Double

Combined fuel consumption [l/100km] measured during the New European Driving Cycle (NEDC). (min: 3 l/100km, max: 20 l/100km)

4.5

carAutoGearboxNumber

Int

Number of gear ratios for the automatic gearbox. This parameter is taken into account only if carGearboxIndex is set to 1.

6

engineDisplacement

double

Engine displacement in liters

1200

frontTireSize

string

Front tire size

"205/55/16"

rearTireSize

string

Rear tire size

"205/55/16"

length

double

Vehicle length in meter

4.5

width

double

Vehicle width in meter

1.8

height

double

Vehicle height in meter

1.45

engineCylinderNb

Int

Number of cylinders

4

BeaconData

BeaconData is an object that contains beacon characteristics.

Attribute
Type
Description

proximityUuid

String

Beacon proximity UUID

major

Int

Beacon major value (optional)

minor

Int

Beacon minor value (optional)

BluetoothData

BluetoothData is an object that contains the Bluetooth device characteristics.

Attribute
Type
Description

macAddress

String

Required MAC address of the device

name

String

Optional display name of the device

DKCrashInfo

Crash information object have the following structure:

public class DKCrashInfo {
    public let crashId: String
    public let date: Date
    public let probability: Int
    public let latitude: Double
    public let longitude: Double
    public let velocity: Double
    public let crashStatus: DKCrashStatus
}

with the following enumeration for crash status

public enum DKCrashStatus {
    case unconfirmed
    case confirmed
}
Attribute
Type
Description

crashId

String

Crash unique identifier

date

Date

Crash date

Example: 2023-03-07T09:13:22.461+0200

probability

Int

Crash probability (in %)

latitude

Double

Coordinates (latitude) of the crash

longitude

Double

Coordinates (longitude) of the crash

velocity

Double

Velocity at time of crash

crashStatus

DKCrashStatus

Crash status enum. Two possible values: confirmed or unconfirmed

DKCrashFeedbackConfig

DKCrashFeedbackConfig is an object used to configure the Crash Detection feedback feature.

Attribute
Type
Description

notification

DKCrashFeedbackNotification

Configuration of the notification

crashVelocityThreshold

Double

Minimal speed when the crash occurred.

For example, if crashVelocityThreshold is set at 20 km/h and a crash occurred at 10 km/h, feedback will not be sent to the user.

Default value: 0.0 km/h

DKCrashFeedbackNotification

Attribute
Type
Description

title

String

Title that appears on the notification

message

String

Message that appears on the notification

crashAlert

DKCrashAlert

Enum value that describes how the user will be noticed when a feedback is asked

Default value: silence

DKCrashAlert

Enum value
Description

silence

Device will not vibrate nor ring

vibration

Device will vibrate

soundAndVibration

Device will ring and vibrate

CrashFeedbackType

Enum value
Description

noCrash

User said that no crash occurred

confirmed

User confirmed a crash

noFeedback

User did not provide any feedback

CrashFeedbackSeverity

Enum value
Description

none

User said that no crash occurred

minor

User confirmed a minor crash

critical

User confirmed a critical crash

CancelTrip (Deprecated)

CancelTrip indicates how the trip was cancelled. It is an enum with the following values:

Value
Description

user

Trip cancelled by calling the method cancelTrip

highspeed

Trip cancelled because speed was too high (train, airplane)

noSpeed

Trip cancelled because speed was too slow to be in a vehicle

noBeacon

Trip cancelled because the beacon was not detected while it was required

missingConfiguration

Trip cancelled because DriveKit was not configured

noGPSData

Trip cancelled because no GPS data was recorded

reset

Trip cancelled because SDK configuration has been reset

beaconNoSpeed

Trip cancelled because the beacon is near the smartphone but there is no movement (zero or low speed)

bluetoothDeviceNoSpeed

Trip cancelled because the Bluetooth device is connected to the smartphone but there was no movement (zero or low speed)

Last updated