Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preset enhancements - configuration save/restore framework #1050

Closed
srcejon opened this issue Nov 19, 2021 · 7 comments
Closed

Preset enhancements - configuration save/restore framework #1050

srcejon opened this issue Nov 19, 2021 · 7 comments

Comments

@srcejon
Copy link
Collaborator

srcejon commented Nov 19, 2021

Currently Device/Channel presets are separate from Feature presets. While this is nice in some use cases, in others, it would be nice if the two could be grouped as one. Perhaps there could be an option in the Device/Channel preset that determined whether it should save/restore Features as well?

Also, it would be useful if there were "application" presets, that included settings for multiple DeviceSets and also determined which Devices were used in each. E.g. for those with multiple SDRs, it would be nice if SDRangel started up with all DeviceSets setup to how there were on exit (As is currently the case for DeviceSet 0).

@f4exb
Copy link
Owner

f4exb commented Nov 20, 2021

Regarding mixing deviceset (device+channels) and featureset presets in one display this is a big issue because they are very different in nature. Most significantly the deviceset presets are ordered by center frequency of the device. In order to combine both displays one would have to drop the frequency display and ordering in the deviceset presets

image

Also maybe it is just me but I tend to order my deviceset presets by band or by service or by service + band so highly related to the frequency of operation. Conversely the frequency of operation is irrelevant for a feature and at least for some features the service is also irrelevant. For example the PTT feature is not bound to any frequency or service so under which group will I store it?

Here is my own example with all sections collapsed (collapse all could be a nice feature btw):
image

In conclusion:

it would be nice if the two could be grouped as one.

You have to explain me more or better why this would be nice to group things very different in nature

Perhaps there could be an option in the Device/Channel preset that determined whether it should save/restore Features as well?

I think not also somehow because of the difference in nature. I would rather keep the granularity to be able to combine presets in different configurations (more on "configurations" later since this is the second part of the initial post) So one deviceset preset can populate one deviceset (device + channels combinations) and one featureset preset can populate one featureset all this independently.

@srcejon
Copy link
Collaborator Author

srcejon commented Nov 20, 2021

Yes, the request isn't for displaying two different types of preset in the same table, but having a single preset/configuration that sets device settings, channels and features all in one.

So, for example, we could have:
An AIS configuration that included two AIS demods, the AIS feature and the map.
A satellite voice configuration that included one RX deviceset with NFM demod, one TX deviceset with NFM mod, the simple PTT, sat tracker, rotator and map features.
A digital video config that includes both DATV Mod and Demod.
A NOAA config including an APT demod and Sat Tracker.
And so on. I think these are all natural groupings.

This could be implemented by having a configuration that references an existing channel preset and feature preset, or similar, so you still have all existing functionality.

@f4exb
Copy link
Owner

f4exb commented Nov 20, 2021

OK I see so in fact it all boils down to what I called the "second part". In fact the presets are not the point what you would like to do is to be able to save and retrieve a complete configuration with all its devicesets and featuresets. You do not necessarily have to use a specific interface to combine presets you just build the instance with or without presets and once you are satisfied with it you "save" it in order to be able to retrieve it later. You would also like to be able to save many configurations and have them listed somewhere more or less in the same format as the presets display.

For what concerns "loading" complete configurations with many devicesets and features this already exists using the REST API via a Python script: https://github.com/f4exb/sdrangel/tree/master/scriptsapi#configpy But you have to build the JSON configuration by hand. I already had in my mind to extend the config.py script functionnality so that it is also able to dump a SDRangel instance configuration in the same format so that it can be used to reload a configuration in a next session or in a server instance. I think that being able to use this script two ways would be useful anyway particularly for headless operations.

Note that it is possible to invoke the config,py script from the GUI using the "Commands". For example:

image

