Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public final class CanBus

  1. Object
  2. CanBus
A CAN network interface, opened through Hardware.openCan(String).

Methods

public String getInterface()The interface name.
public void send(CanFrame frame) throws HardwareExceptionSends one frame.
public CanFrame receive(int timeoutMs) throws HardwareExceptionWaits up to timeoutMs for a frame (negative waits indefinitely) and returns it, or null on timeout.
public void close()Closes the interface.

Inherited methods

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

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

close

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