import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; import type { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes'; /** * Native Telematics SDK TurboModule surface (React Native codegen). * * This is the low-level native contract. Prefer using the high-level wrapper created by * {@link createTelematicsSdk} / {@link TelematicsSdk} for app code, and keep this interface * aligned with the native implementations and codegen constraints. * * Notes: * - Some return types are deliberately `Object` or flattened params to avoid generating C++ structs. * - Platform-specific methods should be called only on the matching platform. */ export interface Spec extends TurboModule { // Lifecycle /** Initializes the native SDK. */ initializeSdk(): Promise; /** Returns whether the native SDK is initialized. */ isInitializedSdk(): Promise; // Device token /** Returns the current virtual device identifier (token). */ getDeviceId(): Promise; /** Returns the latest known device identifier registration state. */ getDeviceIdRegistrationState(): Promise; /** Sets the virtual device identifier (token). */ setDeviceId(deviceId: string): Promise; /** Performs a full logout on the native SDK. */ logout(): Promise; // Permissions & tracking /** Checks whether all required permissions and sensors are granted/available. */ isAllRequiredPermissionsAndSensorsGranted(): Promise; /** Returns whether the native SDK is currently enabled. */ isSdkEnabled(): Promise; /** Returns whether tracking is currently active. */ isTracking(): Promise; /** Enables or disables the native SDK globally. */ setEnableSdk(enable: boolean): Promise; /** Starts tracking manually. */ startManualTracking(): Promise; /** Starts persistent tracking manually. */ startTrackAsPersistent(): Promise; /** Stops tracking manually. */ stopManualTracking(): Promise; /** Sets the maximum duration, in minutes, for a single persistent tracking session. */ setMaxPersistentTrackingInterval(minutes: Int32): Promise; /** Returns the maximum duration, in minutes, for a single persistent tracking session. */ getMaxPersistentTrackingInterval(): Promise; /** Sets whether tracking runs in standard or persistent mode. */ setTrackingMode(trackingMode: Int32): Promise; /** Returns the current tracking mode. */ getTrackingMode(): Promise; /** Returns current automatic and manual tracking availability state. */ getTrackingState(): Promise; // Upload /** Triggers upload of locally stored, unsent trips if any. */ uploadUnsentTrips(): Promise; /** Returns the number of unsent trips currently stored locally. */ getUnsentTripCount(): Promise; // Heartbeats /** Sends a custom heartbeat with an application-defined reason. */ sendCustomHeartbeats(reason: string): Promise; // Wizard /** Shows the native permissions wizard UI. */ showPermissionWizard( enableAggressivePermissionsWizard: boolean, enableAggressivePermissionsWizardPage: boolean ): Promise; // Accidents / RTLD /** Sets accident detection sensitivity (enum value). */ setAccidentDetectionSensitivity(value: Int32): Promise; /** Returns whether RTLD (real-time data logging) is enabled. */ isRTLDEnabled(): Promise; /** Enables or disables accident detection. */ enableAccidents(enable: boolean): Promise; /** Returns whether accident detection is enabled. */ isEnabledAccidents(): Promise; // Tags API — return types are untyped Object to avoid C++ codegen structs /** Requests the current list of Future Track tags. */ getFutureTrackTags(): Promise; /** Adds a Future Track tag. */ addFutureTrackTag(tag: string, source: string | null): Promise; /** Removes a Future Track tag. */ removeFutureTrackTag(tag: string, source: string | null): Promise; /** Removes all Future Track tags. */ removeAllFutureTrackTags(): Promise; // Speed violations — flattened params to avoid C++ struct on iOS /** Enables speed limit monitoring and configures speed violation parameters. */ registerSpeedViolations( speedLimitKmH: Double, speedLimitTimeout: Int32 ): Promise; // iOS-only /** iOS only: returns whether aggressive heartbeat mode is enabled. */ isAggressiveHeartbeats(): Promise; /** iOS only: enables or disables aggressive heartbeat mode. */ setAggressiveHeartbeats(enable: boolean): Promise; /** iOS only: disables or enables user-initiated tracking. */ setDisableTracking(value: boolean): Promise; /** iOS only: returns whether user-initiated tracking is disabled. */ isDisableTracking(): Promise; /** iOS only: returns whether current location accuracy is insufficient. */ isWrongAccuracyState(): Promise; /** iOS only: requests "Always" location permission from the system. */ requestIOSLocationAlwaysPermission(): Promise; /** iOS only: requests Motion/Fitness permission from the system. */ requestIOSMotionPermission(): Promise; /** iOS only: returns the API language configured in the native SDK. */ getApiLanguage(): Promise; /** iOS only: sets the API language used by the native SDK. */ setApiLanguage(language: string): Promise; // Android-only — flattened params to avoid C++ struct on iOS /** Android only: enables or disables SDK autostart behavior. */ setAndroidAutoStartEnabled( enable: boolean, permanent: boolean ): Promise; /** Android only: returns whether SDK autostart is enabled. */ isAndroidAutoStartEnabled(): Promise; // Events (required by NativeEventEmitter) /** Registers an event listener on the native side. */ addListener(eventName: string): void; /** Removes event listeners on the native side. */ removeListeners(count: Double): void; } export default TurboModuleRegistry.get('TelematicsSdk');