|
VLCB
|
Classes | |
| class | RespondEvents |
| class | RespondEventVar |
| class | AbstractEventTeachingService |
| Base class for teaching services. More... | |
| class | ArrayHolder |
| class | CanService |
| Service for sending and receiving messages on a CAN bus. More... | |
| class | CanServiceWithDiagnostics |
| struct | CANFrame |
| Represents a CAN frame sent on the CAN bus. More... | |
| class | CanTransport |
| Interface base class for CAN transport implementations. More... | |
| class | CircularBuffer |
| class | Configuration |
| a class to encapsulate Controller module configuration, events, NVs, EEPROM, etc More... | |
| class | ConsumeOwnEventsService |
| Service for consuming events that this node has produced. More... | |
| struct | VlcbMessage |
| CAN/Controller message type. More... | |
| struct | Action |
| An action to be performed. More... | |
| class | Controller |
| Main object in VLCB. Coordinates transport, ui, configuration and services. More... | |
| class | DueEepromEmulationStorage |
| class | EepromExternalStorage |
| class | EepromInternalStorage |
| class | EventConsumerService |
| Service for consuming events. More... | |
| class | EventConsumerServiceWithDiagnostics |
| class | EventProducerService |
| Service for producing events. More... | |
| class | EventProducerServiceWithDiagnostics |
| class | EventSlotTeachingService |
| Slot Event Teaching Service. More... | |
| class | RespondEV |
| class | EventTeachingService |
| Classic Event Teaching Service. More... | |
| class | EventTeachingServiceWithDiagnostics |
| class | FlashStorage |
| class | InternalDiagnosticsService |
| A dummy service that reports internal metrics as service diagnostics. More... | |
| class | LED |
| class to encapsulate a non-blocking LED More... | |
| class | LEDUserInterface |
| User interface "service" that communicates with LEDs and a push button. More... | |
| class | LongMessageService |
| struct | receive_context_t |
| struct | send_context_t |
| class | LongMessageServiceEx |
| a derived class to extend the base long message class to handle multiple concurrent messages, sending and receiving More... | |
| class | RespondParam |
| class | RespondService |
| class | MinimumNodeService |
| Mandatory Service for node. More... | |
| class | ServiceDiagnosticsResponse |
| class | AllServiceDiagnosticsResponse |
| class | MinimumNodeServiceWithDiagnostics |
| class | RespondNodeVar |
| class | NodeVariableService |
| Service for managing node variables. More... | |
| class | Parameters |
| class | SerialGC |
| Implementation of the Transport interface class to support the gridconnect protocol over serial connection. More... | |
| class | SerialUserInterface |
| User interface "service" that communicates via a serial connection. More... | |
| class | Service |
| Interface base class for all VLCB services. More... | |
| class | Storage |
| Interface for persistent storage. Used by Configuration class. More... | |
| class | Switch |
| class | TimedResponse |
| Manage tasks that respond with messages at timed intervals. More... | |
| class | Transport |
| Interface for statistics on the transport layer. More... | |
Enumerations | |
| enum | EepromLocations { LOCATION_MODE = 0 , LOCATION_CANID = 1 , LOCATION_NODE_NUMBER_HIGH = 2 , LOCATION_NODE_NUMBER_LOW = 3 , LOCATION_FLAGS = 4 , LOCATION_RESET_FLAG = 5 , LOCATION_RESERVED_SIZE = 10 } |
| enum | FlagBits { HEARTBEAT_BIT = 0 , EVENT_ACK_BIT = 1 , FCU_COMPATIBLE_BIT = 2 } |
| enum | ACTION : byte { ACT_MESSAGE_IN , ACT_MESSAGE_OUT , ACT_START_CAN_ENUMERATION , ACT_CHANGE_MODE , ACT_RENEGOTIATE , ACT_INDICATE_ACTIVITY , ACT_INDICATE_WORK , ACT_INDICATE_MODE } |
| Type of Action. More... | |
| enum | { LONG_MESSAGE_INCOMPLETE = 0 , LONG_MESSAGE_COMPLETE , LONG_MESSAGE_SEQUENCE_ERROR , LONG_MESSAGE_TIMEOUT_ERROR , LONG_MESSAGE_CRC_ERROR , LONG_MESSAGE_TRUNCATED } |
| Controller long message status codes. More... | |
Functions | |
| Storage * | createDefaultStorageForPlatform () |
| bool | encodeGridConnect (char *gcBuffer, CANFrame *frame) |
| bool | decodeGridConnect (const char *gcBuffer, CANFrame *frame) |
Startup Functions | |
| void | checkStartupAction (byte greenLedPin, byte yellowLedPin, byte pushButtonPin) |
| void | begin () |
Module Configuration | |
| void | setServices (std::initializer_list< Service * > services) |
| void | setName (char *mname) |
| void | setVersion (char maj, char min, char patch) |
| void | setModuleId (byte manu, byte moduleId) |
| void | setNumNodeVariables (byte n) |
| Set number of node variables that the module will use. | |
| void | setMaxEvents (byte n) |
| Set the max number of events the module can handle. | |
| void | setEventsStart (byte n) |
| Optional: Sets the address where event data starts in the EEPROM. | |
| void | setNumEventVariables (byte n) |
| Set the number of event variables that are used by each stored event. | |
Module Configuration Access | |
| VlcbModeParams | getCurrentMode () |
| byte | getCANID () |
| unsigned int | getNodeNum () |
| byte | readNV (byte nv) |
| void | writeNV (byte nv, byte val) |
| byte | getEventEVval (byte idx, byte evnum) |
| byte | findExistingEventByEv (int evIndex, byte value) |
| byte | findExistingEvent (unsigned int nn, unsigned int en) |
| bool | isEventIndexValid (byte eventIndex) |
| bool | doesEventExistAtIndex (byte eventIndex) |
| byte | findEmptyEventSpace () |
| void | createEventAtIndex (byte eventIndex, unsigned int nn, unsigned int en) |
| void | writeEventVariable (byte eventIndex, byte evIndex, byte value) |
| bool | sendMessageWithNN (VlcbOpCodes opc) |
| bool | sendMessageWithNN (VlcbOpCodes opc, byte b1) |
| bool | sendMessageWithNN (VlcbOpCodes opc, byte b1, byte b2) |
| bool | sendMessageWithNN (VlcbOpCodes opc, byte b1, byte b2, byte b3) |
| bool | sendMessageWithNN (VlcbOpCodes opc, byte b1, byte b2, byte b3, byte b4) |
| bool | sendMessageWithNN (VlcbOpCodes opc, byte b1, byte b2, byte b3, byte b4, byte b5) |
| void | addTimedResponseTask (TimedResponse::Task *task) |
| unsigned int | getFreeEEPROMbase () |
| void | resetModule () |
Running | |
| void | process () |
Variables | |
| const int | DEFAULT_PRIORITY = 0xB |
| const int | ACTION_QUEUE_SIZE = 8 |
| const int | FLASH_PAGE_SIZE = 512 |
| const int | NUM_FLASH_PAGES = 4 |
| const int | BLINK_RATE = 500 |
| const int | PULSE_ON_TIME = 10 |
| const unsigned int | SW_TR_HOLD = 4000U |
| const int | PULSE_ACTIVITY = 20 |
| const int | PULSE_WORK = 250 |
| const int | LONG_MESSAGE_DEFAULT_DELAY = 20 |
| const int | LONG_MESSAGE_RECEIVE_TIMEOUT = 5000 |
| const int | NUM_EX_CONTEXTS = 4 |
| const int | EX_BUFFER_LEN = 64 |
construct a Controller object with an external Configuration object named "config" that is defined in user code
Implementation of Controller Long Message Support RFC 0005 by Dave McCabe (M4933) Developed by Duncan Greenwood (M5767)
This VLCB library is built with an object-oriented architecture described in the design document. It uses a Controller object for the core tasks, a Configuration object for storing module configurations and a set of services.
The VLCB module code can be written in two different styles. One style is to define these objects and calling member functions of these objects.
The other style is to use functions in the VLCB namespace. These functions are "free" functions and do not require objects. These VLCB namespace functions are provided for convenience and clarity. Some are just forwarding calls to these objects while others do more work to simplify writing module code.
The example sketches are using the VLCB function style.
These functions are in the VLCB namespace to avoid name clashes with other libraries. Prefix each call with VLCB:: or add a using namespace VLCB; directive at the top of your code file.
| enum VLCB::FlagBits |
| enum VLCB::ACTION : byte |
Type of Action.
| anonymous enum |
Controller long message status codes.
| Enumerator | ||
|---|---|---|
| LONG_MESSAGE_INCOMPLETE | 0 | |
| LONG_MESSAGE_COMPLETE | ||
| LONG_MESSAGE_SEQUENCE_ERROR | ||
| LONG_MESSAGE_TIMEOUT_ERROR | ||
| LONG_MESSAGE_CRC_ERROR | ||
| LONG_MESSAGE_TRUNCATED | ||
| Storage * VLCB::createDefaultStorageForPlatform | ( | ) |
| bool VLCB::encodeGridConnect | ( | char * | gcBuffer, |
| CANFrame * | frame ) |
| bool VLCB::decodeGridConnect | ( | const char * | gcBuffer, |
| CANFrame * | frame ) |
| void VLCB::checkStartupAction | ( | byte | greenLedPin, |
| byte | yellowLedPin, | ||
| byte | pushButtonPin ) |
This is a helper function that can be called at the beginning of the setup() function. It performs a few checks at startup of the module. At the moment does:
| void VLCB::setServices | ( | std::initializer_list< Service * > | services | ) |
Set up the services to be used by the module. These services must be defined above in the code, outside any functions. The used services shall be listed with curly brackets, called an "initializer list". A call will look like this:
| void VLCB::setName | ( | char * | mname | ) |
Set the name of the module. The name shall be a string of max 7 characters.
| void VLCB::setVersion | ( | char | maj, |
| char | min, | ||
| char | patch ) |
Set major, minor and patch versions for the module. Note that maj and patch versions are numbers while min is a letter.
| void VLCB::setModuleId | ( | byte | manu, |
| byte | moduleId ) |
Set the module identification for the module. manu shall either be one of:
| void VLCB::setNumNodeVariables | ( | byte | n | ) |
Set number of node variables that the module will use.
| void VLCB::setMaxEvents | ( | byte | n | ) |
Set the max number of events the module can handle.
| void VLCB::setEventsStart | ( | byte | n | ) |
Optional: Sets the address where event data starts in the EEPROM.
| void VLCB::setNumEventVariables | ( | byte | n | ) |
Set the number of event variables that are used by each stored event.
| VlcbModeParams VLCB::getCurrentMode | ( | ) |
| byte VLCB::getCANID | ( | ) |
| unsigned int VLCB::getNodeNum | ( | ) |
| byte VLCB::readNV | ( | byte | nv | ) |
| void VLCB::writeNV | ( | byte | nv, |
| byte | val ) |
| byte VLCB::getEventEVval | ( | byte | idx, |
| byte | evnum ) |
| byte VLCB::findExistingEventByEv | ( | int | evIndex, |
| byte | value ) |
| byte VLCB::findExistingEvent | ( | unsigned int | nn, |
| unsigned int | en ) |
| bool VLCB::isEventIndexValid | ( | byte | eventIndex | ) |
| bool VLCB::doesEventExistAtIndex | ( | byte | eventIndex | ) |
| byte VLCB::findEmptyEventSpace | ( | ) |
| void VLCB::createEventAtIndex | ( | byte | eventIndex, |
| unsigned int | nn, | ||
| unsigned int | en ) |
| void VLCB::writeEventVariable | ( | byte | eventIndex, |
| byte | evIndex, | ||
| byte | value ) |
| bool VLCB::sendMessageWithNN | ( | VlcbOpCodes | opc | ) |
| bool VLCB::sendMessageWithNN | ( | VlcbOpCodes | opc, |
| byte | b1 ) |
| bool VLCB::sendMessageWithNN | ( | VlcbOpCodes | opc, |
| byte | b1, | ||
| byte | b2 ) |
| bool VLCB::sendMessageWithNN | ( | VlcbOpCodes | opc, |
| byte | b1, | ||
| byte | b2, | ||
| byte | b3 ) |
| bool VLCB::sendMessageWithNN | ( | VlcbOpCodes | opc, |
| byte | b1, | ||
| byte | b2, | ||
| byte | b3, | ||
| byte | b4 ) |
| bool VLCB::sendMessageWithNN | ( | VlcbOpCodes | opc, |
| byte | b1, | ||
| byte | b2, | ||
| byte | b3, | ||
| byte | b4, | ||
| byte | b5 ) |
| void VLCB::addTimedResponseTask | ( | TimedResponse::Task * | task | ) |
| unsigned int VLCB::getFreeEEPROMbase | ( | ) |
| void VLCB::resetModule | ( | ) |
| void VLCB::begin | ( | ) |
Call this function in the setup() function, after all configuration is complete. This initialises the internals of the VLCB library.
| void VLCB::process | ( | ) |
Call this in the loop()function. It lets the VLCB library core execute its tasks such as check for new incoming messages and run queued tasks.
| const int VLCB::DEFAULT_PRIORITY = 0xB |
| const int VLCB::ACTION_QUEUE_SIZE = 8 |
| const int VLCB::FLASH_PAGE_SIZE = 512 |
| const int VLCB::NUM_FLASH_PAGES = 4 |
| const int VLCB::BLINK_RATE = 500 |
| const int VLCB::PULSE_ON_TIME = 10 |
| const unsigned int VLCB::SW_TR_HOLD = 4000U |
| const int VLCB::PULSE_ACTIVITY = 20 |
| const int VLCB::PULSE_WORK = 250 |
| const int VLCB::LONG_MESSAGE_DEFAULT_DELAY = 20 |
| const int VLCB::LONG_MESSAGE_RECEIVE_TIMEOUT = 5000 |
| const int VLCB::NUM_EX_CONTEXTS = 4 |
| const int VLCB::EX_BUFFER_LEN = 64 |