summaryrefslogtreecommitdiffstats
path: root/conf.d/cmake/config.cmake
blob: 2ea55a9e614739cb236249833bdd3e3e0aec6867 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
###########################################################################
# Copyright 2015, 2016, 2017 IoT.bzh
#
# author: Fulup Ar Foll <fulup@iot.bzh>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###########################################################################

# Project Info
# ------------------
set(PROJECT_NAME agl-service-weather)
set(PROJECT_PRETTY_NAME "AFM binding for weather interface")
set(PROJECT_DESCRIPTION "Binding for weather interface")
set(PROJECT_VERSION "1.0")
set(PROJECT_ICON "icon.png")
set(PROJECT_LICENSE "APL2.0")
set(PROJECT_LANGUAGES,"C")

# Where are stored default templates files from submodule or subtree app-templates in your project tree
# relative to the root project directory
set(PROJECT_APP_TEMPLATES_DIR "conf.d/app-templates")

# Where are stored your external libraries for your project. This is 3rd party library that you don't maintain
# but used and must be built and linked.
# set(PROJECT_LIBDIR "libs")

# Where are stored data for your application. Pictures, static resources must be placed in that folder.
# set(PROJECT_RESOURCES "data")

# Which directories inspect to find CMakeLists.txt target files
# set(PROJECT_SRC_DIR_PATTERN "*")

# Compilation Mode (DEBUG, RELEASE)
# ----------------------------------
set(CMAKE_BUILD_TYPE "DEBUG")

# Kernel selection if needed. You can choose between a
# mandatory version to impose a minimal version.
# Or check Kernel minimal version and just print a Warning
# about missing features and define a preprocessor variable
# to be used as preprocessor condition in code to disable
# incompatibles features. Preprocessor define is named
# KERNEL_MINIMAL_VERSION_OK.
#
# NOTE*** FOR NOW IT CHECKS KERNEL Yocto environment and
# Yocto SDK Kernel version.
# -----------------------------------------------
#set(kernel_mandatory_version 4.8)

# Compiler selection if needed. Impose a minimal version.
# -----------------------------------------------
set (gcc_minimal_version 4.9)

# PKG_CONFIG required packages
# -----------------------------
set (PKG_REQUIRED_LIST
	json-c
	libcurl
	libsystemd>=222
	afb-daemon
)

# Customize link option
# -----------------------------
list (APPEND link_libraries -pthread)

# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
# ---------------------------------------------------------------------
set(CMAKE_INSTALL_PREFIX $ENV{HOME}/opt)
set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)

# Optional location for config.xml.in
# -----------------------------------
set(WIDGET_CONFIG_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/conf.d/wgt/config.xml.in)

# Mandatory widget Mimetype specification of the main unit
# --------------------------------------------------------------------------
# Choose between :
#- text/html : HTML application,
#	content.src designates the home page of the application
#
#- application/vnd.agl.native : AGL compatible native,
#	content.src designates the relative path of the binary.
#
# - application/vnd.agl.service: AGL service, content.src is not used.
#
#- ***application/x-executable***: Native application,
#	content.src designates the relative path of the binary.
#	For such application, only security setup is made.
#
set(WIDGET_TYPE application/vnd.agl.service)

# Mandatory Widget entry point file of the main unit
# --------------------------------------------------------------
# This is the file that will be executed, loaded,
# at launch time by the application framework.
#
set(WIDGET_ENTRY_POINT lib/libafm-weather-binding.so)

# Print a helper message when every thing is finished
# ----------------------------------------------------
set(CLOSING_MESSAGE "Test with: afb-daemon --rootdir=\$\$(pwd)/package --binding=\$\$(pwd)/package/${WIDGET_ENTRY_POINT} --port=1234 --tracereq=common --token=\"1\" --verbose")
set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt")

# Optional dependencies order
# ---------------------------
#set(EXTRA_DEPENDENCIES_ORDER)

# Optional Extra global include path
# -----------------------------------
#set(EXTRA_INCLUDE_DIRS)

# Optional extra libraries
# -------------------------
#set(EXTRA_LINK_LIBRARIES)

# Optional force binding installation
# ------------------------------------
# set(BINDINGS_INSTALL_PREFIX PrefixPath )

# Optional force binding Linking flag
# ------------------------------------
# set(BINDINGS_LINK_FLAG LinkOptions )

# Optional force package prefix generation, like widget
# -----------------------------------------------------
# set(PKG_PREFIX DestinationPath)

