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