Store string values for plugin settings [SOLVED]

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
jodur
New user
Posts: 1
Joined: 07 Jan 2018, 21:59

Store string values for plugin settings [SOLVED]

#1 Post by jodur » 07 Jan 2018, 22:19

I cant find any examples in the current plugins how to provide the user with a texbox where he can fill in a string (api key for example).

I am able to add the textboxes with

Code: Select all

 (addFormTextBox(string, F("Unit ID remote 1"), F("ID1"), Test1, 10) ) 
to te device settingspage, but the current pluging settings doesn't support the storage for strings in the ExtraTaskSetting structure.

The only way i can think off seem to be to create a specific Plugin Settingstructure who is stores and retreive its value from the flash with:

Code: Select all

String LoadFromFile(char* fname, int index, byte* memAddress, int datasize)
and

Code: Select all

String SaveToFile(char* fname, int index, byte* memAddress, int datasize)
Any other suggestions how to store strings for plugin sensor settings?


[SOLVED jodur 10-1-2018]
I didn't wait for a answer, there isn't an seperate forum for developers where you could post this kins of questions, so i went on to implement my own method.
For the reference have a look at the source-file i have developed;https://github.com/jodur/ESPEASY_Plugin_ITHO

After editing the above comment i just saw another post that handles custom settings, who i could have used to store the string! :oops:

I should have used:

SaveCustomTaskSettings(event->TaskIndex, (byte*)&PLUGIN_145_ExtraSettings, sizeof(PLUGIN_145_ExtraSettings));
LoadCustomTaskSettings(event->TaskIndex, (byte*)&PLUGIN_145_ExtraSetting , sizeof(PLUGIN_145_ExtraSettings));

Post Reply

Who is online

Users browsing this forum: No registered users and 42 guests