# Optional Application Framework security token
# and port use for remote debugging.
#------------------------------------------------------------
#set(AFB_TOKEN   ""      CACHE PATH "Default AFB_TOKEN")
#set(AFB_REMPORT "1234" CACHE PATH "Default AFB_TOKEN")

# This include is mandatory and MUST happens at the end
# of this file, else you expose you to unexpected behavior
# -----------------------------------------------------------
include(${PROJECT_APP_TEMPLATES_DIR}/cmake/common.cmake)
eyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include "homescreen.h"

const char _error[] = "error";
const char _application_id[] = "application_id";
const char _display_message[] = "display_message";
const char _reply_message[] = "reply_message";
const char _keyData[] = "data";
const char _keyId[] = "id";

/**
 * init function
 *
 * #### Parameters
 * - api : the api serving the request
 *
 * #### Return
 * 0 : init success
 * 1 : init fail
 *
 */
int hs_instance::init(afb_api_t api)
{
    if(client_manager == nullptr) {
        AFB_ERROR("client_manager is nullptr.");
        return -1;
    }
    client_manager->init();

    if(app_info == nullptr) {
        AFB_ERROR("app_info is nullptr.");
        return -1;
    }
    app_info->init(api);

    return 0;
}

/**
 * set event hook
 *
 * #### Parameters
 *  - event  : event name
 *  - f : hook function
 *
 * #### Return
 * Nothing
 */
void hs_instance::setEventHook(const char *event, const event_hook_func f)
{
    if(event == nullptr || f == nullptr) {
        AFB_WARNING("argument is null.");
        return;
    }

    std::string ev(event);
    auto it = event_hook_list.find(ev);
    if(it != event_hook_list.end()) {
        it->second.push_back(f);
    }
    else {
        std::list<event_hook_func> l;
        l.push_back(f);
        event_hook_list[ev] = std::move(l);
    }
}

/**
 * onEvent function
 *
 * #### Parameters
 *  - api : the api serving the request
 *  - event  : event name
 *  - object : event json object
 *
 * #### Return
 * Nothing
 */
void hs_instance::onEvent(afb_api_t api, const char *event, struct json_object *object)
{
    std::string ev(event);
    auto it = event_hook_list.find(ev);
    if(it != event_hook_list.end()) {
        for(auto &ref : it->second) {
            if(ref(api, event, object))
                break;
        }
    }
}

static struct hs_instance *g_hs_instance;

/**
 * set event hook
 *
 * #### Parameters
 *  - event  : event name
 *  - f : hook function pointer
 *
 * #### Return
 * Nothing
 */
void setEventHook(const char *event, const event_hook_func f)
{
    if(g_hs_instance == nullptr) {
        AFB_ERROR("g_hs_instance is null.");
        return;
    }

    g_hs_instance->setEventHook(event, f);
}

/*
********** Method of HomeScreen Service (API) **********
*/

static void pingSample(afb_req_t request)
{
   static int pingcount = 0;
   afb_req_success_f(request, json_object_new_int(pingcount), "Ping count = %d", pingcount);
   AFB_DEBUG("Verbosity macro at level notice invoked at ping invocation count = %d", pingcount);
   pingcount++;
}

/**
 * tap_shortcut notify for homescreen
 * When Shortcut area is tapped,  notify these applciations
 *
 * #### Parameters
 * Request key
 * - application_id   : application id
 *
 * #### Return
 * None
 *
 */
static void tap_shortcut (afb_req_t request)
{
    int ret = 0;
    const char* value = afb_req_value(request, _application_id);
    if (value) {
        AFB_INFO("request appid = %s.", value);
        ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, value);
        if(ret == AFB_REQ_NOT_STARTED_APPLICATION) {
            std::string id = g_hs_instance->app_info->getAppProperty(value, _keyId);
	    if (!id.empty()) {
		    HS_AfmMainProxy afm_proxy;
		    afm_proxy.start(g_hs_instance, request, id);
		    ret = 0;
	    } else {
		    ret = AFB_EVENT_BAD_REQUEST;
	    }
        }
    }
    else {
        ret = AFB_EVENT_BAD_REQUEST;
    }

    if (ret) {
        afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
    }
    else {
        struct json_object *res = json_object_new_object();
        hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
          _error,  ret);
        afb_req_success(request, res, "afb_event_push event [tap_shortcut]");
    }
}

