afb-api-so: adds verbosity on dlopen error
[src/app-framework-binder.git] / doc / afb-bindings-overview.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <meta charset="utf-8">
5   <meta name="generator" content="pandoc">
6   <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
7   <meta name="author" content="José Bollo">
8   <title>Overview of bindings shipped with AFB-Daemon</title>
9   <style type="text/css">code{white-space: pre;}</style>
10   <link rel="stylesheet" href="doc.css">
11   <!--[if lt IE 9]>
12     <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
13   <![endif]-->
14 </head>
15 <body>
16 <header>
17 <h1 class="title">Overview of bindings shipped with AFB-Daemon</h1>
18 <h2 class="author">José Bollo</h2>
19 <h3 class="date">24 juin 2016</h3>
20 </header>
21 <nav id="TOC">
22 <ul>
23 <li><a href="#overview-of-bindings-shipped-with-afb-daemon">Overview of bindings shipped with AFB-Daemon</a><ul>
24 <li><a href="#list-of-bindings">List of bindings</a></li>
25 <li><a href="#detail-of-bindings">Detail of bindings</a><ul>
26 <li><a href="#hello-world">Hello World</a></li>
27 <li><a href="#authentication">Authentication</a></li>
28 <li><a href="#tic-tac-toe">Tic Tac Toe</a></li>
29 <li><a href="#audio">Audio</a></li>
30 <li><a href="#radio">Radio</a></li>
31 <li><a href="#media">Media</a></li>
32 </ul></li>
33 </ul></li>
34 </ul>
35 </nav>
36 <h1 id="overview-of-bindings-shipped-with-afb-daemon">Overview of bindings shipped with AFB-Daemon</h1>
37 <h2 id="list-of-bindings">List of bindings</h2>
38 <p>Here are the bindings shipped in the source tree:</p>
39 <ul>
40 <li>Hello World</li>
41 <li>Authentication</li>
42 <li>Tic Tac Toe</li>
43 <li>Audio <em>(2 backends: ALSA/PulseAudio)</em></li>
44 <li>Radio <em>(1 backend: RTLSDR RTL2832U)</em></li>
45 <li>Media <em>(1 backend: Rygel UPnP)</em></li>
46 </ul>
47 <p>All bindings may not be built, depending on the development libraries present on the system at build time.</p>
48 <h2 id="detail-of-bindings">Detail of bindings</h2>
49 <h3 id="hello-world">Hello World</h3>
50 <p>A sample Hello World binding for demonstration and learning purposes.</p>
51 <p>This binding provides a few unauthenticated requests, all beginning with &quot;ping&quot;, to demonstrate basic binder capabilities.</p>
52 <p><strong>Verbs</strong>:</p>
53 <ul>
54 <li><em>ping:</em> returns a success response</li>
55 <li><em>pingfail:</em> returns a failure response</li>
56 <li><em>pingnull:</em> returns a success response, with an empty JSON response field</li>
57 <li><em>pingbug:</em> does a memory violation (intercepted by the binder)</li>
58 <li><em>pingJson:</em> returns a success response, with a complex JSON response field</li>
59 <li><em>pingevent:</em> broadcasts a global event</li>
60 </ul>
61 <p><br /></p>
62 <h3 id="authentication">Authentication</h3>
63 <p>An sample Authentication binding for demonstration purposes.</p>
64 <p>This binding provides a few requests to demonstrate the binder's token-based security mechanism.</p>
65 <p>Calling &quot;<em>connect</em>&quot; with a security token will initiate a session, calling &quot;<em>refresh</em>&quot; will issue a new token and invalidate the previous one, calling &quot;<em>logout</em>&quot; will invalidate all tokens and close the session.</p>
66 <p><strong>Verbs</strong>:</p>
67 <ul>
68 <li><em>ping:</em> returns a success response</li>
69 <li><em>connect:</em> creates a session and returns a new token</li>
70 <li><em>refresh:</em> returns a new token</li>
71 <li><em>check:</em> verifies the passed token is valid</li>
72 <li><em>logout:</em> closes the session</li>
73 </ul>
74 <p><br /></p>
75 <h3 id="tic-tac-toe">Tic Tac Toe</h3>
76 <p>A sample Tic Tac Toe game binding.</p>
77 <p>This binding provides an interactive Tic Tac Toe game where the binder returns the grid as a JSON response.</p>
78 <p><strong>Verbs</strong>:</p>
79 <ul>
80 <li><em>new:</em> starts a new game</li>
81 <li><em>play:</em> asks the server to play</li>
82 <li><em>move:</em> gives a client move</li>
83 <li><em>board:</em> gets the current board state, as a JSON structure</li>
84 <li><em>level</em>: sets the server level</li>
85 <li><em>join</em>: joins an existing board</li>
86 <li><em>undo</em>: undo the last move</li>
87 <li><em>wait</em>: wait for a move</li>
88 </ul>
89 <p><br /></p>
90 <h3 id="audio">Audio</h3>
91 <p>A sample Audio binding with 2 backends:</p>
92 <ul>
93 <li>ALSA (mandatory)</li>
94 <li>PulseAudio (optional)</li>
95 </ul>
96 <p>This binding is able to initialize a specific soundcard, define volume levels, channels (mono/stereo...), mute sound, and play a 22,050 Hz PCM stream.</p>
97 <p><strong>Verbs</strong>:</p>
98 <ul>
99 <li><em>ping:</em> returns a success response</li>
100 <li><em>init:</em> initializes backend, on the &quot;default&quot; sound card</li>
101 <li><em>volume:</em> gets or sets volume, in % (0-100)</li>
102 <li><em>channels:</em> gets or sets channels count (1-8)</li>
103 <li><em>mute:</em> gets or sets the mute status (on-off)</li>
104 <li><em>play</em>: gets or sets the playing status (on-off)</li>
105 </ul>
106 <p><em>(if PulseAudio development libraries are not found at build time, only ALSA will be available)</em></p>
107 <p><em>(if a PulseAudio server is not found at runtime, the binding will dynamically fall back to ALSA)</em></p>
108 <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>
109 <p><br /></p>
110 <h3 id="radio">Radio</h3>
111 <p>A sample AM/FM Radio binding with 1 backend:</p>
112 <ul>
113 <li>RTLSDR - Realtek RTL2832U dongles (mandatory)</li>
114 </ul>
115 <p>This binding 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> binding).</p>
116 <p><strong>Verbs</strong>:</p>
117 <ul>
118 <li><em>ping:</em> returns a success response</li>
119 <li><em>init:</em> initializes backend, looking for plugged-in devices</li>
120 <li><em>power:</em> sets device power status (on-off)</li>
121 <li><em>mode:</em> sets device reception mode (AM-FM)</li>
122 <li><em>freq:</em> sets device frequency (in Hz)</li>
123 <li><em>mute</em>: sets device mute status (on-off)</li>
124 <li><em>play</em>: sets device playing status (on-off)</li>
125 </ul>
126 <p><em>(if rtlsdr development libraries are not found at build time, this binding will not be built)</em></p>
127 <p><br /></p>
128 <h3 id="media">Media</h3>
129 <p>A sample Media Server binding with 1 backend:</p>
130 <ul>
131 <li>Rygel</li>
132 </ul>
133 <p>This binding 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>
134 <p><strong>Verbs</strong>:</p>
135 <ul>
136 <li><em>ping:</em> returns a success response</li>
137 <li><em>init:</em> initializes backend, looking for an active local UPnP server</li>
138 <li><em>list:</em> returns list of audio files, as a JSON structure</li>
139 <li><em>select:</em> select an audio files, by index number (001-...)</li>
140 <li><em>play:</em> plays the currently selected audio file</li>
141 <li><em>stop:</em> stops the currently selected audio file</li>
142 <li><em>pause:</em> pauses the currently selected audio file</li>
143 <li><em>seek:</em> seeks in the currently selected audio file, in seconds</li>
144 <li><em>upload:</em> uploads an audio file, with a POST request</li>
145 </ul>
146 <p><em>(if GUPnP/GSSDP development libraries are not fund at build time, this binding will not be built)</em></p>
147 <p><br /></p>
148 <hr />
149 <p><br /></p>
150 <p>Sample command-line applications: <em>afb-client-demo</em> (built by default)</p>
151 <p>Sample HTML5 applications: **test/*.html<strong>, </strong><a href="https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/app-framework-demo.git;a=tree">afb-client</a><strong>, </strong><a href="https://github.com/iotbzh/afb-radio">afb-radio</a>**</p>
152 <p>Sample Qt/QML applications: <em>test/token-websock.qml</em></p>
153 </body>
154 </html>