aboutsummaryrefslogtreecommitdiffstats
path: root/templates/service/README.md
blob: 17c9869c51559df8093d3b769dfb0a0f9733b2d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Application Framework - Service Template

## Instructions

Duplicate directory and adjust names. In particular, replace 'xxxxxx' by a proper service name.

* adjust CMakeLists.txt (project name and version)
* ajdust config.xml (description, author, license...)
* rename xxxxxx-service-binding.c to something meaningful
* store icon file in icons directory and update the variable PROJECT_ICON in CMakeLists.txt

## Build

Run:

```
mkdir build
cd build
cmake ..
make
```

## Deployment

Copy the .wgt file on the target through ssh and install it (adjust BOARDIP to your real IP address):

```
$ BOARDIP=1.2.3.4
$ scp xxxxxx-service.wgt root@$BOARDIP:/tmp
$ ssh root@$BOARDIP
# afm-util install /tmp/xxxxxx-service.wgt
# afm-util list
```

## Run service manually

On the target board:

```
# afm-util start xxxxxx-server@0.1
# ps -ef| grep afb-daemon | grep xxx
```

## Test using curl

```
# PORT=12345 # adjust the port depending in on afb-daemon instance: use ps -ef to check
# curl -v http://localhost:$PORT/api/xxxxxx/ping
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 5555 (#0)
> GET /api/xxxxxx/ping HTTP/1.1
> Host: localhost:5555
> User-Agent: curl/7.44.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Connection: Keep-Alive
< Content-Length: 184
< Set-Cookie: x-afb-uuid-5555=30ab9573-cbc8-43f7-b385-0186feebc69a; Path=/api; Max-Age=3600; HttpOnly
< Date: Sun, 10 Jul 2016 00:09:14 GMT
< 
* Connection #0 to host localhost left intact
{"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:~# 
```