UNPKG

@kvaser/canking-api

Version:

CanKing API to communicate with the CanKing service using Node.js.

264 lines (263 loc) 12.6 kB
/** * This module includes UI controls for editing LIN identifiers. * * To be able to use these controls 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. * * @packageDocumentation */ import { JSX } from 'react'; import { PeriodicTransmissionSettings, SignalDefinition, WriteFrame } from '../models'; /** Possible LIN identifier generator types. */ export type linIdentifierGeneratorType = 'constant' | 'random' | 'scan'; /** * Properties of the LinIdentifierControl React component. */ interface LinIdentifierControlProps { /** The current LIN identifier. */ linIdentifier: string; /** * Callback that will be called when the LIN identifier has changed. * @param identifier - The new LIN identifier. */ onLinIdentifierChange: (identifier: string) => void; /** * Callback that will be called when the settings have changed after selecting a signal. * If this property is set, then the onLinIdentifierChange callback will not be called. * @param identifier - The new LIN identifier. * @param signal - The new signal or undefined if no signal is selected. */ onSignalChange?: (identifier: string, signal: SignalDefinition | undefined) => void; /** * Callback that will be called when the errors state has changed. * @param errors - The new errors state. */ onErrorsChange?: (errors: boolean) => void; /** Set to true to disable this control. */ disabled?: boolean; /** * Name of a parent dialog, if any, that is used as the parent for the select message and select signal dialogs. * Leave undefined if there is no parent dialog. */ parentDialogTitle?: string; /** Set to true if the select message and select signal dialogs should be full screen dialogs. */ fullScreen?: boolean; /** * Identifier of the node that will be used to filter messages and signals in the select dialogs. * Leave undefined if no filtering should be done. */ nodeIdentifier?: string; /** * The source identifier that will be used to filter messages in the select dialog. * Leave undefined if no filtering should be done. */ sourceIdFilter?: string; /** Set to true if the select message button should be disabled. */ disableSelectMessageButton?: boolean; /** Set to true if the select signal button should be disabled. */ disableSelectSignalButton?: boolean; /** Set to true if this control shouldn't be encapsulated inside a SectionControl. */ hideSection?: boolean; /** Set to true if the select message button should be hidden. */ hideSelectMessageButton?: boolean; /** Set to true if the select signal button should be visible. If set to true, then the select message button will be hidden. */ showSelectSignalButton?: boolean; /** Set to true if the SectionControl should be collapsible, ignored if hideSectionControl is true. */ collapsible?: boolean; /** Current collapse state of the SectionControl. */ collapsed?: boolean; /** * Callback that will be called when collapse state has changed. * @param value - The new collapse state. */ collapsedChange?: (value: boolean) => void; } /** * Creates an UI control for editing a LIN identifier. * @param props - Component properties. * @returns The LinIdentifierControl React component. */ declare function LinIdentifierControl({ linIdentifier, onLinIdentifierChange, onErrorsChange, onSignalChange, disabled, parentDialogTitle, fullScreen, nodeIdentifier, sourceIdFilter, disableSelectMessageButton, disableSelectSignalButton, hideSection, hideSelectMessageButton, showSelectSignalButton, collapsible, collapsed, collapsedChange, }: LinIdentifierControlProps): JSX.Element; /** * Properties of the LinIdentifierFrameControl React component. */ interface LinIdentifierFrameControlProps { /** The frame object that holds the LIN identifier. */ frame: WriteFrame; /** * Callback that will be called when the frame is updated after the LIN identifier has changed. * @param value - The new frame object. */ onFrameChange: (value: WriteFrame) => void; /** * Callback that will be called when the errors state has changed. * @param errors - The new errors state. */ onErrorsChange?: (errors: boolean) => void; /** * Name of a parent dialog, if any, that is used as the parent for the select message and select signal dialogs. * Leave undefined if there is no parent dialog. */ parentDialogTitle?: string; /** Set to true if the select message and select signal dialogs should be full screen dialogs. */ fullScreen?: boolean; /** * Identifier of the node that will be used to filter messages and signals in the select dialogs. * Leave undefined if no filtering should be done. */ nodeIdentifier?: string; /** * The source identifier that will be used to filter messages in the select dialog. * Leave undefined if no filtering should be done. */ sourceIdFilter?: string; /** Set to true if the select message button should be disabled. */ disableSelectMessageButton?: boolean; /** Set to true if this control shouldn't be encapsulated inside a SectionControl. */ hideSection?: boolean; /** Set to true if the select message button should be hidden. */ hideSelectMessageButton?: boolean; /** Set to true if the SectionControl should be collapsible. */ collapsible?: boolean; /** Current collapse state of the SectionControl. */ collapsed?: boolean; /** * Callback that will be called when collapse state has changed. * @param value - The new collapse state. */ collapsedChange?: (value: boolean) => void; } /** * Creates an UI control for editing a LIN identifier using a Frame as source. * @param props - Component properties. * @returns The LinIdentifierFrameControl React component. */ declare function LinIdentifierFrameControl({ frame, onFrameChange, onErrorsChange, parentDialogTitle, fullScreen, nodeIdentifier, sourceIdFilter, disableSelectMessageButton, hideSection, hideSelectMessageButton, collapsible, collapsed, collapsedChange, }: LinIdentifierFrameControlProps): JSX.Element; /** * Properties of the LinIdentifierGeneratorControl React component. */ interface LinIdentifierGeneratorControlProps { /** The LIN identifier. */ linIdentifier: string; /** * The generator type: 'constant' | 'random' | 'scan' * 'constant': The LIN identifier set to linIdentifier will be used for all generated messages. * 'random': A random LIN identifier between minLinIdentifier and maxLinIdentifier will be used. * 'scan': A LIN identifier will be picked from minLinIdentifier to maxLinIdentifier. */ identifierGeneratorType: linIdentifierGeneratorType; /** The min LIN identifier that will be used if identifierGeneratorType is 'random' or 'scan'. */ minLinIdentifier: string; /** The max LIN identifier that will be used if identifierGeneratorType is 'random' or 'scan'. */ maxLinIdentifier: string; /** * Callback that will be called when the LIN identifier(s) has changed. * @param newLinIdentifier - The new constant LIN identifier. * @param newIdentifierGeneratorType - The new generator type. * @param newMinLinIdentifier - The new min LIN identifier. * @param newMaxLinIdentifier - The new max LIN identifier. */ onChange: (newLinIdentifier: string, newIdentifierGeneratorType: linIdentifierGeneratorType, newMinLinIdentifier: string, newMaxLinIdentifier: string) => void; /** * Callback that will be called when the errors state has changed. * @param errors - The new errors state. */ onErrorsChange?: (errors: boolean) => void; /** Set to true to disable this control. */ disabled?: boolean; /** Set to true if the SectionControl should be collapsible. */ collapsible?: boolean; /** Current collapse state of the SectionControl. */ collapsed?: boolean; /** * Callback that will be called when collapse state has changed. * @param value - The new collapse state. */ collapsedChange?: (value: boolean) => void; /** * Callback for specifying if the signal values table should be visible. */ showSignalValuesTable: (value: boolean) => void; /** * Name of a parent dialog, if any, that is used as the parent for the select message dialog. * Leave undefined if there is no parent dialog. */ parentDialogTitle?: string; /** Set to true if the select message dialog should be a full screen dialog. */ fullScreen?: boolean; /** * Identifier of the node that will be used to filter messages in the select dialog. * Leave undefined if no filtering should be done. */ nodeIdentifier?: string; /** * The source identifier that will be used to filter messages in the select dialog. * Leave undefined if no filtering should be done. */ sourceIdFilter?: string; } /** * Creates an UI control for editing LIN identifier(s) used by a message generator. * @param props - Component properties. * @returns The LinIdentifierGeneratorControl React component. */ declare function LinIdentifierGeneratorControl({ linIdentifier, identifierGeneratorType, minLinIdentifier, maxLinIdentifier, onChange, onErrorsChange, disabled, collapsible, collapsed, collapsedChange, showSignalValuesTable, parentDialogTitle, fullScreen, nodeIdentifier, sourceIdFilter, }: LinIdentifierGeneratorControlProps): JSX.Element; /** * Properties of the LinIdentifierGeneratorSettingsControl React component. */ interface LinIdentifierGeneratorSettingsControlProps { /** The settings object that holds the LIN identifier(s) generator settings. */ settings: PeriodicTransmissionSettings; /** * Callback that will be called when the settings are updated after the LIN identifiers have changed. * @param value - The new settings object. */ onSettingsChange: (value: PeriodicTransmissionSettings) => void; /** * Callback that will be called when the errors state has changed. * @param errors - The new errors state. */ onErrorsChange?: (errors: boolean) => void; /** Set to true to disable this control. */ disabled?: boolean; /** Set to true if the SectionControl should be collapsible. */ collapsible?: boolean; /** Current collapse state of the SectionControl. */ collapsed?: boolean; /** * Callback that will be called when collapse state has changed. * @param value - The new collapse state. */ collapsedChange?: (value: boolean) => void; /** * Callback for specifying if the signal values table should be visible. */ showSignalValuesTable: (value: boolean) => void; /** * Name of a parent dialog, if any, that is used as the parent for the select message dialog. * Leave undefined if there is no parent dialog. */ parentDialogTitle?: string; /** Set to true if the select message dialog should be a full screen dialog. */ fullScreen?: boolean; /** * Identifier of the node that will be used to filter messages in the select dialog. * Leave undefined if no filtering should be done. */ nodeIdentifier?: string; /** * The source identifier that will be used to filter messages in the select dialog. * Leave undefined if no filtering should be done. */ sourceIdFilter?: string; } /** * Creates an UI control for editing LIN identifier(s) used by a message generator * using a PeriodicTransmissionSettings as source. * @param props - Component properties. * @returns The LinIdentifierGeneratorSettingsControl React component. */ declare function LinIdentifierGeneratorSettingsControl({ settings, onSettingsChange, onErrorsChange, disabled, collapsible, collapsed, collapsedChange, showSignalValuesTable, parentDialogTitle, fullScreen, nodeIdentifier, sourceIdFilter, }: LinIdentifierGeneratorSettingsControlProps): JSX.Element; export default LinIdentifierControl; export { type LinIdentifierControlProps, LinIdentifierControl, type LinIdentifierFrameControlProps, LinIdentifierFrameControl, type LinIdentifierGeneratorControlProps, LinIdentifierGeneratorControl, type LinIdentifierGeneratorSettingsControlProps, LinIdentifierGeneratorSettingsControl, };