VLCB
Loading...
Searching...
No Matches
AbstractEventTeachingService.h
Go to the documentation of this file.
1// Copyright (C) Sven Rosvall (sven@rosvall.ie)
2// This file is part of VLCB-Arduino project on https://github.com/SvenRosvall/VLCB-Arduino
3// Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
4// The full licence can be found at: http://creativecommons.org/licenses/by-nc-sa/4.0/
5
6#pragma once
7
8#include "Service.h"
9
10namespace VLCB
11{
12
13struct VlcbMessage;
14
19{
20public:
23 void setEventValidator(byte (*func)(int nn, int en, byte evNum, byte evVal)) { validatorFunc = func; }
24
26 virtual Data getServiceData() override;
27
28 void enableLearn();
29 void inhibitLearn();
30
31protected:
32 bool bLearn = false;
33 byte (*validatorFunc)(int nn, int en, byte evNum, byte evVal) = nullptr;
34 unsigned int diagEventsTaught = 0;
35
36 void handleMessage(const VlcbMessage *msg);
37
39
40private:
41 void handleLearnMode(const VlcbMessage *msg, unsigned int nn);
42 void handleLearn(unsigned int nn);
43 void handleUnlearnEvent(const VlcbMessage *msg, unsigned int nn);
44 void handleUnlearn(unsigned int nn);
45 void handleRequestEventCount(unsigned int nn);
46 void handleReadEvents(unsigned int nn);
47 void handleReadEventVariable(const VlcbMessage *msg, unsigned int nn);
48 void handleClearEvents(unsigned int nn);
49 void handleGetFreeEventSlots(unsigned int nn);
50};
51
52} // VLCB
Base class for teaching services.
Definition AbstractEventTeachingService.h:19
byte(* validatorFunc)(int nn, int en, byte evNum, byte evVal)
Definition AbstractEventTeachingService.h:33
unsigned int diagEventsTaught
Definition AbstractEventTeachingService.h:34
virtual Data getServiceData() override
Return Data bytes specific for the implementing service. The meaning of each data byte is defined in ...
Definition AbstractEventTeachingService.cpp:15
void enableLearn()
Definition AbstractEventTeachingService.cpp:21
void setEventValidator(byte(*func)(int nn, int en, byte evNum, byte evVal))
Definition AbstractEventTeachingService.h:23
void inhibitLearn()
Definition AbstractEventTeachingService.cpp:28
bool bLearn
Definition AbstractEventTeachingService.h:32
void handleMessage(const VlcbMessage *msg)
Definition AbstractEventTeachingService.cpp:35
Interface base class for all VLCB services.
Definition Service.h:25
Definition AbstractEventTeachingService.cpp:13
CAN/Controller message type.
Definition Controller.h:30