Merge pull request #5 from piccaso/max-age
Triggerboard: set max-age header
This commit is contained in:
commit
c7de6343d9
2 changed files with 5 additions and 0 deletions
3
examples/osd/triggerbaord/resources/res-event.c
Normal file → Executable file
3
examples/osd/triggerbaord/resources/res-event.c
Normal file → Executable file
|
@ -93,6 +93,9 @@ res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferr
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A post_handler that handles subscriptions/observing will be called for periodic resources by the framework. */
|
/* A post_handler that handles subscriptions/observing will be called for periodic resources by the framework. */
|
||||||
|
|
||||||
|
// tell client when to schedule re-registration: 1 Hour
|
||||||
|
REST.set_header_max_age(response, /* uint32_t, Seconds */ 3600);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Additionally, res_event_handler must be implemented for each EVENT_RESOURCE.
|
* Additionally, res_event_handler must be implemented for each EVENT_RESOURCE.
|
||||||
|
|
2
examples/osd/triggerbaord/sketch.pde
Normal file → Executable file
2
examples/osd/triggerbaord/sketch.pde
Normal file → Executable file
|
@ -45,11 +45,13 @@ void setup (void)
|
||||||
SENSORS_ACTIVATE(button_sensor);
|
SENSORS_ACTIVATE(button_sensor);
|
||||||
// init coap resourcen
|
// init coap resourcen
|
||||||
rest_init_engine ();
|
rest_init_engine ();
|
||||||
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
rest_activate_resource (&res_led, "s/led");
|
rest_activate_resource (&res_led, "s/led");
|
||||||
rest_activate_resource (&res_bled, "s/bled");
|
rest_activate_resource (&res_bled, "s/bled");
|
||||||
rest_activate_resource (&res_battery, "s/battery");
|
rest_activate_resource (&res_battery, "s/battery");
|
||||||
rest_activate_resource (&res_cputemp, "s/cputemp");
|
rest_activate_resource (&res_cputemp, "s/cputemp");
|
||||||
rest_activate_resource(&res_event, "s/button");
|
rest_activate_resource(&res_event, "s/button");
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
// NETSTACK_MAC.off(1);
|
// NETSTACK_MAC.off(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue