| | 1 | = Attenuator API = |
| | 2 | |
| | 3 | == REST API == |
| | 4 | All valid calls will reply with formatted XML. The first line will be `<response status="OK">` for commands that execute correctly, or `<response status="ERROR">` if either the parameters passed are invalid of the call failed for some other reason (check /var/log/syslog on the relevant Pi for more information). |
| | 5 | || '''REST API Call''' || '''Description''' || |
| | 6 | || /Attenuator/set?name=''<int>''&value=''<float>'' || Sets the requested attenuator to the desired dB value. || |
| | 7 | || /Attenuator/zero_all || Set all attenuators to 0 dB. || |
| | 8 | || /Attenuator/read?name=''<int>'' || Read the current dB setting of the requested attenuator. || |
| | 9 | || /Attenuator/read_all || Read the current dB setting of all attenuators. || |
| | 10 | |
| | 11 | '''IMPORTANT NOTE:''' The attenuator API will round the requested set attenuator value to the nearest possible value based on the attenuator it has (eg. 37.63 dB with 0.5 dB/step attenuator will be rounded to 37.5 dB) |
| | 12 | |
| | 13 | '''Example XML responses:''' |
| | 14 | |
| | 15 | Response to: .../Attenuator/set?name=1&value=37.63 |
| | 16 | {{{ |
| | 17 | <?xml version="1.0" encoding="UTF-8"?> |
| | 18 | <response status="OK"> |
| | 19 | <action service="Attenuator" name="set"> |
| | 20 | <attenuators> |
| | 21 | <attenuator name="1" value="37.5"/> |
| | 22 | </attenuators> |
| | 23 | </action> |
| | 24 | </response> |
| | 25 | }}} |
| | 26 | |
| | 27 | Response to: .../Attenuator/zero_all |
| | 28 | {{{ |
| | 29 | |
| | 30 | <?xml version="1.0" encoding="UTF-8"?> |
| | 31 | <response status="OK"> |
| | 32 | <action service="Attenuator" name="zero_all"> |
| | 33 | <attenuators> |
| | 34 | <attenuator name="1" value="0.0"/> |
| | 35 | <attenuator name="2" value="0.0"/> |
| | 36 | </attenuators> |
| | 37 | </action> |
| | 38 | </response> |
| | 39 | }}} |
| | 40 | |
| | 41 | Response to: .../Attenuator/read?name=1 |
| | 42 | {{{ |
| | 43 | <?xml version="1.0" encoding="UTF-8"?> |
| | 44 | <response status="OK"> |
| | 45 | <action service="Attenuator" name="read"> |
| | 46 | <attenuators> |
| | 47 | <attenuator name="1" value="37.5"/> |
| | 48 | </attenuators> |
| | 49 | </action> |
| | 50 | </response> |
| | 51 | }}} |
| | 52 | |
| | 53 | Response to: .../Attenuator/read_all |
| | 54 | {{{ |
| | 55 | |
| | 56 | <?xml version="1.0" encoding="UTF-8"?> |
| | 57 | <response status="OK"> |
| | 58 | <action service="Attenuator" name="read_all"> |
| | 59 | <attenuators> |
| | 60 | <attenuator name="1" value="37.5"/> |
| | 61 | <attenuator name="2" value="0.0"/> |
| | 62 | </attenuators> |
| | 63 | </action> |
| | 64 | </response> |
| | 65 | }}} |