• Inject an AUTOSAR controller error (Error Active, Error Passive, or Bus-off) from a node script.

    Parameters

    • errorState: CanInjectErrorState

      ACTIVE, PASSIVE, or BUSOFF

    • Optionaloptions: { device?: string; rxErrorCounter?: number; txErrorCounter?: number }
      • Optionaldevice?: string

        Simulate device name on this node. Required when the node has more than one CAN device. The device handle is the bus. The error is applied to every Can.c controller open on that bus.

      • OptionalrxErrorCounter?: number

        REC. Defaults to 0 for active, otherwise unchanged.

      • OptionaltxErrorCounter?: number

        TEC. Defaults are 0 (active), 128 (passive), 256 (bus-off).

    Returns Promise<any>

    One result per open Can.c controller: error state, counters, and controller mode.

    If the device is not Simulate CAN, the listener is down, or Can.c has not opened a controller.

    await injectCanError('BUSOFF')
    await injectCanError('ACTIVE', { device: 'SIM0' })