pamoja for TypeScript - v0.2.0
    Preparing search index...

    Class CanBus

    One node's place on a CAN bus.

    CanBus.open(interface) opens a kernel CAN interface, such as can0, through SocketCAN on a Linux board and throws anywhere else. CanBus.simulated() makes a bus inside the program, and join() puts another node on the same bus. A node hears every frame the others send and none of its own, and keeps only the frames its filters pass. send and receive return promises; a receive on a simulated bus with nothing waiting resolves at once with null and counts its timeout in waitedMicros.

    Index
    • get interface(): string | null

      The kernel interface the node is on, or null on a simulated bus.

      Returns string | null

    • get received(): number

      How many frames the node has received.

      Returns number

    • get sent(): number

      How many frames the node has sent.

      Returns number

    • get waitedMicros(): number

      How long receives on the node have waited without a frame, in microseconds, whether or not the process slept through it.

      Returns number

    • Keeps every frame again, as a node does when it joins.

      Returns void

    • Resolves with the next frame the node keeps, waiting up to timeoutMs for one, or with null when the timeout passed with nothing.

      Parameters

      • timeoutMs: number

      Returns Promise<CanFrame | null>

    • Sends a frame to every other node on the bus.

      Parameters

      Returns Promise<void>

    • Keeps only the frames that pass at least one of the filters, from now on; an empty list keeps nothing.

      Parameters

      Returns void

    • Opens a kernel CAN interface through SocketCAN, as one node on its bus. Bring the interface up first, with ip link set can0 up type can bitrate 250000.

      Parameters

      • interface: string

      Returns CanBus