Class CanBus

java.lang.Object
com.codename1.hardware.CanBus

public final class CanBus extends Object
A CAN network interface, opened through Hardware.openCan(String).
  • Method Details

    • getInterface

      public String getInterface()
      The interface name.
    • send

      public void send(CanFrame frame) throws HardwareException

      Sends one frame.

      Throws
      • HardwareException: when the send fails or the bus is closed
      Throws:
      HardwareException
    • receive

      public CanFrame receive(int timeoutMs) throws HardwareException

      Waits up to timeoutMs for a frame (negative waits indefinitely) and returns it, or null on timeout. Call it off the event dispatch thread.

      Throws
      • HardwareException: when the receive fails or the bus is closed
      Throws:
      HardwareException
    • close

      public void close()
      Closes the interface. Closing twice is harmless.