Template
Chargement...
Recherche...
Aucune correspondance
GPSP.h
1#ifndef GPSP_h
2#define GPSP_h
3#include "Arduino.h"
4#include "QList.h"
5
6typedef void (*GPSPCallBack)(Stream &stream, const char args[][50], int size);
7struct Command {
12 GPSPCallBack callback;
13 char* name;
15};
16class GPSP {
17 public:
18 GPSP(Stream &stream);
19 void defineCommand(Command command);
20 void update();
21
22 static void printError(Stream &stream, const char *errorMessage);
23 Stream& getStream();
24
25 private:
26 char args_temp[10][50]; // Used to temporarily store retrieved Arguments
27 char buffer[500];
28 int index = 0;
29
30 void processBuffer();
31 void helpCommand(const char args[][50], int size);
32 void printCommand(Command command);
33
34 Stream *stream;
35 QList<Command> commandList = QList<Command>();
36};
37
38#endif
Definition: GPSP.h:16
static void printError(Stream &stream, const char *errorMessage)
Prints "Error:" followed by the message.
Definition: GPSP.cpp:75
void defineCommand(Command command)
Adds a new command to the List of Commands.
Definition: GPSP.cpp:20
Stream & getStream()
Return the stream used by this GPSP instance.
Definition: GPSP.cpp:94
void update()
Reads available data from Stream and stores it in a buffer until a NewLine or Semicolon is encountere...
Definition: GPSP.cpp:55
Definition: QList.h:10
Definition: GPSP.h:7
char * description
Definition: GPSP.h:14
GPSPCallBack callback
Definition: GPSP.h:12
char * name
Definition: GPSP.h:13