Simplified doc-site generation
[AGL/documentation.git] / docs / 4_APIs_and_Services / 4.5_Message_Signaling / 4_AGL_Service_Signal_Composer / 4_SignalComposerAPI.md
1 ---
2 edit_link: ''
3 title: Signal Composer API
4 origin_url: >-
5   https://git.automotivelinux.org/apps/agl-service-signal-composer/plain/docs/part-1/4-SignalComposerAPI.md?h=master
6 ---
7
8 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/apis_services/master/agl-service-signal-composer-developer-guides-api-services-book.yml -->
9
10 # Signal Composer API
11
12 ## subscribe/unsubscribe
13
14 Using subscribe you can get update on change for signals you chose and you can
15 using wildcard to subscribe several signals in the same time.
16
17 ```json
18 signal-composer subscribe {"signal": "rear_left*"}
19 ON-REPLY 1:signal-composer/subscribe: {"jtype":"afb-reply","request":{"status":"success","uuid":"3d4b743b-7ac6-4d3c-8fce-721107f9dee5"}}
20 ```
21
22 Then event comes up like the following:
23
24 ```json
25 ON-EVENT signal-composer/257b343e-8ea9-4cd7-8f9e-1904fa77f8f2({"event":"signal-composer\/257b343e-8ea9-4cd7-8f9e-1904fa77f8f2","data":{"uid":"rear_left_door","event":"low-can\/messages.doors.rear_left.open","timestamp":4833910845032292484,"value":false},"jtype":"afb-event"})
26 ```
27
28 Unsubscribe happens the same way. When no more signals are holded by the client
29 then it unsubscribe from the *AGL Application Framework* event handle.
30
31 ## addObjects
32
33 Let you add sources or signals objects to the signal composer service after
34 its initialization phase. Use this verb and specify the file as argument, you
35 could use only the file name or the file name with its absolute path.
36
37 ```json
38 signal-composer addObjects {"file": "sig_doors.json"}
39 ON-REPLY 1:signal-composer/addObjects: {"jtype":"afb-reply","request":{"status":"success","uuid":"00d7a519-816e-486a-8163-3afb1face4fa"}}
40 signal-composer addObjects {"file": "/tmp/sig_doors.json"}
41 ON-REPLY 2:signal-composer/addObjects: {"jtype":"afb-reply","request":{"status":"success"}}
42 ```
43
44 You can follow the activity using the service log journal and check that the
45 correct number of objects has been added.
46
47 > **CAUTION**: You need to get the following permission to be able to load new
48 objects : `urn:AGL:permission::platform:composer:addObjects`
49
50 ## get
51
52 You can get a signal value be requesting the API with the verb *get*:
53
54 ```json
55 signal-composer get {"signal": "vehicle_speed", "options": {"average": 10}}
56 signal-composer get {"signal": "vehicle_speed", "options": {"minimum": 10}}
57 signal-composer get {"signal": "vehicle_speed", "options": {"maximum": 10}}
58 signal-composer get {"signal": "vehicle_speed"}
59 ```
60
61 You apply some simple mathematical functions by default present in the
62 binding, by default **last** is used:
63
64 - **average**: make an average on X latest seconds.
65 - **minimum**: return the minimum value found in the X latest seconds.
66 - **maximum**: return the maximum value found in the X latest seconds.
67 - **last**: return the latest value.
68
69 ## list
70
71 Verb **list** will output the list of defined signals.