Commit graph

6 commits

Author SHA1 Message Date
Ralf Schlatterbeck e3784fa9c7 Add query parameter to generic resouce macros
Modify all callback functions to use new signature.
ota-update now uses this to pass the partition to some get/put methods.
2017-08-20 15:01:30 +02:00
Ralf Schlatterbeck 743245e230 Add 'x' prefix to time functions
.. to avoid name-clashes with (some) libraries. This now also should
make it work for the 'native' target (untested).
2016-03-29 17:48:59 +02:00
Ralf Schlatterbeck c6165a3bcf Refactor GENERIC_RESOURCE macro
Now callback functions get the URI of the request, this allows to use a
single resource for multiple different URIs.
The is_json flag is now gone for the to-string function, instead the
macro has an is_str flag. If set this automagically produces quotes
around the string for json output.
Now from-string functions can return an error-code, 0 for success, -1
for error.
2016-02-26 17:13:48 +01:00
Ralf Schlatterbeck baaa2c5741 Factor/Fix generic resources
Now the old GENERIC_RESOURCE macros works again (but usage has changed).
Common resources (battery, leds, radio) are now in resources-common.
2015-01-21 15:41:21 +01:00
Ralf Schlatterbeck d5284eebe1 Factor resources, fix time
Now there is a generic resource that can generate and parse
application/json as well as text/plain. It can be re-used, only the
from_string and to_string routines have to be written and the resource
properly set up. A new resource format is specified, see
GENERIC_RESOURCE in, e.g., examples/osd/pwm-example. This is now used in
all my examples, namely pwm-example, arduino-sketch, wallclock-time.

There was an off by one error for the month in time formatting (in
gmtime and localtime). And the leap-year computation was broken. Both
fixed now, so we get a correct date. For localtime we are still 2 hours
off because daylight saving isn't implemented yet.

Also renamed gmtime to utc.
2014-11-19 13:53:12 +01:00
Ralf Schlatterbeck b4fb8c3f52 Add wallclock time handling
New application and new example.
We use the built-in timer routines and add an offset to get the
wallclock time. The offset can be set by time-changing routines
(currently only settimeofday).
We also maintain an offset for timezone handling but this isn't
currently fully implemented.
2014-11-19 13:43:45 +01:00