Open FFBoard
Open source force feedback firmware
CustomMain.cpp
Go to the documentation of this file.
1/*
2 * exampleMain.cpp
3 *
4 * Created on: 23.01.2020
5 * Author: Yannick
6 */
7
8#include <CustomMain.h>
9
10// Change this
12 .name = "Custom" ,
13 .id=CLSID_CUSTOM,
14 .visibility = ClassVisibility::hidden
15 };
16// Copy this to your class for identification
18 return info;
19}
20
21
22
24 registerCommands(); // Register all the commands
25}
26
28
29}
30
32 CommandHandler::registerCommands(); // Register internal commands for getting the id and help
33 registerCommand("command", CustomMain_commands::command, "Controls the example variable");
34}
35
37 return "This is a basic example mainclass with commands";
38}
39
40CommandStatus CustomMain::command(const ParsedCommand& cmd,std::vector<CommandReply>& replies){
41 switch(static_cast<CustomMain_commands>(cmd.cmdId))
42 {
43
45 // Sets or gets the variable
46 handleGetSet(cmd, replies, this->examplevar);
47 break;
48
49
50 default:
52 }
53 return CommandStatus::OK;
54}
CommandStatus
void registerCommand(const char *cmd, const ID cmdid, const char *help=nullptr, uint32_t flags=0)
static CommandStatus handleGetSet(const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value)
static ClassIdentifier info
Definition: CustomMain.h:23
CustomMain_commands
Definition: CustomMain.h:14
CommandStatus command(const ParsedCommand &cmd, std::vector< CommandReply > &replies)
Definition: CustomMain.cpp:40
virtual ~CustomMain()
Definition: CustomMain.cpp:27
const ClassIdentifier getInfo()
Definition: CustomMain.cpp:17
std::string getHelpstring()
Definition: CustomMain.cpp:36
int32_t examplevar
Definition: CustomMain.h:30
void registerCommands()
Definition: CustomMain.cpp:31
const char * name
uint32_t cmdId