summaryrefslogtreecommitdiff
path: root/apps/gui/wps_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/wps_parser.c')
-rw-r--r--apps/gui/wps_parser.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 88601fd9eb..22b161155e 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -56,6 +56,7 @@
56 56
57#include "gwps.h" 57#include "gwps.h"
58#include "settings.h" 58#include "settings.h"
59#include "settings_list.h"
59 60
60#ifdef HAVE_LCD_BITMAP 61#ifdef HAVE_LCD_BITMAP
61#include "bmp.h" 62#include "bmp.h"
@@ -137,6 +138,8 @@ static int parse_progressbar(const char *wps_bufptr,
137 struct wps_token *token, struct wps_data *wps_data); 138 struct wps_token *token, struct wps_data *wps_data);
138static int parse_dir_level(const char *wps_bufptr, 139static int parse_dir_level(const char *wps_bufptr,
139 struct wps_token *token, struct wps_data *wps_data); 140 struct wps_token *token, struct wps_data *wps_data);
141static int parse_setting(const char *wps_bufptr,
142 struct wps_token *token, struct wps_data *wps_data);
140 143
141#ifdef HAVE_LCD_BITMAP 144#ifdef HAVE_LCD_BITMAP
142static int parse_viewport_display(const char *wps_bufptr, 145static int parse_viewport_display(const char *wps_bufptr,
@@ -342,6 +345,8 @@ static const struct wps_tag all_tags[] = {
342#endif 345#endif
343#endif 346#endif
344 347
348 { WPS_TOKEN_SETTING, "St", WPS_REFRESH_DYNAMIC, parse_setting },
349
345 { WPS_TOKEN_UNKNOWN, "", 0, NULL } 350 { WPS_TOKEN_UNKNOWN, "", 0, NULL }
346 /* the array MUST end with an empty string (first char is \0) */ 351 /* the array MUST end with an empty string (first char is \0) */
347}; 352};
@@ -726,6 +731,39 @@ static int parse_viewport(const char *wps_bufptr,
726 return skip_end_of_line(wps_bufptr); 731 return skip_end_of_line(wps_bufptr);
727} 732}
728 733
734static int parse_setting(const char *wps_bufptr,
735 struct wps_token *token,
736 struct wps_data *wps_data)
737{
738 (void)wps_data;
739 const char *ptr = wps_bufptr;
740 const char *end;
741 int i;
742
743 /* Find the setting's cfg_name */
744 if (*ptr != '|')
745 return WPS_ERROR_INVALID_PARAM;
746 ptr++;
747 end = strchr(ptr,'|');
748 if (!end)
749 return WPS_ERROR_INVALID_PARAM;
750
751 /* Find the setting */
752 for (i=0; i<nb_settings; i++)
753 if (settings[i].cfg_name &&
754 !strncmp(settings[i].cfg_name,ptr,end-ptr) &&
755 /* prevent matches on cfg_name prefixes */
756 strlen(settings[i].cfg_name)==end-ptr) break;
757 if (i == nb_settings)
758 return WPS_ERROR_INVALID_PARAM;
759
760 /* Store the setting number */
761 token->value.i = i;
762
763 /* Skip the rest of the line */
764 return end-ptr+2;
765}
766
729 767
730#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) 768#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
731static int parse_image_special(const char *wps_bufptr, 769static int parse_image_special(const char *wps_bufptr,