com.eurotech.framework.protocol.can
Class CanConnectionServiceImpl

java.lang.Object
  extended by com.eurotech.framework.protocol.can.CanConnectionServiceImpl
All Implemented Interfaces:
ConfigurableComponent, CanConnectionService

public class CanConnectionServiceImpl
extends Object
implements CanConnectionService, ConfigurableComponent


Constructor Summary
CanConnectionServiceImpl()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext componentContext)
           
protected  void deactivate(org.osgi.service.component.ComponentContext componentContext)
           
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CanConnectionServiceImpl

public CanConnectionServiceImpl()
Method Detail

activate

protected void activate(org.osgi.service.component.ComponentContext componentContext)

deactivate

protected void deactivate(org.osgi.service.component.ComponentContext componentContext)

sendCanMessage

public void sendCanMessage(String ifName,
                           int canId,
                           byte[] message)
                    throws EsfException,
                           IOException
Description copied from interface: CanConnectionService
Sends an array of bytes on a CAN socket

Specified by:
sendCanMessage in interface CanConnectionService
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

public CanMessage receiveCanMessage(int can_id,
                                    int can_mask)
                             throws EsfException,
                                    IOException
Description copied from interface: CanConnectionService
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.

Specified by:
receiveCanMessage in interface CanConnectionService
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.