Dependencies: net lpc1768 crypto clock web log
http-derived/home/http-home-query.c@27:eb5728b9052b, 2019-01-17 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu Jan 17 13:43:35 2019 +0000
- Revision:
- 27:eb5728b9052b
- Child:
- 28:7fb6b4e9ab80
Updated http-base library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 27:eb5728b9052b | 1 | #include <string.h> |
andrewboyson | 27:eb5728b9052b | 2 | #include <stdlib.h> |
andrewboyson | 27:eb5728b9052b | 3 | #include <stdio.h> |
andrewboyson | 27:eb5728b9052b | 4 | |
andrewboyson | 27:eb5728b9052b | 5 | #include "http.h" |
andrewboyson | 27:eb5728b9052b | 6 | #include "clkgov.h" |
andrewboyson | 27:eb5728b9052b | 7 | #include "clkutc.h" |
andrewboyson | 27:eb5728b9052b | 8 | #include "led.h" |
andrewboyson | 27:eb5728b9052b | 9 | #include "settings.h" |
andrewboyson | 27:eb5728b9052b | 10 | |
andrewboyson | 27:eb5728b9052b | 11 | void HttpHomeQuery(char* pQuery) |
andrewboyson | 27:eb5728b9052b | 12 | { |
andrewboyson | 27:eb5728b9052b | 13 | while (pQuery) |
andrewboyson | 27:eb5728b9052b | 14 | { |
andrewboyson | 27:eb5728b9052b | 15 | char* pName; |
andrewboyson | 27:eb5728b9052b | 16 | char* pValue; |
andrewboyson | 27:eb5728b9052b | 17 | pQuery = HttpSplitQuery(pQuery, &pName, &pValue); |
andrewboyson | 27:eb5728b9052b | 18 | |
andrewboyson | 27:eb5728b9052b | 19 | if (strcmp(pName, "chg-clock-leap-enable" ) == 0) ClkUtcTglNextLeapEnable (); |
andrewboyson | 27:eb5728b9052b | 20 | if (strcmp(pName, "chg-clock-leap-forward") == 0) ClkUtcTglNextLeapForward(); |
andrewboyson | 27:eb5728b9052b | 21 | |
andrewboyson | 27:eb5728b9052b | 22 | int months1970 = ClkUtcGetNextEpochMonth1970(); |
andrewboyson | 27:eb5728b9052b | 23 | int months = months1970 % 12; |
andrewboyson | 27:eb5728b9052b | 24 | int years = months1970 / 12; |
andrewboyson | 27:eb5728b9052b | 25 | |
andrewboyson | 27:eb5728b9052b | 26 | if (strcmp(pName, "set-clock-leap-year" ) == 0) |
andrewboyson | 27:eb5728b9052b | 27 | { |
andrewboyson | 27:eb5728b9052b | 28 | years = strtol(pValue, NULL, 10) - 1970; |
andrewboyson | 27:eb5728b9052b | 29 | if (years < 0) years = 0; |
andrewboyson | 27:eb5728b9052b | 30 | ClkUtcSetNextEpochMonth1970(years * 12 + months); |
andrewboyson | 27:eb5728b9052b | 31 | } |
andrewboyson | 27:eb5728b9052b | 32 | if (strcmp(pName, "set-clock-leap-month" ) == 0) |
andrewboyson | 27:eb5728b9052b | 33 | { |
andrewboyson | 27:eb5728b9052b | 34 | months = strtol(pValue, NULL, 10) - 1; |
andrewboyson | 27:eb5728b9052b | 35 | if (months < 0) months = 0; |
andrewboyson | 27:eb5728b9052b | 36 | ClkUtcSetNextEpochMonth1970(years * 12 + months); |
andrewboyson | 27:eb5728b9052b | 37 | } |
andrewboyson | 27:eb5728b9052b | 38 | if (strcmp(pName, "set-clock-leap-count" ) == 0) |
andrewboyson | 27:eb5728b9052b | 39 | { |
andrewboyson | 27:eb5728b9052b | 40 | uint16_t leaps = strtol(pValue, NULL, 10); |
andrewboyson | 27:eb5728b9052b | 41 | ClkUtcSetEpochOffset(leaps); |
andrewboyson | 27:eb5728b9052b | 42 | } |
andrewboyson | 27:eb5728b9052b | 43 | |
andrewboyson | 27:eb5728b9052b | 44 | int value = (int)strtol(pValue, NULL, 10); |
andrewboyson | 27:eb5728b9052b | 45 | if (strcmp(pName, "ppb" ) == 0) ClkGovSetPpb (value ); |
andrewboyson | 27:eb5728b9052b | 46 | if (strcmp(pName, "slewdivisor" ) == 0) SetClockSlewDivisor (value ); |
andrewboyson | 27:eb5728b9052b | 47 | if (strcmp(pName, "slewmax" ) == 0) SetClockSlewMaxMs (value ); |
andrewboyson | 27:eb5728b9052b | 48 | if (strcmp(pName, "ppbdivisor" ) == 0) SetClockPpbDivisor (value ); |
andrewboyson | 27:eb5728b9052b | 49 | if (strcmp(pName, "ppbmaxchange" ) == 0) SetClockPpbChangeMax (value ); |
andrewboyson | 27:eb5728b9052b | 50 | if (strcmp(pName, "syncedlimitns" ) == 0) SetClockSyncedLimitNs (value * 1000000 ); |
andrewboyson | 27:eb5728b9052b | 51 | if (strcmp(pName, "syncedhysns" ) == 0) SetClockSyncedHysterisNs (value * 1000000 ); |
andrewboyson | 27:eb5728b9052b | 52 | if (strcmp(pName, "syncedlimitppb") == 0) SetClockSyncedLimitPpb (value ); |
andrewboyson | 27:eb5728b9052b | 53 | if (strcmp(pName, "syncedhysppb" ) == 0) SetClockSyncedHysterisPpb (value ); |
andrewboyson | 27:eb5728b9052b | 54 | if (strcmp(pName, "maxoffsetsecs" ) == 0) SetClockMaxOffsetSecs (value ); |
andrewboyson | 27:eb5728b9052b | 55 | if (strcmp(pName, "clockgovtrace" ) == 0) ChgTraceSync(); |
andrewboyson | 27:eb5728b9052b | 56 | } |
andrewboyson | 27:eb5728b9052b | 57 | } |
andrewboyson | 27:eb5728b9052b | 58 |