Added ETSI IoT CoAP Plugtests server and tweaked rest-server-example.

This commit is contained in:
Matthias Kovatsch 2012-03-17 16:51:28 +01:00
parent e794088d19
commit 2aa1f587bd
2 changed files with 568 additions and 3 deletions

View file

@ -447,7 +447,7 @@ separate_finalize_handler()
* It takes an additional period parameter, which defines the interval to call [name]_periodic_handler().
* A default post_handler takes care of subscriptions by managing a list of subscribers to notify.
*/
PERIODIC_RESOURCE(pushing, METHOD_GET, "debug/push", "title=\"Periodic demo\";rt=\"Observable\"", 5*CLOCK_SECOND);
PERIODIC_RESOURCE(pushing, METHOD_GET, "debug/push", "title=\"Periodic demo\";obs", 5*CLOCK_SECOND);
void
pushing_handler(void* request, void* response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
@ -476,7 +476,7 @@ pushing_periodic_handler(resource_t *r)
/* Notify the registered observers with the given message type, observe option, and payload. */
REST.notify_subscribers(r->url, 1, periodic_i, (uint8_t *)content, snprintf(content, sizeof(content), "TICK %lu", periodic_i));
/* |-> implementation-specific, e.g. CoAP: 1=CON and 0=NON notification */
/* |-> implementation-specific, e.g. CoAP: 0=CON and 1=NON notification */
return 1;
}
@ -488,7 +488,7 @@ pushing_periodic_handler(resource_t *r)
* Additionally takes a period parameter that defines the interval to call [name]_periodic_handler().
* A default post_handler takes care of subscriptions and manages a list of subscribers to notify.
*/
EVENT_RESOURCE(event, METHOD_GET, "sensors/button", "title=\"Event demo\";rt=\"Observable\"");
EVENT_RESOURCE(event, METHOD_GET, "sensors/button", "title=\"Event demo\";obs");
void
event_handler(void* request, void* response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)