afb-apiset: Fix start of apis
[src/app-framework-binder.git] / old-docs / afb-bindings-overview.md
1
2 Overview of bindings shipped with AFB-Daemon
3 ===========================================
4
5 List of bindings
6 ---------------
7
8 Here are the bindings shipped in the source tree:
9
10 * Hello World
11 * Authentication
12 * Tic Tac Toe
13 * Audio _(2 backends: ALSA/PulseAudio)_
14 * Radio _(1 backend: RTLSDR RTL2832U)_
15 * Media _(1 backend: Rygel UPnP)_
16
17 All bindings may not be built, depending on the development libraries present on
18 the system at build time.
19
20
21 Detail of bindings
22 -----------------
23
24 ### Hello World
25
26 A sample Hello World binding for demonstration and learning purposes.
27
28 This binding provides a few unauthenticated requests, all beginning with
29 "ping", to demonstrate basic binder capabilities.
30
31 **Verbs**:
32
33 * _ping:_ returns a success response
34 * _pingfail:_ returns a failure response
35 * _pingnull:_ returns a success response, with an empty JSON response field
36 * _pingbug:_ does a memory violation (intercepted by the binder)
37 * _pingJson:_ returns a success response, with a complex JSON response field
38 * _pingevent:_ broadcasts a global event
39
40 <br />
41
42
43 ### Authentication
44
45 A sample Authentication binding for demonstration purposes.
46
47 This binding provides a few requests to demonstrate the binder's token-based
48 security mechanism.
49
50 Calling "_connect_" with a security token will initiate a session, calling
51 "_refresh_" will issue a new token and invalidate the previous one, calling
52 "_logout_" will invalidate all tokens and close the session.
53
54 **Verbs**:
55
56 * _ping:_ returns a success response
57 * _connect:_ creates a session and returns a new token
58 * _refresh:_ returns a new token
59 * _check:_ verifies the passed token is valid
60 * _logout:_ closes the session
61
62 <br />
63
64
65 ### Tic Tac Toe
66
67 A sample Tic Tac Toe game binding.
68
69 This binding provides an interactive Tic Tac Toe game where the binder returns
70 the grid as a JSON response. 
71
72 **Verbs**:
73
74 * _new:_ starts a new game
75 * _play:_ asks the server to play
76 * _move:_ gives a client move
77 * _board:_ gets the current board state, as a JSON structure
78 * _level_: sets the server level
79 * _join_: joins an existing board
80 * _undo_: undo the last move
81 * _wait_: wait for a move
82
83 <br />
84
85
86 ### Audio
87
88 A sample Audio binding with 2 backends:
89
90 * ALSA (mandatory)
91 * PulseAudio (optional)
92
93 This binding is able to initialize a specific soundcard, define volume levels,
94 channels (mono/stereo...), mute sound, and play a 22,050 Hz PCM stream.
95
96 **Verbs**:
97
98 * _ping:_ returns a success response
99 * _init:_ initializes backend, on the "default" sound card
100 * _volume:_ gets or sets volume, in % (0-100)
101 * _channels:_ gets or sets channels count (1-8)
102 * _mute:_ gets or sets the mute status (on-off)
103 * _play_: gets or sets the playing status (on-off)
104
105 _(if PulseAudio development libraries are not found at build time, only ALSA
106 will be available)_
107
108 _(if a PulseAudio server is not found at runtime, the binding will dynamically
109 fall back to ALSA)_
110
111 _(a specifc backend can be forced by using this syntax before running afb-daemon
112 : **$ export AFB_AUDIO_OUTPUT=Alsa**)_
113
114 <br />
115
116
117 ### Radio
118
119 A sample AM/FM Radio binding with 1 backend:
120
121 * RTLSDR - Realtek RTL2832U dongles (mandatory)
122
123 This binding is able to initialize specific RTL2832U dongles, switch between
124 AM/FM modes, define frequency, mute sound, and play sound (if combining with
125 the **audio** binding).
126
127 **Verbs**:
128
129 * _ping:_ returns a success response
130 * _init:_ initializes backend, looking for plugged-in devices
131 * _power:_ sets device power status (on-off)
132 * _mode:_ sets device reception mode (AM-FM)
133 * _freq:_ sets device frequency (in Hz)
134 * _mute_: sets device mute status (on-off)
135 * _play_: sets device playing status (on-off)
136
137 _(if rtlsdr development libraries are not found at build time, this binding will
138 not be built)_
139
140 <br />
141
142 ### Media
143
144 A sample Media Server binding with 1 backend:
145
146  * Rygel
147
148 This binding is able to detect a local Rygel UPnP media server, list audio
149 files, select an audio file for playback, play/pause/seek in this file, upload
150 an audio file to the server.
151
152 **Verbs**:
153
154 * _ping:_ returns a success response
155 * _init:_ initializes backend, looking for an active local UPnP server
156 * _list:_ returns list of audio files, as a JSON structure
157 * _select:_ select an audio files, by index number (001-...)
158 * _play:_ plays the currently selected audio file
159 * _stop:_ stops the currently selected audio file
160 * _pause:_ pauses the currently selected audio file
161 * _seek:_ seeks in the currently selected audio file, in seconds
162 * _upload:_ uploads an audio file, with a POST request
163
164 _(if GUPnP/GSSDP development libraries are not found at build time, this binding
165 will not be built)_
166
167 <br />
168
169
170 ---
171 <br />
172
173 Sample command-line applications: _afb-client-demo_ (built by default)
174
175 Sample HTML5 applications: 
176 **test/*.html**, 
177 **[afb-client](https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/app-framework-demo.git;a=tree)**, 
178 **[afb-radio](https://github.com/iotbzh/afb-radio)**
179
180 Sample Qt/QML applications: *test/token-websock.qml*