/**
 * HomeScreen OnScreen message
 *
 * #### Parameters
 * Request key
 * - display_message   : message for display
 *
 * #### Return
 * None
 *
 */
static void on_screen_message (afb_req_t request)
{
    int ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__);
    if (ret) {
        afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
    }
    else {
        struct json_object *res = json_object_new_object();
        hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
          _error,  ret);
        afb_req_success(request, res, "afb_event_push event [on_screen_message]");
    }
}

/**
 * HomeScreen OnScreen Reply
 *
 * #### Parameters
 * Request key
 * - reply_message   : message for reply
 *
 * #### Return
 * None
 *
 */
static void on_screen_reply (afb_req_t request)
{
    int ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__);
    if (ret) {
        afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
    }
    else {
        struct json_object *res = json_object_new_object();
        hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
          _error,  ret);
        afb_req_success(request, res, "afb_event_push event [on_screen_reply]");
    }
}

/**
 * Subscribe event
 *
 * #### Parameters
 *  - event  : Event name. Event list is written in libhomescreen.cpp
 *
 * #### Return
 * None
 *
 */
static void subscribe(afb_req_t request)
{
    int ret = 0;
    std::string req_appid = std::move(get_application_id(request));
    if(!req_appid.empty()) {
        ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, req_appid.c_str());
    }
    else {
        ret = AFB_EVENT_BAD_REQUEST;
    }

    if(ret) {
        afb_req_fail_f(request, "afb_req_subscribe failed", "called %s.", __FUNCTION__);
    }
    else {
        struct json_object *res = json_object_new_object();
        hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
            _error, ret);
        afb_req_success_f(request, res, "homescreen binder subscribe.");
    }
}

/**
 * Unsubscribe event
 *
 * #### Parameters
 *  - event  : Event name. Event list is written in libhomescreen.cpp
 *
 * #### Return
 * None
 *
 */
static void unsubscribe(afb_req_t request)
{
    int ret = 0;
    std::string req_appid = std::move(get_application_id(request));
    if(!req_appid.empty()) {
        ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, req_appid.c_str());
    }
    else {
        ret = AFB_EVENT_BAD_REQUEST;
    }

    if(ret) {
        afb_req_fail_f(request, "afb_req_unsubscribe failed", "called %s.", __FUNCTION__);
    }
    else {
        struct json_object *res = json_object_new_object();
        hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
            _error, ret);
        afb_req_success_f(request, res, "homescreen binder unsubscribe success.");
    }
}

/**
 * showWindow event
 *
 * #### Parameters
 *  - request : the request
 *
 * #### Return
 * None
 *
 */
static void showWindow(afb_req_t request)
{
    int ret = 0;
    const char* value = afb_req_value(request, _application_id);
    if (value) {
        ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, value);
        if(ret == AFB_REQ_NOT_STARTED_APPLICATION) {
            std::string id = g_hs_instance->app_info->getAppProperty(value, _keyId);
	    if (!id.empty()) {
		    HS_AfmMainProxy afm_proxy;
		    afm_proxy.start(g_hs_instance, request, id);
		    ret = 0;
	    } else {
		    ret = AFB_EVENT_BAD_REQUEST;
	    }
        }
    }
    else {
        ret = AFB_EVENT_BAD_REQUEST;
    }

    if (ret) {
        afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
    }
    else {
        struct json_object *res = json_object_new_object();
        hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
          _error,  ret);
        afb_req_success(request, res, "afb_event_push event [showWindow]");
    }
}

/**
 * hideWindow event
 *
 * #### Parameters
 *  - request : the request
 *
 * #### Return
 * None
 *
 */
static void hideWindow(afb_req_t request)
{
    int ret = 0;
    const char* value = afb_req_value(request, _application_id);
    if (value) {
        ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, value);
    }
    else {
        ret = AFB_EVENT_BAD_REQUEST;
    }

    if (ret) {
        afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
    }
    else {
        struct json_object *res = json_object_new_object();
        hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
          _error,  ret);
        afb_req_success(request, res, "afb_event_push event [hideWindow]");
    }
}

/**
 * replyShowWindow event
 *
 * #### Parameters
 *  - request : the request
 *
 * #### Return
 *  None
 *
 */
