added sub resource macro

This commit is contained in:
Joakim Eriksson 2012-03-12 16:27:26 -07:00
parent 9b267036a4
commit 3852585c26

View File

@ -256,6 +256,13 @@ typedef struct periodic_resource_s periodic_resource_t;
void name##_handler(void *, void *, uint8_t *, uint16_t, int32_t *); \ void name##_handler(void *, void *, uint8_t *, uint16_t, int32_t *); \
resource_t resource_##name = {NULL, flags, url, attributes, name##_handler, NULL, NULL, NULL} resource_t resource_##name = {NULL, flags, url, attributes, name##_handler, NULL, NULL, NULL}
/*
* Macro to define a sub-resource
* Make sure to define its parent resource beforehand and set 'parent' to that name.
*/
#define SUB_RESOURCE(name, flags, url, attributes, parent) \
resource_t resource_##name = {NULL, flags, url, attributes, parent##_handler, NULL, NULL, NULL}
/* /*
* Macro to define an event resource * Macro to define an event resource
* Like periodic resources, event resources have a post_handler that manages a subscriber list. * Like periodic resources, event resources have a post_handler that manages a subscriber list.