17c9869c51559df8093d3b769dfb0a0f9733b2d7
[staging/xdg-launcher.git] / examples / service / README.md
1 # Application Framework - Service Template
2
3 ## Instructions
4
5 Duplicate directory and adjust names. In particular, replace 'xxxxxx' by a proper service name.
6
7 * adjust CMakeLists.txt (project name and version)
8 * ajdust config.xml (description, author, license...)
9 * rename xxxxxx-service-binding.c to something meaningful
10 * store icon file in icons directory and update the variable PROJECT_ICON in CMakeLists.txt
11
12 ## Build
13
14 Run:
15
16 ```
17 mkdir build
18 cd build
19 cmake ..
20 make
21 ```
22
23 ## Deployment
24
25 Copy the .wgt file on the target through ssh and install it (adjust BOARDIP to your real IP address):
26
27 ```
28 $ BOARDIP=1.2.3.4
29 $ scp xxxxxx-service.wgt root@$BOARDIP:/tmp
30 $ ssh root@$BOARDIP
31 # afm-util install /tmp/xxxxxx-service.wgt
32 # afm-util list
33 ```
34
35 ## Run service manually
36
37 On the target board:
38
39 ```
40 # afm-util start xxxxxx-server@0.1
41 # ps -ef| grep afb-daemon | grep xxx
42 ```
43
44 ## Test using curl
45
46 ```
47 # PORT=12345 # adjust the port depending in on afb-daemon instance: use ps -ef to check
48 # curl -v http://localhost:$PORT/api/xxxxxx/ping
49 *   Trying 127.0.0.1...
50 * Connected to localhost (127.0.0.1) port 5555 (#0)
51 > GET /api/xxxxxx/ping HTTP/1.1
52 > Host: localhost:5555
53 > User-Agent: curl/7.44.0
54 > Accept: */*
55
56 < HTTP/1.1 200 OK
57 < Connection: Keep-Alive
58 < Content-Length: 184
59 < Set-Cookie: x-afb-uuid-5555=30ab9573-cbc8-43f7-b385-0186feebc69a; Path=/api; Max-Age=3600; HttpOnly
60 < Date: Sun, 10 Jul 2016 00:09:14 GMT
61
62 * Connection #0 to host localhost left intact
63 {"response":"Some String","jtype":"afb-reply","request":{"status":"success","info":"Ping Binder Daemon tag=pingSample count=1 query={ }","uuid":"30ab9573-cbc8-43f7-b385-0186feebc69a"}}root@porter:~# 
64 ```
65
66