Go Down

Topic: Library for setup your arduino program during the run time (Read 680 times) previous topic - next topic

Jmax33

Hello every body,
excuse me for my poor english :)

I post a library for set or read your global variable with command text ( like AT command)

my project is into github server :
https://github.com/jmax33/ArduinoParam


PaulS

Code: [Select]
#ifdef ARDUI_DEBUG_X86
using namespace std;
#endif

Bad idea. You should never drag the entire namespace in. Put in "using std::xxxx" statements only for those symbols that you actually use.

Why do your classes not have destructors? Yes, default destructors are generated, but they don't manage the dynamically allocated data of your class. So, potential memory leaks exist.

Code: [Select]
ArduiParamItem::ArduiParamItem(char *str , CB_ARDUI_COMMAND cb)
{
strcpy(strCmd,str);
cmd = cb;

strCmd is 6 elements long. What is
Code: [Select]
ArduiParamItem item("SomeNiceLongName", NULL);
going to do? Overflow your buffer, and mess up something else, that's what. Some error checking is in order.

Some explanation about how this functionality should be used would be useful.

Jmax33

thanks you for your comments

I wanted my library uses minimal memory, and I doesn't use new and delete method, so I decided that the string of command had a maximum size of 5.

I think add a control in ArduiParamItem constructor to avoid  a buffer overflow

the ArduiParamItem items are global variables. and this create a link with a call back and string command

In my project repository, I add a example project :
https://github.com/jmax33/ArduinoParam/tree/master/exemple


Go Up