3 <link rel="stylesheet" type="text/css" href="doc.css">
7 <a name="Overview.of.plugins.shipped.with.AFB-Daemon"></a>
8 <h1>Overview of plugins shipped with AFB-Daemon</h1>
12 Author: Manuel Bachmann
15 <a name="List.of.plugins"></a>
16 <h2>List of plugins</h2>
18 <p> Here are the plugins shipped in the source tree:
22 * Audio <em>(2 backends: ALSA/PulseAudio)</em>
23 * Radio <em>(1 backend: RTLSDR RTL2832U)</em>
24 * Media <em>(1 backend: Rygel UPnP)</em></p>
26 <p>All plugins may not be built, depending on the development libraries present on the system at build time.</p>
28 <a name="Detail.of.plugins"></a>
29 <h2>Detail of plugins</h2>
31 <a name="Hello.World"></a>
34 <p>A sample Hello World plugin for demonstration and learning purposes.</p>
36 <p>This plugin provides a few unauthenticated requests, all beginning with “ping”, to demonstrate basic binder capabilities.</p>
38 <p><strong>Verbs</strong>:
39 * <em>ping:</em> returns a success response
40 * <em>pingfail:</em> returns a failure response
41 * <em>pingnull:</em> returns a success response, with an empty JSON response field
42 * <em>pingbug:</em> does a memory violation (intercepted by the binder)
43 * <em>pingJson:</em> returns a success response, with a complex JSON response field
44 * <em>pingevent:</em> broadcasts a global event</p>
48 <a name="Authentication"></a>
49 <h3>Authentication</h3>
51 <p>An sample Authentication plugin for demonstration purposes.</p>
53 <p>This plugin provides a few requests to demonstrate the binder’s token-based security mechanism.</p>
55 <p>Calling “<em>connect</em>” with a security token will initiate a session, calling “<em>refresh</em>” will issue a new token and invalidate the previous one, calling “<em>logout</em>” will invalidate all tokens and close the session.</p>
57 <p><strong>Verbs</strong>:
58 * <em>ping:</em> returns a success response
59 * <em>connect:</em> creates a session and returns a new token
60 * <em>refresh:</em> returns a new token
61 * <em>check:</em> verifies the passed token is valid
62 * <em>logout:</em> closes the session</p>
66 <a name="Tic.Tac.Toe"></a>
69 <p>A sample Tic Tac Toe game plugin.</p>
71 <p>This plugin provides an interactive Tic Tac Toe game where the binder returns the grid as a JSON response.</p>
73 <p><strong>Verbs</strong>:
74 * <em>new:</em> starts a new game
75 * <em>play:</em> asks the server to play
76 * <em>move:</em> gives a client move
77 * <em>board:</em> gets the current board state, as a JSON structure
78 * <em>level</em>: sets the server level
79 * <em>join</em>: joins an existing board
80 * <em>undo</em>: undo the last move
81 * <em>wait</em>: wait for a move</p>
88 <p>A sample Audio plugin with 2 backends:
90 * PulseAudio (optional)</p>
92 <p>This plugin is able to initialize a specific soundcard, define volume levels, channels (mono/stereo…), mute sound, and play a 22,050 Hz PCM stream.</p>
94 <p><strong>Verbs</strong>:
95 * <em>ping:</em> returns a success response
96 * <em>init:</em> initializes backend, on the “default” sound card
97 * <em>volume:</em> gets or sets volume, in % (0-100)
98 * <em>channels:</em> gets or sets channels count (1-8)
99 * <em>mute:</em> gets or sets the mute status (on-off)
100 * <em>play</em>: gets or sets the playing status (on-off)</p>
102 <p><em>(if PulseAudio development libraries are not found at build time, only ALSA will be available)</em></p>
104 <p><em>(if a PulseAudio server is not found at runtime, the plugin will dynamically fall back to ALSA)</em></p>
106 <p><em>(a specifc backend can be forced by using this syntax before running afb-daemon : <strong>$ export AFB_AUDIO_OUTPUT=Alsa</strong>)</em></p>
113 <p>A sample AM/FM Radio plugin with 1 backend:
114 * RTLSDR - Realtek RTL2832U dongles (mandatory)</p>
116 <p>This plugin is able to initialize specific RTL2832U dongles, switch between AM/FM modes, define frequency, mute sound, and play sound (if combining with the <strong>audio</strong> plugin).</p>
118 <p><strong>Verbs</strong>:
119 * <em>ping:</em> returns a success response
120 * <em>init:</em> initializes backend, looking for plugged-in devices
121 * <em>power:</em> sets device power status (on-off)
122 * <em>mode:</em> sets device reception mode (AM-FM)
123 * <em>freq:</em> sets device frequency (in Hz)
124 * <em>mute</em>: sets device mute status (on-off)
125 * <em>play</em>: sets device playing status (on-off)</p>
127 <p><em>(if rtlsdr development libraries are not found at build time, this plugin will not be built)</em></p>
134 <p>A sample Media Server plugin with 1 backend:
137 <p>This plugin is able to detect a local Rygel UPnP media server, list audio files, select an audio file for playback, play/pause/seek in this file, upload an audio file to the server.</p>
139 <p><strong>Verbs</strong>:
140 * <em>ping:</em> returns a success response
141 * <em>init:</em> initializes backend, looking for an active local UPnP server
142 * <em>list:</em> returns list of audio files, as a JSON structure
143 * <em>select:</em> select an audio files, by index number (001-…)
144 * <em>play:</em> plays the currently selected audio file
145 * <em>stop:</em> stops the currently selected audio file
146 * <em>pause:</em> pauses the currently selected audio file
147 * <em>seek:</em> seeks in the currently selected audio file, in seconds
148 * <em>upload:</em> uploads an audio file, with a POST request</p>
150 <p><em>(if GUPnP/GSSDP development libraries are not fund at build time, this plugin will not be built)</em></p>
158 <p>Sample command-line applications: <em>afb-client-demo</em> (built by default)</p>
160 <p>Sample HTML5 applications: <strong>test/*.html</strong>, <strong><a href="https://github.com/iotbzh/afb-client">afb-client</a></strong>, <strong><a href="https://github.com/iotbzh/afb-radio">afb-radio</a></strong></p>
162 <p>Sample Qt/QML applications: <em>test/token-websock.qml</em></p>