static void replyShowWindow(afb_req_t request)
{
    int ret = 0;
    const char* value = afb_req_value(request, _application_id);
    if (value) {
        ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, value);
    }
    else {
        ret = AFB_EVENT_BAD_REQUEST;
    }

    if (ret) {
        afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
    }
    else {
        struct json_object *res = json_object_new_object();
        hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
          _error,  ret);
        afb_req_success(request, res, "afb_event_push event [replyShowWindow]");
    }
}

/**
 * showNotification event
 *
 * the contents to homescreen which display at top area.
 *
 * #### Parameters
 *  - request : the request
 *
 * #### Return
 * None
 *
 */
static void showNotification(afb_req_t request)
{
    int ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, "homescreen");
    if (ret) {
        afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
    }
    else {
        struct json_object *res = json_object_new_object();
        hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
          _error,  ret);
        afb_req_success(request, res, "afb_event_push event [showNotification]");
    }
}

/**
 * showInformation event
 *
 * the contents to homescreen which display at bottom area.
 *
 * #### Parameters
 *  - request : the request
 *
 * #### Return
 * None
 *
 */
static void showInformation(afb_req_t request)
{
    int ret = g_hs_instance->client_manager->handleRequest(request,  __FUNCTION__, "homescreen");
    if (ret) {
        afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
    }
    else {
        struct json_object *res = json_object_new_object();
        hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
          _error,  ret);
        afb_req_success(request, res, "afb_event_push event [showInformation]");
    }
}

/**
 * get runnables list
 *
 * #### Parameters
 *  - request : the request
 *
 * #### Return
 * None
 *
 */
static void getRunnables(afb_req_t request)
{
    struct json_object* j_runnable = json_object_new_array();
    g_hs_instance->app_info->getRunnables(&j_runnable);

    /*create response json object*/
    struct json_object *res = json_object_new_object();
    hs_add_object_to_json_object_func(res, __FUNCTION__, 2, _error, 0);
    json_object_object_add(res, _keyData, j_runnable);
    afb_req_success_f(request, res, "homescreen binder unsubscribe success.");
}

/*
 * array of the verbs exported to afb-daemon
 */
static const afb_verb_t verbs[]= {
    /* VERB'S NAME                 FUNCTION TO CALL                  */
    { .verb="ping",              .callback=pingSample             },
    { .verb="tap_shortcut",      .callback=tap_shortcut           },
    { .verb="showWindow",        .callback=showWindow             },
    { .verb="hideWindow",        .callback=hideWindow             },
    { .verb="replyShowWindow",   .callback=replyShowWindow        },
    { .verb="on_screen_message", .callback=on_screen_message      },
    { .verb="on_screen_reply",   .callback=on_screen_reply        },
    { .verb="subscribe",         .callback=subscribe              },
    { .verb="unsubscribe",       .callback=unsubscribe            },
    { .verb="showNotification",  .callback=showNotification       },
    { .verb="showInformation",   .callback=showInformation        },
    { .verb="getRunnables",      .callback=getRunnables           },
    {NULL } /* marker for end of the array */
};

/**
 * homescreen binding preinit function
 *
 * #### Parameters
 *  - api : the api serving the request
 *
 * #### Return
 * None
 *
 */
static int preinit(afb_api_t api)
{
   (void)  api;
   AFB_DEBUG("binding preinit (was register)");
   return 0;
}

/**
 * homescreen binding init function
 *
 * #### Parameters
 *  - api : the api serving the request
 *
 * #### Return
 * None
 *
 */
static int init(afb_api_t api)
{
    AFB_DEBUG("binding init");

    if(g_hs_instance != nullptr) {
        AFB_WARNING( "g_hs_instance isn't null.");
        delete g_hs_instance->client_manager;
        delete g_hs_instance->app_info;
        delete g_hs_instance;
        g_hs_instance = nullptr;
    }
    g_hs_instance = new hs_instance();
    if(g_hs_instance == nullptr) {
        return -1;
    }

    return g_hs_instance->init(api);
}

/**
 * homescreen binding event function
 *
 * #### Parameters
 *  - api : the api serving the request
 *  - event  : event name
 *  - object : event json object
 *
 * #### Return
 * None
 *
 */
static void onevent(afb_api_t api, const char *event, struct json_object *object)
{
    AFB_INFO("on_event %s", event);
    g_hs_instance->onEvent(api, event, object);
}

const afb_binding_t afbBindingExport = {
    .api = "homescreen",
    .specification = NULL,
    .info = NULL,
    .verbs = verbs,
    .preinit = preinit,
    .init = init,
    .onevent = onevent
};