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 refer to the product documentation or check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

v 3.0.19 Why doesn ́t API.RadioList(0).RFPower show any output power any more?

Roger Sjölin
Roger Sjölin Member
edited June 2019 in SmartSDR for Windows
v 3.0.19 I have a visual basic app where I want to display the RF power, frequency used and other parameters.. All works fine after update but The RF power shows 0. Why doesn ́t API.RadioList(0).RFPower show any output power any more?


Answers

  • Mark_W3II
    Mark_W3II Member ✭✭✭
    edited April 2019
    Make sure you bind your non-GUI FlexAPI client to a GUIClient. 
    See BoundClientID property.
    Note there is minor issue where you need to issue a "sub tx all" after the bind to get the TX settings.
    I modified the radio's method BindGUIClient(string client_id) by adding this additional command to the end.
     
  • Roger Sjölin
    Roger Sjölin Member
    edited April 2019
    My skill in programming is limited so please give me some more information how to do this in visual basic or visual c.

    My app works with version 3.0.19 so it give me frequency, mode, ant and s-meter information. I can also create and remove slices without any problem with my present code.

  • Roger Sjölin
    Roger Sjölin Member
    edited April 2019
    Sorry but the documentation gives me no hint how to solve this...
  • Mark_W3II
    Mark_W3II Member ✭✭✭
    edited April 2019
    In V3 each band has a TX Power setting. As a non-GUI client these settings are not available until you bind to a SSDR GUI client.  Radio object has GuiClients property, select the GUI client you want to bind to. Use GUIClient's ClientID property. Radio object's BoundClientID is set to GUIClient's ClientID.

    Note: error handling has been removed for clarity.

    radio.BoundClientID = radio.GuiClients[0].ClientID;

    The binding action in V3.0.19 does not automatically send TX properties status so you will need to issue a "sub tx all" command to get all band's tx properties. 

    I do this by modifying the BindGUIClient method in the FlexAPI Radio.cs.

     public void BindGUIClient(string client_id)
            {
              //...
                SendCommand("client bind client_id=" + client_id);
                SendCommand("sub tx all");
            }


    There is a new event called TxBandSettingsAdded and TxBandSettingsRemoved which can be used to get all TX settings for all bands. You can use the Radio object to get the TX band settings for the current band.

    Good luck.

  • Roger Sjölin
    Roger Sjölin Member
    edited June 2019
    Ok
    I have modified the radio.cs with the command ("sub tx all");
    Will this modification be a a part of future API update?

    In my code I have this
    Public Sub Init_ssdr()
            AddHandler This_radio.SliceAdded, AddressOf Me.This_radio_sliceadded
            AddHandler This_radio.SliceRemoved, AddressOf Me.This_radio_sliceremoved
            AddHandler This_radio.TxBandSettingsAdded, AddressOf Me.This_radio_txbandsettingsadded

            This_radio.BindGUIClient(API.RadioList(0).GUIClientID)

        End Sub

    Public Sub This_radio_txbandsettingsadded(txbandsettings As TxBandSettings) Handles This_radio.TxBandSettingsAdded

            Me.TextBox7.Text = txbandsettings.PowerLevel.ToString
        End Sub

    I am confused about this
    -if I have API.IsGUI=false this last sub is not used but if I have API.ISGui=true this last sub is called???  But I got a control error.and the value is nothing

    What do I do wrong?





  • Mark_W3II
    Mark_W3II Member ✭✭✭
    edited April 2019

    This line 
            This_radio.BindGUIClient(API.RadioList(0).GUIClientID)
    should be
            This_radio.BoundClientID = This_radio.GuiClients(0).ClientID
    Then you can get current band power 
           This_radio.RFPower
    Max  band power setting
           This_radio.MaxPowerLevel

    Also you should be able to iterate through all band settings since you are collecting them.

  • Roger Sjölin
    Roger Sjölin Member
    edited April 2019
    Now I have

    API.isGui=true

     Public Sub Init_ssdr()
            AddHandler This_radio.SliceAdded, AddressOf Me.This_radio_sliceadded
            AddHandler This_radio.SliceRemoved, AddressOf Me.This_radio_sliceremoved
            AddHandler This_radio.TxBandSettingsAdded, AddressOf Me.This_radio_txbandsettingsadded
            This_radio.BoundClientID = This_radio.GuiClients(0).ClientID
        End Sub

        Public Sub This_radio_txbandsettingsadded(txbandsettings As TxBandSettings) Handles This_radio.TxBandSettingsAdded
            Me.TextBox7.Text = This_radio.RFPower
        End Sub

    and it gives nothing in the textbox

    If I look at txbandsettings it says BandID=0 and Bandname=160 but I am using 80m
    so it seems not to collect the txsettings



  • Mark_W3II
    Mark_W3II Member ✭✭✭
    edited April 2019
    Most likely you have not waited for client objects to populate. 
    I am traveling so the best next step is to email your code and I will look at this week. w3ii AT arrl.net
  • Roger Sjölin
    Roger Sjölin Member
    edited June 2019
    Thanks Mark for Your help. It now works with the limitation You indicated.
    I think I will return to control the radio through the ordinary CAT protocol.

  • Gary L. Robinson
    Gary L. Robinson Member ✭✭
    edited June 2019
    Thanks Mark!!  I ran into the same problem with the 2.51 version upgrade with a client of mine I use - and your fix worked fine here!

    ---Gary WB8ROL

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.