The new naming is closer to the functionnal design
and closer to V1 names.
Change-Id: I8970338056a30564b84eaa1a7da6df3a9e6aa579
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
const char *api; /* api name for the binding */
const char *specification; /* textual specification of the binding */
const struct afb_verb_v2 *verbs; /* array of descriptions of verbs terminated by a NULL name */
const char *api; /* api name for the binding */
const char *specification; /* textual specification of the binding */
const struct afb_verb_v2 *verbs; /* array of descriptions of verbs terminated by a NULL name */
- int (*init)(struct afb_daemon daemon);
- int (*start)(struct afb_service service);
+ int (*preinit)(struct afb_daemon daemon);
+ int (*init)(struct afb_service service);
void (*onevent)(struct afb_service service, const char *event, struct json_object *object);
unsigned concurrent: 1; /* allows concurrent requests to verbs */
};
void (*onevent)(struct afb_service service, const char *event, struct json_object *object);
unsigned concurrent: 1; /* allows concurrent requests to verbs */
};
}
/* get the initialisation */
}
/* get the initialisation */
- start = desc->binding->start;
+ start = desc->binding->init;
if (start == NULL) {
/* not an error when onneed */
if (onneed != 0)
if (start == NULL) {
/* not an error when onneed */
if (onneed != 0)
afb_ditf_init_v2(&desc->ditf, binding->api);
/* init the binding */
afb_ditf_init_v2(&desc->ditf, binding->api);
/* init the binding */
- if (binding->init) {
- INFO("binding %s calling init function", binding->api);
- rc = binding->init(desc->ditf.daemon);
+ if (binding->preinit) {
+ INFO("binding %s calling preinit function", binding->api);
+ rc = binding->preinit(desc->ditf.daemon);
- ERROR("binding %s initialisation function failed...", binding->api);
+ ERROR("binding %s preinit function failed...", binding->api);
struct json_object *root = NULL;
struct json_object *d_perms = NULL;
struct json_object *a_perms = NULL;
struct json_object *root = NULL;
struct json_object *d_perms = NULL;
struct json_object *a_perms = NULL;
+const char *preinit = NULL;
-const char *start = NULL;
const char *onevent = NULL;
const char *api = NULL;
const char *scope = NULL;
const char *prefix = NULL;
const char *postfix = NULL;
int priv = -1;
const char *onevent = NULL;
const char *api = NULL;
const char *scope = NULL;
const char *prefix = NULL;
const char *postfix = NULL;
int priv = -1;
/**
* Search for a reference of type "#/a/b/c" int the
/**
* Search for a reference of type "#/a/b/c" int the
/* get some names */
getvar(&api, "#/info/x-binding-c-generator/api", NULL);
/* get some names */
getvar(&api, "#/info/x-binding-c-generator/api", NULL);
+ getvar(&preinit, "#/info/x-binding-c-generator/preinit", NULL);
getvar(&init, "#/info/x-binding-c-generator/init", NULL);
getvar(&init, "#/info/x-binding-c-generator/init", NULL);
- getvar(&start, "#/info/x-binding-c-generator/start", NULL);
getvar(&onevent, "#/info/x-binding-c-generator/onevent", NULL);
getvar(&scope, "#/info/x-binding-c-generator/scope", "static");
getvar(&prefix, "#/info/x-binding-c-generator/prefix", "afb_verb_");
getvar(&postfix, "#/info/x-binding-c-generator/postfix", "_cb");
getvarbool(&priv, "#/info/x-binding-c-generator/private", 0);
getvar(&onevent, "#/info/x-binding-c-generator/onevent", NULL);
getvar(&scope, "#/info/x-binding-c-generator/scope", "static");
getvar(&prefix, "#/info/x-binding-c-generator/prefix", "afb_verb_");
getvar(&postfix, "#/info/x-binding-c-generator/postfix", "_cb");
getvarbool(&priv, "#/info/x-binding-c-generator/private", 0);
+ getvarbool(&conc, "#/info/x-binding-c-generator/concurrent", 0);
getvar(&api, "#/info/title", "?");
/* get the API name */
getvar(&api, "#/info/title", "?");
/* get the API name */
" .api = \"%s\",\n"
" .specification = _afb_description_v2_%s,\n"
" .verbs = _afb_verbs_v2_%s,\n"
" .api = \"%s\",\n"
" .specification = _afb_description_v2_%s,\n"
" .verbs = _afb_verbs_v2_%s,\n"
"};\n"
"\n"
, priv ? "static " : ""
"};\n"
"\n"
, priv ? "static " : ""
"version": 2,
"prefix": "f_",
"postfix": "",
"version": 2,
"prefix": "f_",
"postfix": "",
- "start": null,
- "onevent": null,
.api = "monitor",
.specification = _afb_description_v2_monitor,
.verbs = _afb_verbs_v2_monitor,
.api = "monitor",
.specification = _afb_description_v2_monitor,
.verbs = _afb_verbs_v2_monitor,