diff options
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r-- | apps/gui/gwps-common.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index a0e09b8117..bcaebc502b 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include "system.h" | 27 | #include "system.h" |
28 | #include "settings.h" | 28 | #include "settings.h" |
29 | #include "settings_list.h" | ||
29 | #include "rbunicode.h" | 30 | #include "rbunicode.h" |
30 | #include "rtc.h" | 31 | #include "rtc.h" |
31 | #include "audio.h" | 32 | #include "audio.h" |
@@ -1402,6 +1403,53 @@ static const char *get_token_value(struct gui_wps *gwps, | |||
1402 | token->value.i * TIMEOUT_UNIT)) | 1403 | token->value.i * TIMEOUT_UNIT)) |
1403 | return "v"; | 1404 | return "v"; |
1404 | return NULL; | 1405 | return NULL; |
1406 | |||
1407 | case WPS_TOKEN_SETTING: | ||
1408 | { | ||
1409 | if (intval) | ||
1410 | { | ||
1411 | /* Handle contionals */ | ||
1412 | const struct settings_list *s = settings+token->value.i; | ||
1413 | switch (s->flags&F_T_MASK) | ||
1414 | { | ||
1415 | case F_T_INT: | ||
1416 | case F_T_UINT: | ||
1417 | if (s->flags&F_RGB) | ||
1418 | /* %?St|name|<#000000|#000001|...|#FFFFFF> */ | ||
1419 | /* shouldn't overflow since colors are stored | ||
1420 | * on 16 bits ... | ||
1421 | * but this is pretty useless anyway */ | ||
1422 | *intval = *(int*)s->setting + 1; | ||
1423 | else if (s->cfg_vals == NULL) | ||
1424 | /* %?St|name|<1st choice|2nd choice|...> */ | ||
1425 | *intval = (*(int*)s->setting-s->int_setting->min) | ||
1426 | /s->int_setting->step + 1; | ||
1427 | else | ||
1428 | /* %?St|name|<1st choice|2nd choice|...> */ | ||
1429 | /* Not sure about this one. cfg_name/vals are | ||
1430 | * indexed from 0 right? */ | ||
1431 | *intval = *(int*)s->setting + 1; | ||
1432 | break; | ||
1433 | case F_T_BOOL: | ||
1434 | /* %?St|name|<if true|if false> */ | ||
1435 | *intval = *(bool*)s->setting?1:2; | ||
1436 | break; | ||
1437 | case F_T_CHARPTR: | ||
1438 | /* %?St|name|<if non empty string|if empty> | ||
1439 | * The string's emptyness discards the setting's | ||
1440 | * prefix and suffix */ | ||
1441 | *intval = ((char*)s->setting)[0]?1:2; | ||
1442 | break; | ||
1443 | default: | ||
1444 | /* This shouldn't happen ... but you never know */ | ||
1445 | *intval = -1; | ||
1446 | break; | ||
1447 | } | ||
1448 | } | ||
1449 | cfg_to_string(token->value.i,buf,buf_size); | ||
1450 | return buf; | ||
1451 | } | ||
1452 | |||
1405 | default: | 1453 | default: |
1406 | return NULL; | 1454 | return NULL; |
1407 | } | 1455 | } |