Improves documentation
authorJosé Bollo <jose.bollo@iot.bzh>
Mon, 30 May 2016 15:53:10 +0000 (17:53 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Mon, 30 May 2016 15:53:10 +0000 (17:53 +0200)
Change-Id: I7a93b69d56912f396aa7819149038746aa59e620
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
doc/afb-application-writing.html
doc/afb-application-writing.md
doc/afb-plugins-overview.html
doc/afb-plugins-overview.md
doc/afb-tests-overview.html
doc/afb-tests-overview.md

index e0bb42c..2547cee 100644 (file)
@@ -26,6 +26,29 @@ Author:  José Bollo
   <ul>
    <li><a href="#Handling.sessions">Handling sessions</a></li>
    <li><a href="#Exchanging.tokens">Exchanging tokens</a></li>
+   <li><a href="#Example.of.session.management">Example of session management</a>
+   <ul>
+    <li><a href="#Using.curl">Using curl</a></li>
+    <li><a href="#Using.afb-client-demo">Using afb-client-demo</a>
+</li>
+   </ul>
+   </li>
+  </ul>
+  </li>
+  <li><a href="#Format.of.replies">Format of replies</a>
+  <ul>
+   <li><a href="#Field.jtype">Field jtype</a></li>
+   <li><a href="#Field.request">Field request</a>
+   <ul>
+    <li><a href="#Subfield.request.status">Subfield request.status</a></li>
+    <li><a href="#Subfield.request.info">Subfield request.info</a></li>
+    <li><a href="#Subfield.request.token">Subfield request.token</a></li>
+    <li><a href="#Subfield.request.uuid">Subfield request.uuid</a></li>
+    <li><a href="#Subfield.request.reqid">Subfield request.reqid</a></li>
+   </ul>
+   </li>
+   <li><a href="#Field.response">Field response</a></li>
+   <li><a href="#Template">Template</a></li>
   </ul>
   </li>
  </ul>
@@ -105,6 +128,9 @@ the socket connection can not be used to authenticate a client.</p>
 by using a commonly shared secret named token and the identification
 of the client named session.</p>
 
+<p>The examples <strong>token-websock.qml</strong> and <strong>afb-client</strong> are demonstrating
+how authentication and sessions are managed.</p>
+
 <a name="Handling.sessions"></a>
 <h3>Handling sessions</h3>
 
@@ -112,7 +138,12 @@ of the client named session.</p>
 instances. This of importance for plugins running as service
 because they may have to separate the data of each client.</p>
 
-<p>For common HTML5 browser running an HTML5 application.</p>
+<p>For HTML5 applications, the web runtime handles the cookie of session
+that the binder afb-daemon automatically sets.</p>
+
+<p>In any case, the session identifier can be set using the parameters
+<strong>uuid</strong> or <strong>x-afb-uuid</strong> in the request uri. That is understood
+by HTTP requests and by the negociation of websockets.</p>
 
 <a name="Exchanging.tokens"></a>
 <h3>Exchanging tokens</h3>
@@ -122,7 +153,193 @@ and its client: the application. This initial secret is the
 initial token.</p>
 
 <p>For each of its client application, the binder manages a current active
-token. The initial token is the default active token. It is the expected
-token for new clients.</p>
+token for the session. This authentication token can be a requirement for
+accessing some methods.</p>
+
+<p>The token must be passed in the request uri on HTTP or at connecting
+websockets using the parameter <strong>token</strong> or <strong>x-afb-token</strong>.</p>
+
+<p>To ensure security, tokens must be refreshed periodically.</p>
+
+<a name="Example.of.session.management"></a>
+<h3>Example of session management</h3>
+
+<p>For the following exmples, we suppose that you launched <strong>afb-daemon</strong> like that or similar:</p>
+
+<pre><code>$ afb-daemon --port=1234 --token=123456 [...]
+</code></pre>
+
+<p>with the expectation that the plugin <strong>AuthLogin</strong> is loaded.</p>
+
+<a name="Using.curl"></a>
+<h4>Using curl</h4>
+
+<p>First, connects with the initial token, 123456:</p>
+
+<pre><code>$ curl http://localhost:1234/api/auth/connect?token=123456
+{
+  "jtype": "afb-reply",
+  "request": {
+ "status": "success",
+ "token": "0aef6841-2ddd-436d-b961-ae78da3b5c5f",
+ "uuid": "850c4594-1be1-4e9b-9fcc-38cc3e6ff015"
+  },
+  "response": {"token": "A New Token and Session Context Was Created"}
+}
+</code></pre>
+
+<p>It returns an answer containing the uuid of the session, 850c4594-1be1-4e9b-9fcc-38cc3e6ff015,
+and the refreshed token, 850c4594-1be1-4e9b-9fcc-38cc3e6ff015.</p>
+
+<p>Let check that it is available:</p>
+
+<pre><code>$ curl http://localhost:1234/api/auth/check?token=0aef6841-2ddd-436d-b961-ae78da3b5c5f&amp;uuid=850c4594-1be1-4e9b-9fcc-38cc3e6ff015
+{
+  "jtype": "afb-reply",
+  "request": {"status":"success"},
+  "response": {"isvalid":true}
+}
+</code></pre>
+
+<p>It works! So try now to refresh the token:</p>
+
+<pre><code>$ curl http://localhost:1234/api/auth/refresh?token=0aef6841-2ddd-436d-b961-ae78da3b5c5f&amp;uuid=850c4594-1be1-4e9b-9fcc-38cc3e6ff015
+{
+  "jtype": "afb-reply",
+  "request": {
+ "status":"success",
+ "token":"b8ec3ec3-6ffe-448c-9a6c-efda69ad7bd9"
+  },
+  "response": {"token":"Token was refreshed"}
+}
+</code></pre>
+
+<p>Let now close the session:</p>
+
+<pre><code>curl http://localhost:1234/api/auth/logout?token=b8ec3ec3-6ffe-448c-9a6c-efda69ad7bd9&amp;uuid=850c4594-1be1-4e9b-9fcc-38cc3e6ff015
+{
+  "jtype": "afb-reply",
+  "request": {"status": "success"},
+  "response": {"info":"Token and all resources are released"}
+}
+</code></pre>
+
+<p>So now, checking for the uuid will be refused:</p>
+
+<pre><code>curl http://localhost:1234/api/auth/check?token=b8ec3ec3-6ffe-448c-9a6c-efda69ad7bd9&amp;uuid=850c4594-1be1-4e9b-9fcc-38cc3e6ff015
+{
+  "jtype": "afb-reply",
+  "request": {
+ "status": "failed",
+ "info": "invalid token's identity"
+  }
+}
+</code></pre>
+
+<a name="Using.afb-client-demo"></a>
+<h4>Using afb-client-demo</h4>
+
+<p>Here is an example of exchange using <strong>afb-client-demo</strong>:</p>
+
+<pre><code>$ afb-client-demo ws://localhost:1234/api?token=123456
+auth connect
+ON-REPLY 1:auth/connect: {"jtype":"afb-reply","request":{"status":"success",
+   "token":"63f71a29-8b52-4f9b-829f-b3028ba46b68","uuid":"5fcc3f3d-4b84-4fc7-ba66-2d8bd34ae7d1"},
+   "response":{"token":"A New Token and Session Context Was Created"}}
+auth check
+ON-REPLY 2:auth/check: {"jtype":"afb-reply","request":{"status":"success"},"response":{"isvalid":true}}
+auth refresh
+ON-REPLY 4:auth/refresh: {"jtype":"afb-reply","request":{"status":"success",
+   "token":"8b8ba8f4-1b0c-48fa-962d-4a00a8c9157e"},"response":{"token":"Token was refreshed"}}
+auth check
+ON-REPLY 5:auth/check: {"jtype":"afb-reply","request":{"status":"success"},"response":{"isvalid":true}}
+auth refresh
+ON-REPLY 6:auth/refresh: {"jtype":"afb-reply","request":{"status":"success",
+   "token":"e83b36f8-d945-463d-b983-5d8ed73ba529"},"response":{"token":"Token was refreshed"}}
+</code></pre>
+
+<p>Then you leave. And can reconnect as below:</p>
+
+<pre><code>$ afb-client-demo ws://localhost:1234/api?token=e83b36f8-d945-463d-b983-5d8ed73ba529&amp;uuid=5fcc3f3d-4b84-4fc7-ba66-2d8bd34ae7d1 auth check
+ON-REPLY 1:auth/check: {"jtype":"afb-reply","request":{"status":"success"},"response":{"isvalid":true}}
+</code></pre>
+
+<p>The same can be continued using <strong>curl</strong>:</p>
+
+<pre><code>$ curl http://localhost:1234/api/auth/check?token=e83b36f8-d945-463d-b983-5d8ed73ba529&amp;uuid=5fcc3f3d-4b84-4fc7-ba66-2d8bd34ae7d1
+{"jtype":"afb-reply","request":{"status":"success"},"response":{"isvalid":true}}
+</code></pre>
+
+<a name="Format.of.replies"></a>
+<h2>Format of replies</h2>
+
+<p>The replies are made of one javascript object returned using JSON serialization.</p>
+
+<p>This object containts at least 2 mandatory fields of name <strong>jtype</strong> and <strong>request</strong>
+and an optionnal field of name <strong>response</strong>.</p>
+
+<a name="Field.jtype"></a>
+<h3>Field jtype</h3>
+
+<p>The field <strong>jtype</strong> must have a value of type string equel to <strong>&ldquo;afb-reply&rdquo;</strong>.</p>
+
+<a name="Field.request"></a>
+<h3>Field request</h3>
+
+<p>The field <strong>request</strong> must have a value of type object. This request object
+has at least one field named <strong>status</strong> and four optionnal fields of name
+<strong>info</strong>, <strong>token</strong>, <strong>uuid</strong>, <strong>reqid</strong>.</p>
+
+<a name="Subfield.request.status"></a>
+<h4>Subfield request.status</h4>
+
+<p><strong>status</strong> must have a value of type string. This string is equal to <strong>&ldquo;success&rdquo;</strong>
+only in case of success.</p>
+
+<a name="Subfield.request.info"></a>
+<h4>Subfield request.info</h4>
+
+<p><strong>info</strong> is of type string and represent optionnal the information added to the reply.</p>
+
+<a name="Subfield.request.token"></a>
+<h4>Subfield request.token</h4>
+
+<p><strong>token</strong> is of type string. It is sent either on the creation of the
+session or when the token is refreshed.</p>
+
+<a name="Subfield.request.uuid"></a>
+<h4>Subfield request.uuid</h4>
+
+<p><strong>uuid</strong> is of type string. It is sent on the creation of the session.</p>
+
+<a name="Subfield.request.reqid"></a>
+<h4>Subfield request.reqid</h4>
+
+<p><strong>reqid</strong> is of type string. It is sent in response of HTTP requests
+that added a parameter of name <strong>reqid</strong> or <strong>x-afb-reqid</strong>. The value
+sent in the reply is the exact value received on the request.</p>
+
+<a name="Field.response"></a>
+<h3>Field response</h3>
+
+<p>This field response optionnaly containts the object returned with successful replies.</p>
+
+<a name="Template"></a>
+<h3>Template</h3>
+
+<p>This is a template of replies:</p>
+
+<pre><code>{
+  "jtype": "afb-reply",
+  "request": {
+   "status": "success",
+   "info": "informationnal text",
+   "token": "e83b36f8-d945-463d-b983-5d8ed73ba52",
+   "uuid": "5fcc3f3d-4b84-4fc7-ba66-2d8bd34ae7d1",
+   "reqid": "application-generated-id-23456"
+ },
+  "response": ....any response object....
+}
+</code></pre>
 </body>
 </html>
index 70dde78..a2bbf4d 100644 (file)
@@ -71,13 +71,21 @@ For this reason, the binder should authenticate the application
 by using a commonly shared secret named token and the identification
 of the client named session.
 
+The examples **token-websock.qml** and **afb-client** are demonstrating
+how authentication and sessions are managed.
+
 ### Handling sessions
 
 Plugins and features of the binder need to keep track of the client
 instances. This of importance for plugins running as service
 because they may have to separate the data of each client.
 
-For common HTML5 browser running an HTML5 application.
+For HTML5 applications, the web runtime handles the cookie of session
+that the binder afb-daemon automatically sets.
+
+In any case, the session identifier can be set using the parameters
+**uuid** or **x-afb-uuid** in the request uri. That is understood
+by HTTP requests and by the negociation of websockets.
 
 ### Exchanging tokens
 
@@ -86,8 +94,170 @@ and its client: the application. This initial secret is the
 initial token.
 
 For each of its client application, the binder manages a current active
-token. The initial token is the default active token. It is the expected
-token for new clients.
+token for the session. This authentication token can be a requirement for
+accessing some methods.
+
+The token must be passed in the request uri on HTTP or at connecting
+websockets using the parameter **token** or **x-afb-token**.
+
+To ensure security, tokens must be refreshed periodically.
+
+### Example of session management
+
+For the following exmples, we suppose that you launched **afb-daemon** like that or similar:
+
+    $ afb-daemon --port=1234 --token=123456 [...]
+
+with the expectation that the plugin **AuthLogin** is loaded.
+
+#### Using curl
+
+First, connects with the initial token, 123456:
+
+    $ curl http://localhost:1234/api/auth/connect?token=123456
+    {
+      "jtype": "afb-reply",
+      "request": {
+         "status": "success",
+         "token": "0aef6841-2ddd-436d-b961-ae78da3b5c5f",
+         "uuid": "850c4594-1be1-4e9b-9fcc-38cc3e6ff015"
+      },
+      "response": {"token": "A New Token and Session Context Was Created"}
+    }
+
+It returns an answer containing the uuid of the session, 850c4594-1be1-4e9b-9fcc-38cc3e6ff015,
+and the refreshed token, 850c4594-1be1-4e9b-9fcc-38cc3e6ff015.
+
+Let check that it is available:
+
+    $ curl http://localhost:1234/api/auth/check?token=0aef6841-2ddd-436d-b961-ae78da3b5c5f\&uuid=850c4594-1be1-4e9b-9fcc-38cc3e6ff015
+    {
+      "jtype": "afb-reply",
+      "request": {"status":"success"},
+      "response": {"isvalid":true}
+    }
+
+It works! So try now to refresh the token:
+
+    $ curl http://localhost:1234/api/auth/refresh?token=0aef6841-2ddd-436d-b961-ae78da3b5c5f\&uuid=850c4594-1be1-4e9b-9fcc-38cc3e6ff015
+    {
+      "jtype": "afb-reply",
+      "request": {
+         "status":"success",
+         "token":"b8ec3ec3-6ffe-448c-9a6c-efda69ad7bd9"
+      },
+      "response": {"token":"Token was refreshed"}
+    }
+
+Let now close the session:
+
+    curl http://localhost:1234/api/auth/logout?token=b8ec3ec3-6ffe-448c-9a6c-efda69ad7bd9\&uuid=850c4594-1be1-4e9b-9fcc-38cc3e6ff015
+    {
+      "jtype": "afb-reply",
+      "request": {"status": "success"},
+      "response": {"info":"Token and all resources are released"}
+    }
+
+So now, checking for the uuid will be refused:
+
+    curl http://localhost:1234/api/auth/check?token=b8ec3ec3-6ffe-448c-9a6c-efda69ad7bd9\&uuid=850c4594-1be1-4e9b-9fcc-38cc3e6ff015
+    {
+      "jtype": "afb-reply",
+      "request": {
+         "status": "failed",
+         "info": "invalid token's identity"
+      }
+    }
+
+#### Using afb-client-demo
+
+Here is an example of exchange using **afb-client-demo**:
+
+    $ afb-client-demo ws://localhost:1234/api?token=123456
+    auth connect
+    ON-REPLY 1:auth/connect: {"jtype":"afb-reply","request":{"status":"success",
+       "token":"63f71a29-8b52-4f9b-829f-b3028ba46b68","uuid":"5fcc3f3d-4b84-4fc7-ba66-2d8bd34ae7d1"},
+       "response":{"token":"A New Token and Session Context Was Created"}}
+    auth check
+    ON-REPLY 2:auth/check: {"jtype":"afb-reply","request":{"status":"success"},"response":{"isvalid":true}}
+    auth refresh
+    ON-REPLY 4:auth/refresh: {"jtype":"afb-reply","request":{"status":"success",
+       "token":"8b8ba8f4-1b0c-48fa-962d-4a00a8c9157e"},"response":{"token":"Token was refreshed"}}
+    auth check
+    ON-REPLY 5:auth/check: {"jtype":"afb-reply","request":{"status":"success"},"response":{"isvalid":true}}
+    auth refresh
+    ON-REPLY 6:auth/refresh: {"jtype":"afb-reply","request":{"status":"success",
+       "token":"e83b36f8-d945-463d-b983-5d8ed73ba529"},"response":{"token":"Token was refreshed"}}
+
+Then you leave. And can reconnect as below:
+
+    $ afb-client-demo ws://localhost:1234/api?token=e83b36f8-d945-463d-b983-5d8ed73ba529\&uuid=5fcc3f3d-4b84-4fc7-ba66-2d8bd34ae7d1 auth check
+    ON-REPLY 1:auth/check: {"jtype":"afb-reply","request":{"status":"success"},"response":{"isvalid":true}}
+
+The same can be continued using **curl**:
+
+    $ curl http://localhost:1234/api/auth/check?token=e83b36f8-d945-463d-b983-5d8ed73ba529\&uuid=5fcc3f3d-4b84-4fc7-ba66-2d8bd34ae7d1
+    {"jtype":"afb-reply","request":{"status":"success"},"response":{"isvalid":true}}
+
+Format of replies
+-----------------
+
+The replies are made of one javascript object returned using JSON serialization.
+
+This object containts at least 2 mandatory fields of name **jtype** and **request**
+and an optionnal field of name **response**.
+
+### Field jtype
+
+The field **jtype** must have a value of type string equel to **"afb-reply"**.
+
+### Field request
+
+The field **request** must have a value of type object. This request object
+has at least one field named **status** and four optionnal fields of name
+**info**, **token**, **uuid**, **reqid**.
+
+#### Subfield request.status
+
+**status** must have a value of type string. This string is equal to **"success"**
+only in case of success.
+
+#### Subfield request.info
+
+**info** is of type string and represent optionnal the information added to the reply.
+
+#### Subfield request.token
+
+**token** is of type string. It is sent either on the creation of the
+session or when the token is refreshed.
+
+#### Subfield request.uuid
+
+**uuid** is of type string. It is sent on the creation of the session.
+
+#### Subfield request.reqid
+
+**reqid** is of type string. It is sent in response of HTTP requests
+that added a parameter of name **reqid** or **x-afb-reqid**. The value
+sent in the reply is the exact value received on the request.
+
+### Field response
+
+This field response optionnaly containts the object returned with successful replies.
+
+### Template
 
+This is a template of replies:
 
+    {
+      "jtype": "afb-reply",
+      "request": {
+           "status": "success",
+           "info": "informationnal text",
+           "token": "e83b36f8-d945-463d-b983-5d8ed73ba52",
+           "uuid": "5fcc3f3d-4b84-4fc7-ba66-2d8bd34ae7d1",
+           "reqid": "application-generated-id-23456"
+         },
+      "response": ....any response object....
+    }
 
index b323688..8c7b50f 100644 (file)
@@ -15,13 +15,17 @@ Author:  Manuel Bachmann
 <a name="List.of.plugins"></a>
 <h2>List of plugins</h2>
 
-<p>  Here are the plugins shipped in the source tree:
- * Hello World
- * Authentication
- * Tic Tac Toe
- * Audio <em>(2 backends: ALSA/PulseAudio)</em>
- * Radio <em>(1 backend: RTLSDR RTL2832U)</em>
- * Media <em>(1 backend: Rygel UPnP)</em></p>
+<p>Here are the plugins shipped in the source tree:</p>
+
+<ul>
+<li>Hello World</li>
+<li>Authentication</li>
+<li>Tic Tac Toe</li>
+<li>Audio <em>(2 backends: ALSA/PulseAudio)</em></li>
+<li>Radio <em>(1 backend: RTLSDR RTL2832U)</em></li>
+<li>Media <em>(1 backend: Rygel UPnP)</em></li>
+</ul>
+
 
 <p>All plugins may not be built, depending on the development libraries present on the system at build time.</p>
 
@@ -35,13 +39,17 @@ Author:  Manuel Bachmann
 
 <p>This plugin provides a few unauthenticated requests, all beginning with &ldquo;ping&rdquo;, to demonstrate basic binder capabilities.</p>
 
-<p><strong>Verbs</strong>:
-* <em>ping:</em> returns a success response
-* <em>pingfail:</em> returns a failure response
-* <em>pingnull:</em> returns a success response, with an empty JSON response field
-* <em>pingbug:</em> does a memory violation (intercepted by the binder)
-* <em>pingJson:</em> returns a success response, with a complex JSON response field
-* <em>pingevent:</em> broadcasts a global event</p>
+<p><strong>Verbs</strong>:</p>
+
+<ul>
+<li><em>ping:</em> returns a success response</li>
+<li><em>pingfail:</em> returns a failure response</li>
+<li><em>pingnull:</em> returns a success response, with an empty JSON response field</li>
+<li><em>pingbug:</em> does a memory violation (intercepted by the binder)</li>
+<li><em>pingJson:</em> returns a success response, with a complex JSON response field</li>
+<li><em>pingevent:</em> broadcasts a global event</li>
+</ul>
+
 
 <p><br /></p>
 
@@ -54,12 +62,16 @@ Author:  Manuel Bachmann
 
 <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>
 
-<p><strong>Verbs</strong>:
-* <em>ping:</em> returns a success response
-* <em>connect:</em> creates a session and returns a new token
-* <em>refresh:</em> returns a new token
-* <em>check:</em> verifies the passed token is valid
-* <em>logout:</em> closes the session</p>
+<p><strong>Verbs</strong>:</p>
+
+<ul>
+<li><em>ping:</em> returns a success response</li>
+<li><em>connect:</em> creates a session and returns a new token</li>
+<li><em>refresh:</em> returns a new token</li>
+<li><em>check:</em> verifies the passed token is valid</li>
+<li><em>logout:</em> closes the session</li>
+</ul>
+
 
 <p><br /></p>
 
@@ -70,34 +82,46 @@ Author:  Manuel Bachmann
 
 <p>This plugin provides an interactive Tic Tac Toe game where the binder returns the grid as a JSON response.</p>
 
-<p><strong>Verbs</strong>:
-* <em>new:</em> starts a new game
-* <em>play:</em> asks the server to play
-* <em>move:</em> gives a client move
-* <em>board:</em> gets the current board state, as a JSON structure
-* <em>level</em>: sets the server level
-* <em>join</em>: joins an existing board
-* <em>undo</em>: undo the last move
-* <em>wait</em>: wait for a move</p>
+<p><strong>Verbs</strong>:</p>
+
+<ul>
+<li><em>new:</em> starts a new game</li>
+<li><em>play:</em> asks the server to play</li>
+<li><em>move:</em> gives a client move</li>
+<li><em>board:</em> gets the current board state, as a JSON structure</li>
+<li><em>level</em>: sets the server level</li>
+<li><em>join</em>: joins an existing board</li>
+<li><em>undo</em>: undo the last move</li>
+<li><em>wait</em>: wait for a move</li>
+</ul>
+
 
 <p><br /></p>
 
 <a name="Audio"></a>
 <h3>Audio</h3>
 
-<p>A sample Audio plugin with 2 backends:
- * ALSA (mandatory)
- * PulseAudio (optional)</p>
+<p>A sample Audio plugin with 2 backends:</p>
+
+<ul>
+<li>ALSA (mandatory)</li>
+<li>PulseAudio (optional)</li>
+</ul>
+
 
 <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>
 
-<p><strong>Verbs</strong>:
-* <em>ping:</em> returns a success response
-* <em>init:</em> initializes backend, on the &ldquo;default&rdquo; sound card
-* <em>volume:</em> gets or sets volume, in % (0-100)
-* <em>channels:</em> gets or sets channels count (1-8)
-* <em>mute:</em> gets or sets the mute status (on-off)
-* <em>play</em>: gets or sets the playing status (on-off)</p>
+<p><strong>Verbs</strong>:</p>
+
+<ul>
+<li><em>ping:</em> returns a success response</li>
+<li><em>init:</em> initializes backend, on the &ldquo;default&rdquo; sound card</li>
+<li><em>volume:</em> gets or sets volume, in % (0-100)</li>
+<li><em>channels:</em> gets or sets channels count (1-8)</li>
+<li><em>mute:</em> gets or sets the mute status (on-off)</li>
+<li><em>play</em>: gets or sets the playing status (on-off)</li>
+</ul>
+
 
 <p><em>(if PulseAudio development libraries are not found at build time, only ALSA will be available)</em></p>
 
@@ -110,19 +134,27 @@ Author:  Manuel Bachmann
 <a name="Radio"></a>
 <h3>Radio</h3>
 
-<p>A sample AM/FM Radio plugin with 1 backend:
- * RTLSDR - Realtek RTL2832U dongles (mandatory)</p>
+<p>A sample AM/FM Radio plugin with 1 backend:</p>
+
+<ul>
+<li>RTLSDR - Realtek RTL2832U dongles (mandatory)</li>
+</ul>
+
 
 <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>
 
-<p><strong>Verbs</strong>:
-* <em>ping:</em> returns a success response
-* <em>init:</em> initializes backend, looking for plugged-in devices
-* <em>power:</em> sets device power status (on-off)
-* <em>mode:</em> sets device reception mode (AM-FM)
-* <em>freq:</em> sets device frequency (in Hz)
-* <em>mute</em>: sets device mute status (on-off)
-* <em>play</em>: sets device playing status (on-off)</p>
+<p><strong>Verbs</strong>:</p>
+
+<ul>
+<li><em>ping:</em> returns a success response</li>
+<li><em>init:</em> initializes backend, looking for plugged-in devices</li>
+<li><em>power:</em> sets device power status (on-off)</li>
+<li><em>mode:</em> sets device reception mode (AM-FM)</li>
+<li><em>freq:</em> sets device frequency (in Hz)</li>
+<li><em>mute</em>: sets device mute status (on-off)</li>
+<li><em>play</em>: sets device playing status (on-off)</li>
+</ul>
+
 
 <p><em>(if rtlsdr development libraries are not found at build time, this plugin will not be built)</em></p>
 
@@ -131,21 +163,29 @@ Author:  Manuel Bachmann
 <a name="Media"></a>
 <h3>Media</h3>
 
-<p>A sample Media Server plugin with 1 backend:
- * Rygel</p>
+<p>A sample Media Server plugin with 1 backend:</p>
+
+<ul>
+<li>Rygel</li>
+</ul>
+
 
 <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>
 
-<p><strong>Verbs</strong>:
-* <em>ping:</em> returns a success response
-* <em>init:</em> initializes backend, looking for an active local UPnP server
-* <em>list:</em> returns list of audio files, as a JSON structure
-* <em>select:</em> select an audio files, by index number (001-&hellip;)
-* <em>play:</em> plays the currently selected audio file
-* <em>stop:</em> stops the currently selected audio file
-* <em>pause:</em> pauses the currently selected audio file
-* <em>seek:</em> seeks in the currently selected audio file, in seconds
-* <em>upload:</em> uploads an audio file, with a POST request</p>
+<p><strong>Verbs</strong>:</p>
+
+<ul>
+<li><em>ping:</em> returns a success response</li>
+<li><em>init:</em> initializes backend, looking for an active local UPnP server</li>
+<li><em>list:</em> returns list of audio files, as a JSON structure</li>
+<li><em>select:</em> select an audio files, by index number (001-&hellip;)</li>
+<li><em>play:</em> plays the currently selected audio file</li>
+<li><em>stop:</em> stops the currently selected audio file</li>
+<li><em>pause:</em> pauses the currently selected audio file</li>
+<li><em>seek:</em> seeks in the currently selected audio file, in seconds</li>
+<li><em>upload:</em> uploads an audio file, with a POST request</li>
+</ul>
+
 
 <p><em>(if GUPnP/GSSDP development libraries are not fund at build time, this plugin will not be built)</em></p>
 
index 7e351b6..1986adf 100644 (file)
@@ -5,13 +5,15 @@
 
 
 ## List of plugins
-  Here are the plugins shipped in the source tree:
- * Hello World
- * Authentication
- * Tic Tac Toe
- * Audio _(2 backends: ALSA/PulseAudio)_
- * Radio _(1 backend: RTLSDR RTL2832U)_
- * Media _(1 backend: Rygel UPnP)_
+
+Here are the plugins shipped in the source tree:
+
+* Hello World
+* Authentication
+* Tic Tac Toe
+* Audio _(2 backends: ALSA/PulseAudio)_
+* Radio _(1 backend: RTLSDR RTL2832U)_
+* Media _(1 backend: Rygel UPnP)_
 
 All plugins may not be built, depending on the development libraries present on the system at build time.
 
@@ -25,6 +27,7 @@ A sample Hello World plugin for demonstration and learning purposes.
 This plugin provides a few unauthenticated requests, all beginning with "ping", to demonstrate basic binder capabilities.
 
 **Verbs**:
+
 * _ping:_ returns a success response
 * _pingfail:_ returns a failure response
 * _pingnull:_ returns a success response, with an empty JSON response field
@@ -44,6 +47,7 @@ This plugin provides a few requests to demonstrate the binder's token-based secu
 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.
 
 **Verbs**:
+
 * _ping:_ returns a success response
 * _connect:_ creates a session and returns a new token
 * _refresh:_ returns a new token
@@ -60,6 +64,7 @@ A sample Tic Tac Toe game plugin.
 This plugin provides an interactive Tic Tac Toe game where the binder returns the grid as a JSON response. 
 
 **Verbs**:
+
 * _new:_ starts a new game
 * _play:_ asks the server to play
 * _move:_ gives a client move
@@ -75,12 +80,14 @@ This plugin provides an interactive Tic Tac Toe game where the binder returns th
 ### Audio
 
 A sample Audio plugin with 2 backends:
- * ALSA (mandatory)
- * PulseAudio (optional)
+
+* ALSA (mandatory)
+* PulseAudio (optional)
 
 This plugin is able to initialize a specific soundcard, define volume levels, channels (mono/stereo...), mute sound, and play a 22,050 Hz PCM stream.
 
 **Verbs**:
+
 * _ping:_ returns a success response
 * _init:_ initializes backend, on the "default" sound card
 * _volume:_ gets or sets volume, in % (0-100)
@@ -100,11 +107,13 @@ _(a specifc backend can be forced by using this syntax before running afb-daemon
 ### Radio
 
 A sample AM/FM Radio plugin with 1 backend:
- * RTLSDR - Realtek RTL2832U dongles (mandatory)
+
+* RTLSDR - Realtek RTL2832U dongles (mandatory)
 
 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 **audio** plugin).
 
 **Verbs**:
+
 * _ping:_ returns a success response
 * _init:_ initializes backend, looking for plugged-in devices
 * _power:_ sets device power status (on-off)
@@ -121,11 +130,13 @@ _(if rtlsdr development libraries are not found at build time, this plugin will
 ### Media
 
 A sample Media Server plugin with 1 backend:
+
  * Rygel
 
 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.
 
 **Verbs**:
+
 * _ping:_ returns a success response
 * _init:_ initializes backend, looking for an active local UPnP server
 * _list:_ returns list of audio files, as a JSON structure
index f5dcb64..ce1cba4 100644 (file)
@@ -18,9 +18,9 @@ Author:  Manuel Bachmann
 <p>Here are the tests shipped in the source tree:</p>
 
 <ul>
-<li><strong>afb-client-demo</strong> (command-line WebSockets)</li>
-<li><strong>token-websock.qml</strong> (Qt/QML WebSockets)</li>
-<li><strong>*.html</strong> (HTML5/JS HTTP-REST &amp; WebSockets)</li>
+<li><p><strong>afb-client-demo</strong> (command-line WebSockets)</p></li>
+<li><p><strong>token-websock.qml</strong> (Qt/QML WebSockets)</p></li>
+<li><p><strong>*.html</strong> (HTML5/JS HTTP-REST &amp; WebSockets)</p></li>
 </ul>
 
 
@@ -52,7 +52,7 @@ Author:  Manuel Bachmann
 So, try:</p>
 
 <pre><code>auth connect
-audio init
+hello pingjson true
 </code></pre>
 
 <p><br /></p>
index 4ea2527..98d971f 100644 (file)
@@ -9,7 +9,9 @@
 Here are the tests shipped in the source tree:
 
 * **afb-client-demo** (command-line WebSockets)
+
 * **token-websock.qml** (Qt/QML WebSockets)
+
 * ***.html** (HTML5/JS HTTP-REST & WebSockets)
 
 
@@ -38,7 +40,7 @@ The command doesn't return. You should type requests of type <api> <verb> [<json
 So, try:
 
     auth connect
-    audio init
+    hello pingjson true
 
 <br />