Open FFBoard
Open source force feedback firmware
Loading...
Searching...
No Matches
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
20
21
22
24 registerCommands(); // Register all the commands
25}
26
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:11
virtual ~CustomMain()
const ClassIdentifier getInfo()
std::string getHelpstring()
int32_t examplevar
Definition CustomMain.h:30
void registerCommands()