@kvaser/canking-api
Version:
CanKing API to communicate with the CanKing service using Node.js.
225 lines (224 loc) • 11.1 kB
TypeScript
/**
* 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 React from 'react';
import { PeriodicTransmissionSettings, 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 errors state has changed.
* @param errors The new errors state.
*/
onErrorsChange?: (errors: boolean) => void;
/**
* Callback that will be called when the select message dialog has been opened or closed.
* @param value The new show select message dialog state.
*/
showSelectMessageDialogChange?: (value: boolean) => void;
/**
* Callback that will be called when the select signal dialog has been opened or closed.
* @param value The new show select signal dialog state.
*/
showSelectSignalDialogChange?: (value: boolean) => void;
/** Set to true to disable this control. */
disabled?: boolean;
/** 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 shouldn't be visible. */
hideSelectMessageButton?: boolean;
/** Set to true if the select signal button should be visible. */
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, showSelectMessageDialogChange, showSelectSignalDialogChange, disabled, disableSelectMessageButton, disableSelectSignalButton, hideSection, hideSelectMessageButton, showSelectSignalButton, collapsible, collapsed, collapsedChange, }: LinIdentifierControlProps): import("react/jsx-runtime").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;
/**
* Callback that will be called when the select message dialog has been opened or closed.
* @param value The new show select message dialog state.
*/
showSelectMessageDialogChange?: (value: boolean) => void;
/**
* Callback that will be called when the select signal dialog has been opened or closed.
* @param value The new show select signal dialog state.
*/
showSelectSignalDialogChange?: (value: boolean) => void;
/** 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 shouldn't be visible. */
hideSelectMessageButton?: boolean;
/** Set to true if the select signal button shouldn't be visible. */
showSelectSignalButton?: 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, showSelectMessageDialogChange, showSelectSignalDialogChange, disableSelectMessageButton, disableSelectSignalButton, hideSection, hideSelectMessageButton, showSelectSignalButton, collapsible, collapsed, collapsedChange, }: LinIdentifierFrameControlProps): import("react/jsx-runtime").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;
/** The current error state. */
linIdentifierGeneratorSettingsError?: React.MutableRefObject<boolean>;
/** 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 select message dialog should be visible.
*/
showSelectMessageDialogChange: (value: boolean) => void;
/**
* Callback for specifying if the signal values table should be visible.
*/
showSignalValuesTable: (value: boolean) => void;
}
/**
* 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, linIdentifierGeneratorSettingsError, disabled, collapsible, collapsed, collapsedChange, showSelectMessageDialogChange, showSignalValuesTable, }: LinIdentifierGeneratorControlProps): import("react/jsx-runtime").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;
/** The current error state. */
linIdentifierGeneratorSettingsError?: React.MutableRefObject<boolean>;
/** 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 select message dialog should be visible.
*/
showSelectMessageDialogChange: (value: boolean) => void;
/**
* Callback for specifying if the signal values table should be visible.
*/
showSignalValuesTable: (value: boolean) => void;
}
/**
* 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, linIdentifierGeneratorSettingsError, disabled, collapsible, collapsed, collapsedChange, showSelectMessageDialogChange, showSignalValuesTable, }: LinIdentifierGeneratorSettingsControlProps): import("react/jsx-runtime").JSX.Element;
export default LinIdentifierControl;
export { type LinIdentifierControlProps, LinIdentifierControl, type LinIdentifierFrameControlProps, LinIdentifierFrameControl, type LinIdentifierGeneratorControlProps, LinIdentifierGeneratorControl, type LinIdentifierGeneratorSettingsControlProps, LinIdentifierGeneratorSettingsControl, };