b3236886a95c8e9974d53bca0af4345157ec9dd1
[src/app-framework-binder.git] / doc / afb-plugins-overview.html
1 <html>
2 <head>
3   <link rel="stylesheet" type="text/css" href="doc.css">
4   <meta charset="UTF-8">
5 </head>
6 <body>
7 <a name="Overview.of.plugins.shipped.with.AFB-Daemon"></a>
8 <h1>Overview of plugins shipped with AFB-Daemon</h1>
9
10 <pre><code>Version: 1
11 Date:    30 mai 2016
12 Author:  Manuel Bachmann
13 </code></pre>
14
15 <a name="List.of.plugins"></a>
16 <h2>List of plugins</h2>
17
18 <p>  Here are the plugins shipped in the source tree:
19  * Hello World
20  * Authentication
21  * Tic Tac Toe
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>
25
26 <p>All plugins may not be built, depending on the development libraries present on the system at build time.</p>
27
28 <a name="Detail.of.plugins"></a>
29 <h2>Detail of plugins</h2>
30
31 <a name="Hello.World"></a>
32 <h3>Hello World</h3>
33
34 <p>A sample Hello World plugin for demonstration and learning purposes.</p>
35
36 <p>This plugin provides a few unauthenticated requests, all beginning with &ldquo;ping&rdquo;, to demonstrate basic binder capabilities.</p>
37
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>
45
46 <p><br /></p>
47
48 <a name="Authentication"></a>
49 <h3>Authentication</h3>
50
51 <p>An sample Authentication plugin for demonstration purposes.</p>
52
53 <p>This plugin provides a few requests to demonstrate the binder&rsquo;s token-based security mechanism.</p>
54
55 <p>Calling &ldquo;<em>connect</em>&rdquo; with a security token will initiate a session, calling &ldquo;<em>refresh</em>&rdquo; will issue a new token and invalidate the previous one, calling &ldquo;<em>logout</em>&rdquo; will invalidate all tokens and close the session.</p>
56
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>
63
64 <p><br /></p>
65
66 <a name="Tic.Tac.Toe"></a>
67 <h3>Tic Tac Toe</h3>
68
69 <p>A sample Tic Tac Toe game plugin.</p>
70
71 <p>This plugin provides an interactive Tic Tac Toe game where the binder returns the grid as a JSON response.</p>
72
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>
82
83 <p><br /></p>
84
85 <a name="Audio"></a>
86 <h3>Audio</h3>
87
88 <p>A sample Audio plugin with 2 backends:
89  * ALSA (mandatory)
90  * PulseAudio (optional)</p>
91
92 <p>This plugin is able to initialize a specific soundcard, define volume levels, channels (mono/stereo&hellip;), mute sound, and play a 22,050 Hz PCM stream.</p>
93
94 <p><strong>Verbs</strong>:
95 * <em>ping:</em> returns a success response
96 * <em>init:</em> initializes backend, on the &ldquo;default&rdquo; 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>
101
102 <p><em>(if PulseAudio development libraries are not found at build time, only ALSA will be available)</em></p>
103
104 <p><em>(if a PulseAudio server is not found at runtime, the plugin will dynamically fall back to ALSA)</em></p>
105
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>
107
108 <p><br /></p>
109
110 <a name="Radio"></a>
111 <h3>Radio</h3>
112
113 <p>A sample AM/FM Radio plugin with 1 backend:
114  * RTLSDR - Realtek RTL2832U dongles (mandatory)</p>
115
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>
117
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>
126
127 <p><em>(if rtlsdr development libraries are not found at build time, this plugin will not be built)</em></p>
128
129 <p><br /></p>
130
131 <a name="Media"></a>
132 <h3>Media</h3>
133
134 <p>A sample Media Server plugin with 1 backend:
135  * Rygel</p>
136
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>
138
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-&hellip;)
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>
149
150 <p><em>(if GUPnP/GSSDP development libraries are not fund at build time, this plugin will not be built)</em></p>
151
152 <p><br /></p>
153
154 <hr />
155
156 <p><br /></p>
157
158 <p>Sample command-line applications: <em>afb-client-demo</em> (built by default)</p>
159
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>
161
162 <p>Sample Qt/QML applications: <em>test/token-websock.qml</em></p>
163 </body>
164 </html>