-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicDriver.h
More file actions
82 lines (65 loc) · 1.48 KB
/
DynamicDriver.h
File metadata and controls
82 lines (65 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Arduino Control Library
* Arduino library to call functions via serial
* based on Christophe Diericx's library
* https://github.com/christophediericx/ArduinoDriver/blob/master/Source/ArduinoDriver/ArduinoListener/ArduinoListener.ino
*
* Name: DynamicDriver
* Author: Alejandro Guardiola
* License: MIT
* Special Thanks to Christophe Diericx
*/
#ifndef _DynamicDriver_h
#define _DynamicDriver_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
#define dataMaxSize 128
#define dataRealSize 128 + 4
enum FunctionType
{
BOOLEANT=0,
CHART,
UCHART,
BYTET,
INTT,
UINTT,
WORD,
LONG,
ULONG,
SHORT,
VOIDT
};
//represent a method to call via serial
class Function
{
public:
Function();
~Function();
//Get the function info
virtual FunctionType getReturnType() {};
virtual int getArgumentsCount() {};
virtual FunctionType* getArgumentTypes() {};
//InvokingTheFunction
virtual void execute(void** arguments, void* returnValue) = 0;
private:
};
class DynamicDriver
{
public:
DynamicDriver();
~DynamicDriver();
virtual Function* getFunction(byte commandByte) {};
void setup();
void loop();
private:
int functionsSize;
Function** functions; //The functions
byte data[dataRealSize]; //the data
byte commandByte, lengthByte, syncByte, fletcherByte1, fletcherByte2;
unsigned int fletcher16, f0, f1, c0, c1;
void* argumentsData[15];
};
#endif