UNPKG

@kvaser/canking-api

Version:

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

232 lines (231 loc) 11.6 kB
/** * This module includes UI controls for editing CAN 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 CAN identifier types, standard (11-bits) or extended (29-bits). */ export type canIdentifierType = 'standard' | 'extended'; /** Possible CAN identifier generator types. */ export type canIdentifierGeneratorType = 'constant' | 'random' | 'scan'; /** * Properties of the CanIdentifierControl React component. */ interface CanIdentifierControlProps { /** The current CAN identifier. */ canIdentifier: string; /** The current CAN identifier type, 'extended or 'standard'. */ canIdentifierType: canIdentifierType; /** * Callback that will be called when the CAN identifier has changed. * @param identifier The new CAN identifier. * @param idType The new CAN identifier type. */ onCanIdentifierChange: (identifier: string, idType: canIdentifierType) => 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 shouldn't 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 CAN identifier. * @param props Component properties. * @returns The CanIdentifierControl React component. */ declare function CanIdentifierControl({ canIdentifier, canIdentifierType, onCanIdentifierChange, onErrorsChange, showSelectMessageDialogChange, showSelectSignalDialogChange, disabled, disableSelectMessageButton, disableSelectSignalButton, hideSection, hideSelectMessageButton, showSelectSignalButton, collapsible, collapsed, collapsedChange, }: CanIdentifierControlProps): import("react/jsx-runtime").JSX.Element; /** * Properties of the CanIdentifierFrameControl React component. */ interface CanIdentifierFrameControlProps { /** The frame object that holds the CAN identifier. */ frame: WriteFrame; /** * Callback that will be called when the frame is updated after the CAN 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 should 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 CAN identifier using a Frame as source. * @param props Component properties. * @returns The CanIdentifierFrameControl React component. */ declare function CanIdentifierFrameControl({ frame, onFrameChange, onErrorsChange, showSelectMessageDialogChange, showSelectSignalDialogChange, disableSelectMessageButton, disableSelectSignalButton, hideSection, hideSelectMessageButton, showSelectSignalButton, collapsible, collapsed, collapsedChange, }: CanIdentifierFrameControlProps): import("react/jsx-runtime").JSX.Element; /** * Properties of the CanIdentifierGeneratorControl React component. */ interface CanIdentifierGeneratorControlProps { /** The CAN identifier. */ canIdentifier: string; /** * The generator type: 'constant' | 'random' | 'scan' * 'constant': The CAN identifier set to canIdentifier will be used for all generated messages. * 'random': A random CAN identifier between minCanIdentifier and maxCanIdentifier will be used. * 'scan': A CAN identifier will be picked from minCanIdentifier to maxCanIdentifier. */ identifierGeneratorType: canIdentifierGeneratorType; /** The min CAN identifier that will be used if identifierGeneratorType is 'random' or 'scan'. */ minCanIdentifier: string; /** The max CAN identifier that will be used if identifierGeneratorType is 'random' or 'scan'. */ maxCanIdentifier: string; /** The CAN identifier type that will be used, 'extended' or 'standard'. */ canIdentifierType: canIdentifierType; /** * Callback that will be called when the CAN identifier(s) has changed. * @param newCanIdentifier The new constant CAN identifier. * @param newIdentifierGeneratorType The new generator type. * @param newMinCanIdentifier The new min CAN identifier. * @param newMaxCanIdentifier The new max CAN identifier. */ onChange: (newCanIdentifier: string, newIdentifierGeneratorType: canIdentifierGeneratorType, newMinCanIdentifier: string, newMaxCanIdentifier: string, newIdentifierType: canIdentifierType) => 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. */ canIdentifierGeneratorSettingsError?: 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 CAN identifier(s) used by a message generator. * @param props Component properties. * @returns The CanIdentifierGeneratorControl React component. */ declare function CanIdentifierGeneratorControl({ canIdentifier, identifierGeneratorType, minCanIdentifier, maxCanIdentifier, canIdentifierType, onChange, onErrorsChange, canIdentifierGeneratorSettingsError, disabled, collapsible, collapsed, collapsedChange, showSelectMessageDialogChange, showSignalValuesTable, }: CanIdentifierGeneratorControlProps): import("react/jsx-runtime").JSX.Element; /** * Properties of the CanIdentifierGeneratorSettingsControl React component. */ interface CanIdentifierGeneratorSettingsControlProps { /** The settings object that holds the CAN identifier(s) generator settings. */ settings: PeriodicTransmissionSettings; /** * Callback that will be called when the settings are updated after the CAN 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. */ canIdentifierGeneratorSettingsError?: 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 CAN identifier(s) used by a message generator * using a PeriodicTransmissionSettings as source. * @param props Component properties. * @returns The CanIdentifierGeneratorSettingsControl React component. */ declare function CanIdentifierGeneratorSettingsControl({ settings, onSettingsChange, onErrorsChange, canIdentifierGeneratorSettingsError, disabled, collapsible, collapsed, collapsedChange, showSelectMessageDialogChange, showSignalValuesTable, }: CanIdentifierGeneratorSettingsControlProps): import("react/jsx-runtime").JSX.Element; export default CanIdentifierControl; export { type CanIdentifierControlProps, CanIdentifierControl, type CanIdentifierFrameControlProps, CanIdentifierFrameControl, type CanIdentifierGeneratorControlProps, CanIdentifierGeneratorControl, type CanIdentifierGeneratorSettingsControlProps, CanIdentifierGeneratorSettingsControl, };