2
* Copyright (C) 2016 Canonical, Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Thomas Voß <thomas.voss@canonical.com>
20
#ifndef BIOMETRYD_DEVICES_PLUGIN_INTERFACE_H_
21
#define BIOMETRYD_DEVICES_PLUGIN_INTERFACE_H_
23
#include <biometry/version.h>
25
#define BIOMETRYD_DEVICES_PLUGIN_DESCRIPTOR_SECTION "BIOMETRYD_DEVICES_PLUGIN_DESCRIPTOR"
35
static constexpr const std::uint32_t name_length = 256;
36
static constexpr const std::uint32_t author_length = 256;
37
static constexpr const std::uint32_t description_length = 256;
41
std::uint32_t major, minor, patch;
46
const char name[name_length];
47
const char author[author_length];
48
const char description[description_length];
60
/// @brief BiometrydPluginDeviceCreate defines the function used to create biometry::Device instances.
61
typedef biometry::Device* (*BiometrydPluginDeviceCreate) ();
62
/// @brief BiometrydPluginDeviceDestroy defines the function used to destroy biometry::Device instances.
63
typedef void (*BiometrydPluginDeviceDestroy) (biometry::Device*);
65
/// @snippet tests/biometryd_devices_plugin_dl.cpp Describing the plugin
66
#define BIOMETRYD_DEVICES_PLUGIN_DESCRIBE(name, author, description, major, minor, patch) \
67
biometry::devices::plugin::Descriptor biometryd_devices_plugin_descriptor __attribute((section(BIOMETRYD_DEVICES_PLUGIN_DESCRIPTOR_SECTION))) = \
68
{ name, author, description, {{biometry::build::version_major, biometry::build::version_minor, biometry::build::version_patch}, {major, minor, patch}}};
70
/// @brief Starts the implementation of the create function exposed from a dynamic library.
72
/// @snippet tests/biometryd_devices_plugin_dl.cpp Defining the create function
73
#define BIOMETRYD_DEVICES_PLUGIN_CREATE \
74
extern "C" __attribute__ ((visibility ("default"))) biometry::Device* CreateBiometrydDevice()
76
/// @snippet tests/biometryd_devices_plugin_dl.cpp Defining the destroy function
77
/// @brief Starts implementation of the destroy function exposed from a dynamic library.
81
#define BIOMETRYD_DEVICES_PLUGIN_DESTROY \
82
extern "C" __attribute__ ((visibility ("default"))) void DestroyBiometrydDevice(biometry::Device* d)
84
/// @brief Tags the symbol name of the create function.
85
#define BIOMETRYD_DEVICES_PLUGIN_CREATE_SYMBOL_NAME "CreateBiometrydDevice"
86
/// @brief Tags the symbol name of the destroy function.
87
#define BIOMETRYD_DEVICES_PLUGIN_DESTROY_SYMBOL_NAME "DestroyBiometrydDevice"
91
#endif // BIOMETRYD_DEVICES_PLUGIN_INTERFACE_H_