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

  • 1
  • Question
  • Updated 2 months ago
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?


Photo of Roger Sjölin

Roger Sjölin

  • 9 Posts
  • 1 Reply Like

Posted 4 months ago

  • 1
Photo of Mark - W3II

Mark - W3II

  • 210 Posts
  • 44 Reply Likes
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.
 
(Edited)
Photo of Roger Sjölin

Roger Sjölin

  • 9 Posts
  • 1 Reply Like
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.

Photo of Roger Sjölin

Roger Sjölin

  • 9 Posts
  • 1 Reply Like
Sorry but the documentation gives me no hint how to solve this...
Photo of Mark - W3II

Mark - W3II

  • 210 Posts
  • 44 Reply Likes
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.

(Edited)
Photo of Roger Sjölin

Roger Sjölin

  • 9 Posts
  • 1 Reply Like
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?





Photo of Mark - W3II

Mark - W3II

  • 209 Posts
  • 44 Reply Likes
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.

Photo of Roger Sjölin

Roger Sjölin

  • 9 Posts
  • 1 Reply Like
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



Photo of Mark - W3II

Mark - W3II

  • 209 Posts
  • 44 Reply Likes
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
Photo of Roger Sjölin

Roger Sjölin

  • 9 Posts
  • 1 Reply Like
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.

Photo of Gary L. Robinson

Gary L. Robinson

  • 254 Posts
  • 56 Reply Likes
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