Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
If you are having a problem, please check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

Can one lock/unlock a slice via the API?

John G3WGV
John G3WGV Member ✭✭
edited November 2018 in SmartSDR API
Is it possible to set the slice lock on/off via the API?. I've tried

Cxx|slice set 0 lock=1 
and
Cxx|slice set 0 lock_on=1

to no avail.

TIA,

73, John, G3WGV

Answers

  • Walt - KZ1F
    Walt - KZ1F Member ✭✭
    edited November 2016
    Ah, great question John. (std disclaimer, not a Flex employee but I just discovered this myself).
    No, you can set the lock on, as you did and you'll see the response back, as I recall. I suspect what that does is set a persistence that, upon re-entering SSDRfW or XPSSDR, the slice will be recreated with the lock on, as in slc.getLock() == true (vs false).

    What I did is for every slice specific user action, check the lock state first and if set, bypass whatever you were about to do. e.g.

    onVolumeChanged() {

        if (slice.getLock() == false) {
           do stuff
        }

    It, on the surface, seems logical that would have been better if the radio did something like ignore requests for changes to locked slices but that could not catch everything. For instance, changing the volume, which is an external to the radio action so either by human action or programmatic control the volume setting is changed but the radio's volume isn't. So, there is a logic that says the cleanest approach is block the action at the boundaries, not at the radio.

    To force the radio to do it implies a strict interface that from the cause /effect

    external action -> notify radio only

    radio status change -> update control status

    Personally, that's how I did it, however not all external requests get a direct response from the radio. I am not sure why that line was drawn where it was though. But, if the radio does not acknowledge the command, the user/program requesting it has to assume it worked (no other choice). Given that not every command sent to the radio gets responded to the only logical thing to do is put the gate at the boundary.
  • John G3WGV
    John G3WGV Member ✭✭
    edited November 2018
    Thanks for the quick reply Walt. In the meantime I delved into the .net stuff and found, in Slice.cs that it sends

    Cxx|slice lock 0
    and
    Cxx|slice unlock 0

    So I coded that into my Arduino controller, et voila! it worked.
  • Walt - KZ1F
    Walt - KZ1F Member ✭✭
    edited November 2016
    It worked as in set the locked state to true (yes it does that) or
    worked as in blocked any action the user or a program could take on the slice?
  • John G3WGV
    John G3WGV Member ✭✭
    edited December 2016
    Good point! I just checked that and confirm that it only locks the frequency. I can still alter any other parameter on my controller and on Win/Maestro SSDR.

    Edit: Re-reading your earlier post, I realise now that you were thinking that I wanted to completely lock the slice. I was after just locking the VFO, so the fix I found does the trick. I realise now that I might not have explained the requirement as precisely as I might have.

    To completely lock the Slice (not sure why one would want to do this) I think your method would be the right approach.
  • Walt - KZ1F
    Walt - KZ1F Member ✭✭
    edited November 2016
    Huh? I'll have to check that as I am pretty sure I could still change frequency. Wait, did it just lock the direct update of the frequency text box or does it prevent you from dragging the slice? I believe I just dragged the slice. But yes, it does, indeed, get set by the radio.
  • Walt - KZ1F
    Walt - KZ1F Member ✭✭
    edited November 2016
    You are correct, a direct update to the freq text is prevented. Dragging the slice is NOT prevented, at least for me.

    John, would you verify that?
  • John G3WGV
    John G3WGV Member ✭✭
    edited December 2016
    I just checked on Win SSDR and when the slice is locked (blue padlock) I can't move it by dragging or by any other means. I'll check the Maestro in a while but I think it will be the same. I'm using version 1.8.4.
  • Walt - KZ1F
    Walt - KZ1F Member ✭✭
    edited November 2016
    That may be a bug that was fixed. The radio here is on 1.6.21 and I use XPSSDR w/XPSLib as the facsimile to flexlib. I can stop the drag by the method I suggested. From the software engineering perspective, stopping 'bad data' from entering the system is better than trusting the code deep inside the system is foolproof. Just for S&Gs, can you mute volume and / or adjust WNB, filters etc? To be sure, they may well have covered what lock means in the manual. Manual? What manual? We don't need no stick'n manual. ;-) Now I have to check before I hit submit. OK, way too hard as multiple sections of the manual talk about slice. I saw no specific place where locking is specifically mentioned...not that one doesn't exist.
  • John G3WGV
    John G3WGV Member ✭✭
    edited December 2016
    Indeed. As far as I can see everything else can be controlled when the lock is active. Even mode.

    Oh! Just found a putative bug. In the RX side panel I can overtype a new frequency when the slice is locked and the panadapter centres on the new frequency... but the slice frequency doesn't move. I can just imagine how that managed to get missed :)

    I'm using Enzo, IW7DMH's excellent Arduino library, now much modified, as the basis of my Arduino controller. It works very well and it's been an interesting exercise learning how it all hangs together, especially as C is not my "first language".
  • Walt - KZ1F
    Walt - KZ1F Member ✭✭
    edited November 2016
    Just to clarify what you mean by everything else can be controlled when lock is active, do you mean everything else is locked or everything else can be manipulated with lock is set?
  • John G3WGV
    John G3WGV Member ✭✭
    edited December 2016
    The latter.
  • Walt - KZ1F
    Walt - KZ1F Member ✭✭
    edited November 2016
    Thanks for checking John.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.