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 hasSafetyAndEcoDrivingScore: Bool
    public let info: [TripResponseInfo]
    public let error: TripResponseError?
    
    public func getTrip() -> Trip?
}
AttributeTypeDescription

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.

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

ValueDescription

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

ValueDescription

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

FieldTypeDescription

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:

FieldTypeDescription

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.

StartMode

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

ValueDescription

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

public enum StartMode: Int {
    case gps = 1
    case beacon = 2
    case manual = 3
    case geozone = 4
    case bluetooth = 5
    case unknown_bluetooth = 6
}

CancelTrip

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

ValueDescription

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)

public enum CancelTrip {
    case user, highspeed, noSpeed, noBeacon, missingConfiguration, noGPSData, reset, beaconNoSpeed, bluetoothDeviceNoSpeed
}

TripPoint

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

public struct TripPoint {
    let latitude: Double
    let longitude: Double
    let speed: Double
    let accuracy: Double
    let elevation: Double
    let distance: Double
    let heading: Double
    let duration: Double
}
AttributeTypeDescription

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
}
AttributeTypeDescriptionDefault value, if not specified

carTypeIndex

Int

1

carEngineIndex

Int

1

carPower

Double

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

driveWheels

Int

0

engineCylinderNb

Int

Number of cylinders

4

BeaconData

BeaconData is an object that contains beacon characteristics.

public class BeaconData {
    public let proximityUuid: String
    public let major: Int
    public let minor: Int
}
AttributeTypeDescription

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.

public class BluetoothData {
    public var name: String
    public var macAddress: String
}
AttributeTypeDescription

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
}
AttributeTypeDescription

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 enum

Crash status. Two possible values: confirmed or unconfirmed

DKCrashFeedbackConfig

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

public class DKCrashFeedbackConfig: NSObject {
    public let crashVelocityThreshold: Double
    public let notification: DKCrashFeedbackNotification
}

with the following class for DKCrashFeedbaclNotification

public class DKCrashFeedbackNotification: NSObject {
    public let title: String
    public let message: String
    public let crashAlert: DKCrashAlert
}
AttributeTypeDescription

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

public class DKCrashFeedbackNotification: NSObject {
    public let title: String
    public let message: String
    public let crashAlert: DKCrashAlert
}
AttributeTypeDescription

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

public enum DKCrashAlert: Int {
    case silence
    case vibration
    case soundAndVibration
}
Enum valueDescription

silence

Device will not vibrate nor ring

vibration

Device will vibrate

soundAndVibration

Device will ring and vibrate

CrashFeedbackType

Enum valueDescription

noCrash

User said that no crash occurred

confirmed

User confirmed a crash

noFeedback

User did not provide any feedback

CrashFeedbackSeverity

Enum valueDescription

none

User said that no crash occurred

minor

User confirmed a minor crash

critical

User confirmed a critical crash

Last updated