add .gitreview
[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   <!--[if lt IE 9]>
11     <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
12   <![endif]-->
13   <link rel="stylesheet" href="doc.css">
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">23 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 <pre><code>Version: 1
38 Date:    09 juin 2016
39 Author:  Manuel Bachmann</code></pre>
40 <h2 id="list-of-bindings">List of bindings</h2>
41 <p>Here are the bindings shipped in the source tree:</p>
42 <ul>
43 <li>Hello World</li>
44 <li>Authentication</li>
45 <li>Tic Tac Toe</li>
46 <li>Audio <em>(2 backends: ALSA/PulseAudio)</em></li>
47 <li>Radio <em>(1 backend: RTLSDR RTL2832U)</em></li>
48 <li>Media <em>(1 backend: Rygel UPnP)</em></li>
49 </ul>
50 <p>All bindings may not be built, depending on the development libraries present on the system at build time.</p>
51 <h2 id="detail-of-bindings">Detail of bindings</h2>
52 <h3 id="hello-world">Hello World</h3>
53 <p>A sample Hello World binding for demonstration and learning purposes.</p>
54 <p>This binding provides a few unauthenticated requests, all beginning with &quot;ping&quot;, to demonstrate basic binder capabilities.</p>
55 <p><strong>Verbs</strong>:</p>
56 <ul>
57 <li><em>ping:</em> returns a success response</li>
58 <li><em>pingfail:</em> returns a failure response</li>
59 <li><em>pingnull:</em> returns a success response, with an empty JSON response field</li>
60 <li><em>pingbug:</em> does a memory violation (intercepted by the binder)</li>
61 <li><em>pingJson:</em> returns a success response, with a complex JSON response field</li>
62 <li><em>pingevent:</em> broadcasts a global event</li>
63 </ul>
64 <p><br /></p>
65 <h3 id="authentication">Authentication</h3>
66 <p>An sample Authentication binding for demonstration purposes.</p>
67 <p>This binding provides a few requests to demonstrate the binder's token-based security mechanism.</p>
68 <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>
69 <p><strong>Verbs</strong>:</p>
70 <ul>
71 <li><em>ping:</em> returns a success response</li>
72 <li><em>connect:</em> creates a session and returns a new token</li>
73 <li><em>refresh:</em> returns a new token</li>
74 <li><em>check:</em> verifies the passed token is valid</li>
75 <li><em>logout:</em> closes the session</li>
76 </ul>
77 <p><br /></p>
78 <h3 id="tic-tac-toe">Tic Tac Toe</h3>
79 <p>A sample Tic Tac Toe game binding.</p>
80 <p>This binding provides an interactive Tic Tac Toe game where the binder returns the grid as a JSON response.</p>
81 <p><strong>Verbs</strong>:</p>
82 <ul>
83 <li><em>new:</em> starts a new game</li>
84 <li><em>play:</em> asks the server to play</li>
85 <li><em>move:</em> gives a client move</li>
86 <li><em>board:</em> gets the current board state, as a JSON structure</li>
87 <li><em>level</em>: sets the server level</li>
88 <li><em>join</em>: joins an existing board</li>
89 <li><em>undo</em>: undo the last move</li>
90 <li><em>wait</em>: wait for a move</li>
91 </ul>
92 <p><br /></p>
93 <h3 id="audio">Audio</h3>
94 <p>A sample Audio binding with 2 backends:</p>
95 <ul>
96 <li>ALSA (mandatory)</li>
97 <li>PulseAudio (optional)</li>
98 </ul>
99 <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>
100 <p><strong>Verbs</strong>:</p>
101 <ul>
102 <li><em>ping:</em> returns a success response</li>
103 <li><em>init:</em> initializes backend, on the &quot;default&quot; sound card</li>
104 <li><em>volume:</em> gets or sets volume, in % (0-100)</li>
105 <li><em>channels:</em> gets or sets channels count (1-8)</li>
106 <li><em>mute:</em> gets or sets the mute status (on-off)</li>
107 <li><em>play</em>: gets or sets the playing status (on-off)</li>
108 </ul>
109 <p><em>(if PulseAudio development libraries are not found at build time, only ALSA will be available)</em></p>
110 <p><em>(if a PulseAudio server is not found at runtime, the binding will dynamically fall back to ALSA)</em></p>
111 <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>
112 <p><br /></p>
113 <h3 id="radio">Radio</h3>
114 <p>A sample AM/FM Radio binding with 1 backend:</p>
115 <ul>
116 <li>RTLSDR - Realtek RTL2832U dongles (mandatory)</li>
117 </ul>
118 <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>
119 <p><strong>Verbs</strong>:</p>
120 <ul>
121 <li><em>ping:</em> returns a success response</li>
122 <li><em>init:</em> initializes backend, looking for plugged-in devices</li>
123 <li><em>power:</em> sets device power status (on-off)</li>
124 <li><em>mode:</em> sets device reception mode (AM-FM)</li>
125 <li><em>freq:</em> sets device frequency (in Hz)</li>
126 <li><em>mute</em>: sets device mute status (on-off)</li>
127 <li><em>play</em>: sets device playing status (on-off)</li>
128 </ul>
129 <p><em>(if rtlsdr development libraries are not found at build time, this binding will not be built)</em></p>
130 <p><br /></p>
131 <h3 id="media">Media</h3>
132 <p>A sample Media Server binding with 1 backend:</p>
133 <ul>
134 <li>Rygel</li>
135 </ul>
136 <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>
137 <p><strong>Verbs</strong>:</p>
138 <ul>
139 <li><em>ping:</em> returns a success response</li>
140 <li><em>init:</em> initializes backend, looking for an active local UPnP server</li>
141 <li><em>list:</em> returns list of audio files, as a JSON structure</li>
142 <li><em>select:</em> select an audio files, by index number (001-...)</li>
143 <li><em>play:</em> plays the currently selected audio file</li>
144 <li><em>stop:</em> stops the currently selected audio file</li>
145 <li><em>pause:</em> pauses the currently selected audio file</li>
146 <li><em>seek:</em> seeks in the currently selected audio file, in seconds</li>
147 <li><em>upload:</em> uploads an audio file, with a POST request</li>
148 </ul>
149 <p><em>(if GUPnP/GSSDP development libraries are not fund at build time, this binding will not be built)</em></p>
150 <p><br /></p>
151 <hr />
152 <p><br /></p>
153 <p>Sample command-line applications: <em>afb-client-demo</em> (built by default)</p>
154 <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>
155 <p>Sample Qt/QML applications: <em>test/token-websock.qml</em></p>
156 </body>
157 </html>