declare module "@sentiance-react-native/driving-insights" { import { EmitterSubscription } from "react-native"; export interface DrivingInsights { transportEvent: TransportEvent, safetyScores: SafetyScores } export interface SafetyScores { /** * Smooth driving score, between 0 and 1, where 1 is the perfect score. */ smoothScore?: number; /** * Focused driving score, between 0 and 1, where 1 is the perfect score. */ focusScore?: number; /** * Legal driving score, between 0 and 1, where 1 is the perfect score. */ legalScore?: number; /** * Call while moving driving score, between 0 and 1, where 1 is the perfect score. */ callWhileMovingScore?: number; /** * Overall driving score, between 0 and 1, where 1 is the perfect score. */ overallScore?: number; /** * Harsh braking score, between 0 and 1, where 1 is the perfect score. */ harshBrakingScore?: number; /** * Harsh turning score, between 0 and 1, where 1 is the perfect score. */ harshTurningScore?: number; /** * Harsh acceleration score, between 0 and 1, where 1 is the perfect score. */ harshAccelerationScore?: number; /** * Wrong way driving score, between 0 and 1, where 1 is the perfect score. */ wrongWayDrivingScore?: number; /** * Attention score, between 0 and 1, where 1 is the perfect score. */ attentionScore?: number; } export interface DrivingEvent { startTime: string; startTimeEpoch: number; // in milliseconds endTime: string; endTimeEpoch: number; // in milliseconds waypoints: Waypoint[]; } export type HarshDrivingEventType = | "ACCELERATION" | "BRAKING" | "TURN"; export interface HarshDrivingEvent extends DrivingEvent { magnitude: number; confidence: number; type: HarshDrivingEventType; } export interface PhoneUsageEvent extends DrivingEvent { /** * State of phone call during the phone usage event. */ callState: "NO_CALL" | "CALL_IN_PROGRESS" | "UNAVAILABLE"; } /** * @deprecated Use {@link CallEvent} instead. */ export interface CallWhileMovingEvent extends DrivingEvent { maxTravelledSpeedInMps?: number; minTravelledSpeedInMps?: number; } export type CallEvent = DrivingEvent & { /** * Maximum speed during the call in meters per second. */ maxTraveledSpeedInMps: number | null, /** * Minimum speed during the call in meters per second. */ minTraveledSpeedInMps: number | null, /** * Hands-free state during the call. */ handsFreeState: "HANDS_FREE" | "HANDHELD" | "UNAVAILABLE" }; export interface SpeedingEvent extends DrivingEvent { } export interface WrongWayDrivingEvent extends DrivingEvent { } export interface TransportEvent { id: string; startTime: string; startTimeEpoch: number; // in milliseconds lastUpdateTime: string; lastUpdateTimeEpoch: number; // in milliseconds endTime: string | null; endTimeEpoch: number | null; // in milliseconds durationInSeconds: number | null; type: string; transportMode: TransportMode | null; waypoints: Waypoint[]; distance?: number; // in meters transportTags: TransportTags; occupantRole: OccupantRole; /** * Indicates whether the event is provisional. * *
A provisional event is identified based on real-time detections, but may change in the near future * as more data is collected and processed, to filter out unwanted artifacts. * For example, a provisional car transport may get identified, followed by a provisional bus transport. * After the full trip is complete, these provisional events may get merged into a single final car event.
* *Final events are generated independently of the provisional events, and have unique event IDs. They are * not linked to the provisional events they may resemble, replace, or overlap with.
* *Currently, provisional events apply only to 'transport' types, as the SDK tries to determine the mode of * transport in (near) real time. When the full trip is complete (e.g. the user becomes stationary), * the collected data is reprocessed to produce a more accurate and cleaned up list of transport events.
*/ isProvisional: boolean; } export type TransportTags = { [key: string]: string }; export type TransportMode = | "UNKNOWN" | "BICYCLE" | "WALKING" | "RUNNING" | "TRAM" | "TRAIN" | "CAR" | "BUS" | "MOTORCYCLE"; export interface Waypoint { latitude: number; longitude: number; accuracy: number; // in meters timestamp: number; // UTC epoch time in milliseconds speedInMps?: number; // in meters per second /** * - If {@link isSpeedLimitInfoSet} is `false`, then this value will be `undefined`. * - If {@link hasUnlimitedSpeedLimit} is `true`, then this value will be `Number.MAX_VALUE`. */ speedLimitInMps?: number; // in meters per second hasUnlimitedSpeedLimit: boolean; isSpeedLimitInfoSet: boolean; isSynthetic: boolean; } export type OccupantRole = | "DRIVER" | "PASSENGER" | "UNAVAILABLE"; export interface SafetyScoreRequestParameters { /** * A period of the last 7, 14 or 30 days. */ period: 7 | 14 | 30; /** * Transport modes of interest. * * @defaultValue "ALL_MODES" */ transportModes: TransportMode[] | "ALL_MODES"; /** * Occupant roles of interest. * * @defaultValue "ALL_ROLES" */ occupantRoles: OccupantRole[] | "ALL_ROLES"; } export interface SentianceDrivingInsights { /** * Adds a listener that will be invoked when the driving insights for a completed, non-provisional transport becomes ready. *