UNPKG

react-native-obd-retriver

Version:

A React Native hook library to manage Bluetooth Low Energy connections and communication with ELM327 OBD-II adapters.

41 lines 1.13 kB
import type { ECUContextValue } from '../utils/types'; /** * Core hook for accessing ECU functionality in React components * * This hook provides access to all ECU communication features, including: * - Connection management * - Protocol information * - Vehicle data retrieval (VIN, DTCs, etc.) * - Raw command execution * * @example * ```tsx * import { useECU } from 'react-native-obd-retriver'; * * function VehicleMonitor() { * const { * state, * connectWithECU, * disconnectECU, * getVIN, * getRawCurrentDTCs * } = useECU(); * * const handleConnect = async () => { * const success = await connectWithECU(); * if (success) { * console.log("Connected to ECU!"); * console.log(`Protocol: ${state.protocolName}`); * console.log(`Voltage: ${state.deviceVoltage}`); * } * }; * * // Component rendering and other handlers... * } * ``` * * @returns All ECU functionality exposed by the ECUContext * @throws Error if used outside of an ECUProvider */ export declare const useECU: () => ECUContextValue; //# sourceMappingURL=useECU.d.ts.map