X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=doc%2Fafb-application-writing.html;h=12a2f13feca66c95b3e9a859a6b82983fcccce6b;hb=540ece2baf7de59565b42d427e206769ec4da56a;hp=b394e6b9a78d7c17befb548b87ff8998759ff5eb;hpb=741d4e0505c588f38a64350c1d3c53c74f7ac22c;p=src%2Fapp-framework-binder.git diff --git a/doc/afb-application-writing.html b/doc/afb-application-writing.html index b394e6b9..12a2f13f 100644 --- a/doc/afb-application-writing.html +++ b/doc/afb-application-writing.html @@ -5,18 +5,39 @@ + HOWTO WRITE an APPLICATION above AGL FRAMEWORK +

HOWTO WRITE an APPLICATION above AGL FRAMEWORK

José Bollo

-

09 juin 2016

+

Fulup Ar Foll

+

24 juin 2016

HOWTO WRITE an APPLICATION above AGL FRAMEWORK

-
version: 1
-Date:    09 juin 2016
-Author:  José Bollo

Programmation Languages for Applications

Writing an HTML5 application

Developers of HTML5 applications (client side) can easily create applications for AGL framework using their preferred HTML5 framework.

@@ -130,6 +154,9 @@ Author: José Bollo } }

Using afb-client-demo

+
+

The program is packaged within AGL in the rpm libafbwsc-dev

+

Here is an example of exchange using afb-client-demo:

$ afb-client-demo ws://localhost:1234/api?token=123456
 auth connect
@@ -155,6 +182,19 @@ ON-REPLY 1:auth/check: {"jtype":"afb-reply","request&qu
 

Format of replies

Replies use javascript object returned as serialized JSON.

This object contains at least 2 mandatory fields of name jtype and request and one optional field of name response.

+

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....
+}

Field jtype

The field jtype must have a value of type string equal to "afb-reply".

Field request

@@ -171,18 +211,22 @@ ON-REPLY 1:auth/check: {"jtype":"afb-reply","request&qu

reqid is of type string. It is sent in response to HTTP requests that added a parameter of name reqid or x-afb-reqid at request time. Value returns in the reply has the exact same value as the one received in the request.

Field response

This field response optionally contains an object returned when request succeeded.

-

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....
-}
+

Format of events

+

Events are javascript object serialized as JSON.

+

This object contains at least 2 mandatory fields of name jtype and event and one optional field of name data.

+

Template

+

Here is a template of event:

+
{
+   "jtype": "afb-event",
+   "event": "sample_api_name/sample_event_name",
+   "data": ...any event data...
+}
+

Field jtype

+

The field jtype must have a value of type string equal to "afb-event".

+

Field event

+

The field event carries the event's name.

+

The name of the event is made of two parts separated by a slash: the name of the name of the API that generated the event and the name of event within the API.

+

Field data

+

This field data if present holds the data carried by the event.