From 3852585c260eab0e478bb6efc8c44032b6b0b6df Mon Sep 17 00:00:00 2001 From: Joakim Eriksson Date: Mon, 12 Mar 2012 16:27:26 -0700 Subject: [PATCH] added sub resource macro --- apps/erbium/erbium.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/erbium/erbium.h b/apps/erbium/erbium.h index 1c29ab125..7e491c3f8 100644 --- a/apps/erbium/erbium.h +++ b/apps/erbium/erbium.h @@ -256,6 +256,13 @@ typedef struct periodic_resource_s periodic_resource_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} +/* + * 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 * Like periodic resources, event resources have a post_handler that manages a subscriber list.