VLCB
Loading...
Searching...
No Matches
VLCB::CanService Class Reference

Service for sending and receiving messages on a CAN bus. More...

#include <CanService.h>

Inheritance diagram for VLCB::CanService:
VLCB::Service VLCB::CanServiceWithDiagnostics

Public Member Functions

 CanService (CanTransport *tpt)
virtual VlcbServiceTypes getServiceID () const override
 Return a unique ID for this service.
virtual byte getServiceVersionID () const override
 Return the version of the service specification implemented by this service.
virtual Data getServiceData ()
 Return Data bytes specific for the implementing service. The meaning of each data byte is defined in the service specification.
virtual void process () override
 This method that be called regularly from the VLCB core to let the service perform regular tasks.
virtual void processAction (const Action &action) override
 Called when there is an action available.
Public Member Functions inherited from VLCB::Service
void setController (Controller *ctrl)
 Set a pointer to the controller object for use in implementing class.
virtual void begin ()
 This optional method is called at the beginning of the Arduino sketch. Define this method for the service to do any setup required at the beginning.
virtual void reportDiagnostics (byte serviceIndex, byte diagnosticsCode)
 Report a given diagnostic value.
virtual int getDiagnosticCount ()
 report how many diagnostics this service supports.

Protected Attributes

CanTransportcanTransport
Protected Attributes inherited from VLCB::Service
Controllercontroller
 Pointer to the Controller object that can be used by implementing classes.

Additional Inherited Members

Protected Member Functions inherited from VLCB::Service
bool isThisNodeNumber (unsigned int nodeNumber)
 Helper function to decide if a given node number is the same as that assigned to this node.

Detailed Description

Service for sending and receiving messages on a CAN bus.

Delegates to a CanTransport object to do the actual transmission on the CAN bus.

The CanService class manages the CANID which can be explicitly set or dynamically allocated via the CANID enumeration process.

It also puts incoming CANFrame's on to the ActionQueue as a VlcbMessage, and gets outgoing VlcbMessage from the ActionQueue and passes it to the CanTransport object for transmission on the CAN bus.

Constructor & Destructor Documentation

◆ CanService()

VLCB::CanService::CanService ( CanTransport * tpt)
inline

Construct a CanService with a concrete CanTransport object to use for transmission on the CAN bus.

Member Function Documentation

◆ getServiceID()

virtual VlcbServiceTypes VLCB::CanService::getServiceID ( ) const
inlineoverridevirtual

Return a unique ID for this service.

This ID is used by configuration utilities to identify the service type. The service IDs are listed in the VLCB service specifications.

Implements VLCB::Service.

◆ getServiceVersionID()

virtual byte VLCB::CanService::getServiceVersionID ( ) const
inlineoverridevirtual

Return the version of the service specification implemented by this service.

This version is used by configuration utilities to identify which features are implemented by this service.

Implements VLCB::Service.

◆ getServiceData()

Service::Data VLCB::CanService::getServiceData ( )
virtual

Return Data bytes specific for the implementing service. The meaning of each data byte is defined in the service specification.

Reimplemented from VLCB::Service.

◆ process()

void VLCB::CanService::process ( )
overridevirtual

This method that be called regularly from the VLCB core to let the service perform regular tasks.

Implementing service classes shall implement this to perform tasks specific to that service such as polling for changes of input pins. This method does not need to be implemented if there are no such regular tasks for the service.

Reimplemented from VLCB::Service.

◆ processAction()

void VLCB::CanService::processAction ( const Action & action)
overridevirtual

Called when there is an action available.

This method does not need to be implemented if the service does react to any actions.

Parameters
actionThe action that the service may have interest in.

Reimplemented from VLCB::Service.

Member Data Documentation

◆ canTransport

CanTransport* VLCB::CanService::canTransport
protected

The documentation for this class was generated from the following files: