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.
This commit is contained in:
parent
954da749eb
commit
e3784fa9c7
20 changed files with 357 additions and 82 deletions
|
@ -20,7 +20,8 @@
|
|||
|
||||
uint8_t valve;
|
||||
|
||||
int valve_from_string (const char *name, const char *uri, const char *s)
|
||||
int valve_from_string
|
||||
(const char *name, const char *uri, const char *query, const char *s)
|
||||
{
|
||||
uint32_t tmp = strtoul (s, NULL, 10);
|
||||
if (tmp) {
|
||||
|
@ -49,7 +50,13 @@ int valve_from_string (const char *name, const char *uri, const char *s)
|
|||
}
|
||||
|
||||
size_t
|
||||
valve_to_string (const char *name, const char *uri, char *buf, size_t bufsize)
|
||||
valve_to_string
|
||||
( const char *name
|
||||
, const char *uri
|
||||
, const char *query
|
||||
, char *buf
|
||||
, size_t bufsize
|
||||
)
|
||||
{
|
||||
return snprintf (buf, bufsize, "%d", valve);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ void setup (void)
|
|||
digitalWrite (BRIDGE2_PIN, LOW);
|
||||
|
||||
rest_init_engine ();
|
||||
rest_activate_resource (&res_valve, "valve");
|
||||
rest_activate_resource (&res_valve, (char *)"valve");
|
||||
}
|
||||
|
||||
void loop (void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue