f4exb / sdrangel

SDR Rx/Tx software for Airspy, Airspy HF+, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay and FunCube
GNU General Public License v3.0
2.93k stars 445 forks source link

Update web API for Satellite Tracker #948

Closed Valstee closed 3 years ago

Valstee commented 3 years ago

Hi @srcejon, hi @f4exb, I tried to update the web API to integrate the Satellite Tracker feature. But I didn't succeed. Is it technically possible? Do you plan to integrate it? (It can be useful to manage the issues #845 and #840 by using sdrangel server) Thanks a lot, Valentin

f4exb commented 3 years ago

Can you be more specific?

Valstee commented 3 years ago

I use the server version (no GUI) on a raspberry to solve some of the problems mentioned in #840 et #845 . But I can't send PATCH/POST commands for the "Satellite Tracker" feature to set them up. (especially the name of the satellites to be observed and the command to be executed accordingly) I think it's not implemented yet (i've got a "Error: Invalid JSON request" error 400) . I try to reproduce what @srcejon have done with other feature but I didn't succeed... (for exemple in this commit : https://github.com/f4exb/sdrangel/commit/721d0a40c2ac0751ee5e3d7778bf0ee7684eefb4) So It's more an enhancement request...

f4exb commented 3 years ago

In can help if you post the JSON payload of your request

srcejon commented 3 years ago

The API should be there - E.g: see: https://github.com/f4exb/sdrangel/blob/master/swagger/sdrangel/api/swagger/include/SatelliteTracker.yaml

But I must admit, I didn't spend much time testing it. The list of satellites to track is an array of strings named "satellites". Perhaps you're just sending a string rather than an array or something like that?

Valstee commented 3 years ago

What I do to test is:

feature request

f4exb commented 3 years ago

Although the PUT should work what you really want to do here is a partial update so rather use PATCH. PUT will take default values for all other settings so may be changing them. However I think it should work in both cases.

srcejon commented 3 years ago

I see a couple of bugs - looks like I haven't updated some of the code in webapi for the satellite tracker. I'll do that now.

srcejon commented 3 years ago

The above patch is a partial fix, in that it allows basic settings such as the target to be set.

However, there is still a problem when trying to set the satellites list. I get a null pointer exception in the swagger code:

image

f4exb commented 3 years ago

Could be an issue with embedded complex objects (lists in that case) as we had before for SoapySDR. I'll have a look.

f4exb commented 3 years ago

I must admit this is not very intuitive but if the structure contains embedded objects or lists one has to invoke the init() method on it like in the getChannelSettings() here: https://github.com/f4exb/sdrangel/blob/master/sdrbase/webapi/webapirequestmapper.cpp#L3868