JSON file content
[
    {
        "endpoint": "/deviceset",
        "method": "POST",
        "msg": "add Rx 1 device set"
    },
    {
        "endpoint": "/deviceset/1/device",
        "method": "PUT",
        "payload": {
            "hwType": "LocalInput"
        },
        "msg": "setup Local Input on Rx 1"
    },
    {
        "endpoint": "/preset",
        "method": "PATCH",
        "payload": {
            "deviceSetIndex": 1,
            "preset": {
                "groupName": "QO100",
                "centerFrequency": 489605000,
                "type": "R",
                "name": "Narrowband slave low"
            }
        },
        "msg": "load preset on Rx 1"
    },
    {
        "endpoint": "/deviceset",
        "method": "POST",
        "msg": "add Rx 2 device set"
    },
    {
        "endpoint": "/deviceset/2/device",
        "method": "PUT",
        "payload": {
            "hwType": "LocalInput"
        },
        "msg": "setup Local Input on Rx 2"                                                                                                                                                                                                  
    },                                                                                                                                                                                                                                      
    {                                                                                                                                                                                                                                       
        "endpoint": "/preset",                                                                                                                                                                                                              
        "method": "PATCH",                                                                                                                                                                                                                  
        "payload": {                                                                                                                                                                                                                        
            "deviceSetIndex": 2,                                                                                                                                                                                                            
            "preset": {                                                                                                                                                                                                                     
                "groupName": "QO100",                                                                                                                                                                                                       
                "centerFrequency": 489885000,                                                                                                                                                                                               
                "type": "R",                                                                                                                                                                                                                
                "name": "Narrowband slave high"                                                                                                                                                                                             
            }                                                                                                                                                                                                                               
        },                                                                                                                                                                                                                                  
        "msg": "load preset on Rx 2"                                                                                                                                                                                                        
    },                                                                                                                                                                                                                                      
    {                                                                                                                                                                                                                                       
        "endpoint": "/deviceset/0/device",                                                                                                                                                                                                  
        "method": "PUT",                                                                                                                                                                                                                    
        "payload": {                                                                                                                                                                                                                        
            "hwType": "RTLSDR"                                                                                                                                                                                                              
        },                                                                                                                                                                                                                                  
        "msg": "setup RTLSDR on Rx 0"                                                                                                                                                                                                       
    },                                                                                                                                                                                                                                      
    {                                                                                                                                                                                                                                       
        "endpoint": "/preset",                                                                                                                                                                                                              
        "method": "PATCH",                                                                                                                                                                                                                  
        "payload": {                                                                                                                                                                                                                        
            "deviceSetIndex": 0,                                                                                                                                                                                                            
            "preset": {                                                                                                                                                                                                                     
                "groupName": "QO100",                                                                                                                                                                                                       
                "centerFrequency": 489745000,                                                                                                                                                                                               
                "type": "R",                                                                                                                                                                                                                
                "name": "Narrowband master 25M"                                                                                                                                                                                             
            }                                                                                                                                                                                                                               
        },                                                                                                                                                                                                                                  
        "msg": "load preset on Rx 0"                                                                                                                                                                                                        
    },                                                                                                                                                                                                                                      
    {                                                                                                                                                                                                                                       
        "endpoint": "/deviceset/1/device/run",                                                                                                                                                                                              
        "method": "POST",                                                                                                                                                                                                                   
        "msg": "Start device on deviceset R1"                                                                                                                                                                                               
    },                                                                                                                                                                                                                                      
    {                                                                                                                                                                                                                                       
        "endpoint": "/deviceset/2/device/run",                                                                                                                                                                                              
        "method": "POST",                                                                                                                                                                                                                   
        "msg": "Start device on deviceset R2"                                                                                                                                                                                               
    },                                                                                                                                                                                                                                      
    {                                                                                                                                                                                                                                       
        "endpoint": "/deviceset/0/device/run",                                                                                                                                                                                              
        "method": "POST",                                                                                                                                                                                                                   
        "msg": "Start device on deviceset R0"                                                                                                                                                                                               
    },                                                                                                                                                                                                                                      
    {                                                                                                                                                                                                                                       
        "endpoint": "/deviceset/0/channel/0/settings",                                                                                                                                                                                      
        "method": "PATCH",                                                                                                                                                                                                                  
        "payload": {                                                                                                                                                                                                                        
            "channelType": "LocalSink",                                                                                                                                                                                                     
            "direction": 0,                                                                                                                                                                                                                 
            "LocalSinkSettings": {                                                                                                                                                                                                          
                "play": 1                                                                                                                                                                                                                   
            }                                                                                                                                                                                                                               
        },                                                                                                                                                                                                                                  
        "msg": "Start local sink 0 on deviceset R0"                                                                                                                                                                                         
    },                                                                                                                                                                                                                                      
    {                                                                                                                                                                                                                                       
        "endpoint": "/deviceset/0/channel/1/settings",                                                                                                                                                                                      
        "method": "PATCH",                                                                                                                                                                                                                  
        "payload": {                                                                                                                                                                                                                        
            "channelType": "LocalSink",                                                                                                                                                                                                     
            "direction": 0,                                                                                                                                                                                                                 
            "LocalSinkSettings": {                                                                                                                                                                                                          
                "play": 1                                                                                                                                                                                                                   
            }                                                                                                                                                                                                                               
        },                                                                                                                                                                                                                                  
        "msg": "Start local sink 1 on deviceset R0"                                                                                                                                                                                         
    }                                                                                                                                                                                                                                       
]                                                                            

