/** * This module includes React hooks for getting/setting data from/to CanKing. * * @remarks * To be able to use these hooks the CanKingDataProvider component must be present in the * component tree above your component. Normally the CanKingDataProvider is added * at the root of the component tree. * * ## Common hooks * * **Signal and message data** — use these when your view needs live or historical CAN/LIN traffic: * - {@link useMessageData} / {@link useSignalData} — subscribe to a known, fixed set of frames or signals (for * example a gauge or custom widget bound to specific signals). Both automatically persist which * frames/signals are subscribed to, buffer data received during startup, and clear their data when a new * measurement goes online. * - {@link useSignalDataEnvelopes} — like {@link useSignalData}, but returns min/max envelopes over a time window * instead of individual samples. Use it to feed a signal plot/graph instead of a table. * - {@link useScrollModeMeasurementData} / {@link useFixedPositionModeMeasurementData} — use these instead when * your view needs to show *all* traffic rather than a fixed set of frames: scroll mode for a trace/log style * view (latest data, at most 500 frames), fixed position mode for a dashboard showing the latest value per * frame id. * - To let the user pick which messages/signals to subscribe to, prefer the ready-made * {@link controls!SelectMessageDialog | SelectMessageDialog}, {@link controls!SelectSignalDialog | SelectSignalDialog} * and {@link controls!SelectSignalsControl | SelectSignalsControl} components from `@kvaser/canking-api/controls` * over building a custom picker. Fall back to {@link useMessageDatabases} — which lists the message databases * (and their signals) available in the current measurement — only if you need a custom picker UI those * controls don't support. * * **Measurement setup nodes** — use these to inspect the sources, data processors and targets configured in the * measurement setup: * - {@link useMeasurementSourceNodes} / {@link useMeasurementSourceNode} — list or look up source nodes (CAN/LIN * channels, log replay, traffic generator). Filter by {@link MeasurementSourceNodeType}. * - {@link useMeasurementDataProcessorNodes} / {@link useMeasurementDataProcessorNode} — list or look up data * processor nodes (CAN message filter, databases, interpreter, extension). Filter by * {@link MeasurementDataProcessorNodeType}. * - {@link useMeasurementTargetNodes} / {@link useMeasurementTargetNode} — list or look up target nodes (message * logger, signal logger, extension). Filter by {@link MeasurementTargetNodeType}. * * **Online status** — use these to react to the measurement going online/offline: * - {@link useOnlineStatus} — the current online/offline state. Use it to disable controls or clear stale data * while offline. * - {@link useOnlineStatusSync} — use this instead of {@link useOnlineStatus} when your view needs to run logic * exactly once when going online or offline (rather than just reading a flag), and needs to distinguish a * freshly-created view from one that's remounting after being hidden. * * **Workspace persistence** — use these to persist view state so it survives reloads: * - {@link useProjectDataSlice} / {@link useProjectData} — persist data to the CanKing project file. Use this for * state the user would expect saved with the project, e.g. a selected channel or configuration. * - {@link useSessionDataSlice} / {@link useSessionData} — persist data to session data instead. Session data * survives the view being hidden/shown again, but is not saved to the project file. Use this for transient UI * state that shouldn't pollute the saved project, e.g. the currently selected tab. * * Prefer the `*Slice` variants ({@link useProjectDataSlice}, {@link useSessionDataSlice}) when a view stores * several independent pieces of data, since each slice is loaded/saved independently under its own key. * * @example * ``` * import { useUserSettings } from '@kvaser/canking-api/hooks'; * ... * const userSettings = useUserSettings(); * ``` * * @packageDocumentation */ export * from './useUserSettings'; export * from './useDevices'; export * from './useApplication'; export * from './useEntitlement'; export * from './useMeasurement'; export * from './useSignalData'; export * from './useWorkspaceData'; export * from './useUndo'; export { type IMeasurementSetupContext, type IOnlineStatusContext, type IDevicesContext, type IMeasurementStatusContext, } from './internalDataStores';