com.eurotech.framework.protocol.can
Interface CanConnectionService

All Known Implementing Classes:
CanConnectionServiceImpl

public interface CanConnectionService

This is the primary control class for a CAN network interface.


Method Summary
 CanMessage receiveCanMessage(int can_id, int can_mask)
          Reads frames that are waiting on socket CAN (all interfaces) and returns an array if canId is correct.
 void sendCanMessage(String ifName, int canId, byte[] message)
          Sends an array of bytes on a CAN socket
 

Method Detail

sendCanMessage

void sendCanMessage(String ifName,
                    int canId,
                    byte[] message)
                    throws EsfException,
                           IOException
Sends an array of bytes on a CAN socket

Parameters:
ifName - the name of the socket (eg "can0")
canId - can identifier, must be unique
message - the array of bytes to send to the socket
Throws:
EsfException
IOException

receiveCanMessage

CanMessage receiveCanMessage(int can_id,
                             int can_mask)
                             throws EsfException,
                                    IOException
Reads frames that are waiting on socket CAN (all interfaces) and returns an array if canId is correct.

A filter can be defined to receive only frames for the id we are interested in. If the can_id param is set to -1, no filter is applied.

Parameters:
can_id - id to be filtered
can_mask - mask to be applied to the id
Returns:
CanMessage = canId and an array of bytes buffered on the socket if any
Throws:
EsfException
IOException


Copyright © 2013. All Rights Reserved.