This is a bit convoluted but this is feasible.

So I think I will not reinvent the wheel here more re-implementing the config.py functionality inside the main program. Also the JSON file fornat is a better way to store such configurations because it can be edited by hand and also it can be reused for a headless instance or be transferred between computers.

Lastly having a config fired up at startup time should only be an option and be done after the initial setup. It would be very costly to change the default as it is today and also 90% if not more of the users run the program with a single receiver. Note that this was originally done just so that the GUI displays something and more conveniently the last receiver that was used. The server flavor starts empty.

@srcejon
Copy link
Collaborator Author

srcejon commented Nov 20, 2021

Yep, sounds good.

Being able to create a config in the GUI and then load it in the server would make it much easier to set up the server.

@f4exb f4exb self-assigned this Nov 22, 2021
@f4exb f4exb changed the title Preset enhancements Preset enhancements -configuration save/restore framework Dec 2, 2021
@f4exb f4exb changed the title Preset enhancements -configuration save/restore framework Preset enhancements - configuration save/restore framework Dec 8, 2021
f4exb added a commit that referenced this issue Jan 9, 2022
@f4exb f4exb modified the milestone: v6.18.1 Jan 23, 2022
@f4exb
Copy link
Owner

f4exb commented Feb 17, 2022

With the projected revamping of the UI the very nature of presets is going to change so I'd better postpone this to the new UI implementation or make it part of the project.

@f4exb f4exb added v7 Scheduled for version 7 and removed enhancement labels Feb 20, 2022
@f4exb f4exb moved this from To do to In progress in SDRangel v7 UI revamping Apr 7, 2022
@f4exb
Copy link
Owner

f4exb commented Apr 7, 2022

While the older presets (device sets and features) will be kept for compatibility a new class of "preset" called "configuration" will be able to save/restore the complete instance and its UI configuration i.e. workspaces, device sets, features ttheir UI widgets with their respective arrangements (workspace and geometry). Similarly to what was in place for presets a "working configuration" is kept to save the current arrangements across program start/stop cycles.

@f4exb f4exb moved this from In progress to Done in SDRangel v7 UI revamping Apr 13, 2022
@f4exb f4exb added this to the v7.0.0-alpha.1 milestone Apr 25, 2022
@f4exb
Copy link
Owner

f4exb commented Apr 25, 2022

done in v7.0.0-alpha.1

@f4exb f4exb closed this as completed Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement v7 Scheduled for version 7
Development

No branches or pull requests

2 participants