File: extending_biometryd.md

package info (click to toggle)
biometryd 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,524 kB
  • sloc: cpp: 10,213; ansic: 191; python: 42; makefile: 33
file content (55 lines) | stat: -rw-r--r-- 1,749 bytes parent folder | download | duplicates (4)
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
# Extending Biometryd

Biometryd can be extended by implementing the interface
`biometry::Device`. We support both in-tree and out-of-tree
plugins. In-tree plugin authors should add their device implementation
in the folder `${BIOMETRYD_ROOT}/src/biometry/devices` and submit
their code contribution as a merge proposal to `https://launchpad.net/biometryd`.

Out-of-tree plugin authors should rely on
 - `BIOMETRYD_DEVICES_PLUGIN_DESCRIBE(name, author, desc, major, minor, patch)`
   - `name`        The name of the plugin
   - `author`      The author of the plugin
   - `desc` Human-readable description of the plugin
   - `major`       Major revision of the plugin
   - `minor`       Minor revision of the plugin
   - `patch`       Patch level of the plugin
 - `BIOMETRYD_DEVICES_PLUGIN_CREATE`
 - `BIOMETRYD_DEVICES_PLUGIN_DESTROY`
 
to describe, instantiate and destroy their plugin, respectively. The
following snippet demonstrates a complete plugin definition. The
resulting shared object file should be installed to `biometryd config
--flag default_plugin_directory`. Once the plugin is installed, it can
be referenced by its name as passed to
`BIOMETRYD_DEVICES_PLUGIN_DESCRIBE`.

```c++
#include <biometry/devices/plugin/interface.h>

#include "mock_device.h"

/// [Defining the create function]
BIOMETRYD_DEVICES_PLUGIN_CREATE
{
    return new testing::MockDevice();
}
/// [Defining the create function]

/// [Defining the destroy function]
BIOMETRYD_DEVICES_PLUGIN_DESTROY
{
    delete d;
}
/// [Defining the destroy function]

/// [Describing the plugin]
BIOMETRYD_DEVICES_PLUGIN_DESCRIBE(
	"TestPlugin", 
	"Thomas Voß <thomas.voss@canonical.com>", 
	"Just a plugin for testing purposes", 
	0,
	0,
	0)
/// [Describing the plugin]
 ```