Version 1 (modified by 8 years ago) ( diff ) | ,
---|
Attenuator API
REST API
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).
REST API Call | Description |
/Attenuator/set?name=<int>&value=<float> | Sets the requested attenuator to the desired dB value. |
/Attenuator/zero_all | Set all attenuators to 0 dB. |
/Attenuator/read?name=<int> | Read the current dB setting of the requested attenuator. |
/Attenuator/read_all | Read the current dB setting of all attenuators. |
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)
Example XML responses:
Response to: …/Attenuator/set?name=1&value=37.63
<?xml version="1.0" encoding="UTF-8"?> <response status="OK"> <action service="Attenuator" name="set"> <attenuators> <attenuator name="1" value="37.5"/> </attenuators> </action> </response>
Response to: …/Attenuator/zero_all
<?xml version="1.0" encoding="UTF-8"?> <response status="OK"> <action service="Attenuator" name="zero_all"> <attenuators> <attenuator name="1" value="0.0"/> <attenuator name="2" value="0.0"/> </attenuators> </action> </response>
Response to: …/Attenuator/read?name=1
<?xml version="1.0" encoding="UTF-8"?> <response status="OK"> <action service="Attenuator" name="read"> <attenuators> <attenuator name="1" value="37.5"/> </attenuators> </action> </response>
Response to: …/Attenuator/read_all
<?xml version="1.0" encoding="UTF-8"?> <response status="OK"> <action service="Attenuator" name="read_all"> <attenuators> <attenuator name="1" value="37.5"/> <attenuator name="2" value="0.0"/> </attenuators> </action> </response>