REST API for A-weighting

It’s ok to enable A-weighting on the application interface but we cannot find corresponding API command on REST API. Please help. Basically, we use it for automated testing in production line. So, all controls are on REST API.

Hi @Chris, there are two APIs for getting an RMS measurement across a specified frequency range. The first is

GET /RmsDbv/{StartFreq}/{EndFreq}

And the second is

GET /RmsDbv/AWeighting/{StartFreq}/{EndFreq}

The second one will apply A Weighting to the RMS measurement while the first one will not.

GET /RmsDbv/{StartFreq}/{EndFreq}
GET /SnrDb/{FundFreq}/{MinFreq}/{MaxFreq}
GET /ThdPct/{FundFreq}/{MaxFreq

Above 3 APIs are ok.

We still have problem with below API:
GET /RmsDbv/AWeighting/{StartFreq}/{EndFreq}

Actually, we see problem with below APIs as well:
GET /Status/Connection
GET /RmsDbv/AWeighting/20/20000
PUT /Settings/SampleRate/48000
PUT /Settings/Window/Rectangle

Attached is the error screen we got.

Above pop up error only happen on Win10 system. If we use Win7, we don’t see this pop up error box but the problematic APIs still not work.

Hi @chris,

I just checked the following APIs in 0.997 with the REST_TEST app and got the following:

GET /Status/Connection returned 0.997 as expected. Can you please check sample app and see if it works for you?

GET /RmsDbv/AWeighting/20/20000 will be enabled for 0.998 this week, thanks for reporting
PUT /Settings/SampleRate/48000 will be enabled for 0.998 this week, thanks for reporting
PUT /Settings/Window/Rectangle will be enabled for 0.998 this week, thanks for reporting

I’d also like to have added the ability to see HTTP debug window to help with REST development and that could give more insight into Win7. Hopefully that makes it in.

Thanks very much for reporting

We tried GET /Status/Version It works.

But we cannot find GET /Status/Connection in REST_TEST app. Please give it a try and see if it really works.

Thanks.

Hi @Chris, release 0.998 was just posted HERE which should address these issues. First, note the REST_TEST has been updated HERE

The new REST_TEST has some added buttons as shown below. These buttons will let you test Windowing, Sample Rate, Connection and Weighting

There is also a console window you can show in the QA40x app with the -C command line option. The console window will appear as a separate window and should mirror the logging file if you have that enabled.

The output from the console makes it easy to see HTTP interaction in real time

Existing settings file loaded
Server started listening on port 9402
Usb Connected
Factory calibration data loaded from flash
---
Time 11:19:05.530
GET	Request:http://localhost:9402/Status/Version
Return: { "SessionId":"0", "Value":"0.998" }
Status: 200 (Elapsed: 5.00 mS)
---
Time 11:19:14.602
GET	Request:http://localhost:9402/Status/Connection
Return: { "SessionId":"0", "Value":"True" }
Status: 200 (Elapsed: 5.00 mS)
---
Time 11:19:20.630
PUT	Request:http://localhost:9402/Settings/Windowing/Rectangle
Return: { "SessionId":"0" }
Status: 200 (Elapsed: 11.00 mS)
---
Time 11:19:22.761
PUT	Request:http://localhost:9402/Settings/Windowing/FlatTop
Return: { "SessionId":"0" }
Status: 200 (Elapsed: 17.00 mS)
---
Time 11:19:25.762
PUT	Request:http://localhost:9402/Settings/SampleRate/192000
Return: { "SessionId":"0" }
Status: 200 (Elapsed: 15.70 mS)
---
Time 11:19:26.383
PUT	Request:http://localhost:9402/Settings/SampleRate/48000
Return: { "SessionId":"0" }
Status: 200 (Elapsed: 9.00 mS)
---
Time 11:19:28.155
PUT	Request:http://localhost:9402/Settings/Weighting/None
Return: { "SessionId":"0" }
Status: 200 (Elapsed: 16.00 mS)
---
Time 11:19:29.83
PUT	Request:http://localhost:9402/Settings/Weighting/AWeighting
Return: { "SessionId":"0" }
Status: 200 (Elapsed: 12.00 mS)

If you have a mal-formed HTTP request, or something that doesn’t make sense, you’ll see it in the console, instead of having to guess what might be wrong:

For example, if you try to compute THD without having done an acquisition first, you’ll see

And the same red highlighting will apply to bad argument too. So, it should help a lot with development.

Note that previously the API indicated that you could make RMS measurement with A-Weighting. That has changed. Now, you will either enable or disable A-Weighting just as you do from the front panel, and the RMS measurement will change based on weighting.

See PUT /Settings/Weighting/{WeightingType}

Also see:

PUT /Settings/SampleRate/{SampleRate}
PUT /Settings/Windowing/{WindowType}

Thanks!