Pages: [1]   Go Down
Author Topic: Library for setup your arduino program during the run time  (Read 603 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello every body,
excuse me for my poor english smiley

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

 
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 553
Posts: 46283
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#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:
ArduiParamItem::ArduiParamItem(char *str , CB_ARDUI_COMMAND cb)
{
strcpy(strCmd,str);
cmd = cb;
strCmd is 6 elements long. What is
Code:
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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

 
Logged

Pages: [1]   Go Up
Jump to: