Skip to content

Commit 7fcb992

Browse files
committed
System Variable Prototype
Prototype is created to attach system variables to Commander object statically. This way it is accesable across all Commander objects. Quick and dirty example is also created.
1 parent 88addd9 commit 7fcb992

File tree

40 files changed

+539
-32
lines changed

40 files changed

+539
-32
lines changed

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"files.associations": {
33
"*.example": "cpp",
44
"type_traits": "cpp",
5-
"xtr1common": "cpp"
5+
"xtr1common": "cpp",
6+
"compare": "cpp",
7+
"utility": "cpp",
8+
"xutility": "cpp"
69
}
710
}

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ if( BUILD_EXAMPLES )
116116
add_executable( Description ${SOURCES} ${CUSTOM_COMMANDS} extras/examples_desktop/Desktop/Description/Description.cpp )
117117
add_executable( Help ${SOURCES} ${CUSTOM_COMMANDS} extras/examples_desktop/Desktop/Help/Help.cpp )
118118
add_executable( Interactive ${SOURCES} ${CUSTOM_COMMANDS} extras/examples_desktop/Desktop/Interactive/Interactive.cpp )
119+
add_executable( Systemvariables ${SOURCES} ${CUSTOM_COMMANDS} extras/examples_desktop/Desktop/Systemvariables/Systemvariables.cpp )
119120
endif()
120121
if( BUILD_WEBASSEMBLY )
121122
add_executable( Argumentadvanced ${SOURCES} ${CUSTOM_COMMANDS} extras/examples_emscripten/Emscripten/Argumentadvanced/Argumentadvanced.cpp )
@@ -139,4 +140,7 @@ if( BUILD_WEBASSEMBLY )
139140
add_executable( Interactive ${SOURCES} ${CUSTOM_COMMANDS} extras/examples_emscripten/Emscripten/Interactive/Interactive.cpp )
140141
target_link_options( Interactive PUBLIC -sNO_EXIT_RUNTIME=1 -sFORCE_FILESYSTEM=1 -sRETAIN_COMPILER_SETTINGS -sASYNCIFY )
141142

143+
add_executable( Systemvariables ${SOURCES} ${CUSTOM_COMMANDS} extras/examples_emscripten/Emscripten/Systemvariables/Systemvariables.cpp )
144+
target_link_options( Systemvariables PUBLIC -sNO_EXIT_RUNTIME=1 -sFORCE_FILESYSTEM=1 -sRETAIN_COMPILER_SETTINGS -sASYNCIFY )
145+
142146
endif()

examples/Arduino UNO/Argumentadvanced/Argumentadvanced.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2023 - Daniel Hajnal
66
77
* This file is part of the Commander-API project.
8-
* Modified 2023.Jul.30
8+
* Modified 2023.Aug.04
99
*
1010
* This is a simple example, that demonstrates how
1111
* to use the base functionality of th Commander-API.

examples/Arduino UNO/Argumentbasic/Argumentbasic.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2023 - Daniel Hajnal
66
77
* This file is part of the Commander-API project.
8-
* Modified 2023.Jul.30
8+
* Modified 2023.Aug.04
99
*
1010
* This is a simple example, that demonstrates how
1111
* to use the base functionality of th Commander-API.

examples/Arduino UNO/Basic/Basic.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2023 - Daniel Hajnal
66
77
* This file is part of the Commander-API project.
8-
* Modified 2023.Jul.30
8+
* Modified 2023.Aug.04
99
*
1010
* This is a simple example, that demonstrates how
1111
* to use the base functionality of th Commander-API.

examples/Arduino UNO/Description/Description.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2023 - Daniel Hajnal
66
77
* This file is part of the Commander-API project.
8-
* Modified 2023.Jul.30
8+
* Modified 2023.Aug.04
99
*
1010
* This is a simple example, that demonstrates how
1111
* to use the base functionality of th Commander-API.

examples/Arduino UNO/Help/Help.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2023 - Daniel Hajnal
66
77
* This file is part of the Commander-API project.
8-
* Modified 2023.Jul.30
8+
* Modified 2023.Aug.04
99
*
1010
* This is a simple example, that demonstrates how
1111
* to use the base functionality of th Commander-API.

examples/Arduino UNO/Interactive/Interactive.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2023 - Daniel Hajnal
66
77
* This file is part of the Commander-API project.
8-
* Modified 2023.Jul.30
8+
* Modified 2023.Aug.04
99
*
1010
* This is a simple example, that demonstrates how
1111
* to use the base functionality of th Commander-API.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
/*
3+
* Created on 2023.Jun.25
4+
*
5+
* Copyright (c) 2023 - Daniel Hajnal
6+
7+
* This file is part of the Commander-API project.
8+
* Modified 2023.Aug.04
9+
*
10+
* This is a simple example, that demonstrates how
11+
* to use the base functionality of th Commander-API.
12+
*/
13+
14+
15+
// Necessary includes.
16+
#include "Commander-API.hpp"
17+
#include "Commander-IO.hpp"
18+
19+
20+
21+
22+
23+
24+
// System init section.
25+
void setup(){
26+
27+
Serial.begin(115200);
28+
29+
float reactor = 10.5;
30+
int index = 3;
31+
char text[] = "Hello bello";
32+
33+
Commander::SystemVariable_t systemVariables[] = {
34+
systemVariable( "reactor", Commander::VARIABLE_FLOAT, &reactor ),
35+
systemVariable( "index", Commander::VARIABLE_INT, &index ),
36+
systemVariable( "text", Commander::VARIABLES_STRING, text )
37+
};
38+
39+
Commander::attachVariables( systemVariables );
40+
41+
Commander::SystemVariable_t* var = Commander::getSystemVariable( "reactor" );
42+
43+
if( var != NULL ){
44+
print( var -> data.f );
45+
}
46+
47+
48+
}
49+
50+
// Infinite loop.
51+
void loop(){
52+
53+
54+
55+
}

extras/example_database/argumentAdvanced.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ EXCLUDE=NONE
55
/*
66
* Created on 2023.Jun.25
77
*
8-
* Copyright (c) {{ YEAR }} - Daniel Hajnal
8+
* Copyright (c) 2023 - Daniel Hajnal
99
1010
* This file is part of the Commander-API project.
1111
* Modified {{ YEAR }}.{{ MONTH }}.{{ DAY }}

0 commit comments

Comments
 (0)