VE3NEA/OmniRig

Not work at frequency higher then 2200 MHz

Closed this issue · 2 comments

Alex hello!
Testing with soft SDR Console v3.0.23 and Power SDR mrx PS v3.4.9 on QO-100 satelite (10 GHz downlink and 2.4 GHz uplink).
SDR Console using OmniRig like high level layer in CAT. Not work with freq more 2200 MHz.
I suppose 32 bit variables problem. May you check/fix that?
73! Vlad RX3QFM

Hi Vlad,

The frequencies in the OmniRig interface are represented with 32-bit integers and thus cannot exceed 2^31 (about 2 GHz). However, this cannot be fixed in the current architecture because the interfaces of a COM object are binary contracts, if we change some property or function argument from Int32 to Int64, the programs that use OmniRig may stop working. The right way to solve this problem is to declare a new interface on the same object and make it work the way you need, without changing the existing interfaces. Below is a copy of my email to the developer who is working on a clone of OmniRig called MultiRig, in this email I explain how to make improvements without breaking compatibility.

After some research, I discovered the following. To make MultiRig compatible with OmniRig V1, you have to keep its existing interfaces intact, as any change to them breaks compatibility. Instead, you have to define a new interface, let us name it IMultiRig, and add all new functionality to that interface. If you do so, then all existing programs that use OmniRig will use MultiRig and will not even know that it is not OmniRig V1. Here is a sample code that creates an OmniRig object and uses it, this code will work for both OmniRig and MultiRig, whatever is installed on the system:

var
  OmniRig: IOmniRigX;
begin
  OmniRig := CreateComObject(CLASS_OmniRigX) as IOmniRigX;
  OmniRig.Rig1.FreqA := 3500000;

The programs that want to make use of the new features of MultiRig will create the object slightly differently:

var
  OmniRig: IOmniRigX;
  MultiRig: IMultiRig;
begin
  OmniRig := CreateComObject(CLASS_OmniRigX) as IOmniRigX;
  MultiRig := OmniRig as IMultiRig;

  MultiRig.Rig4.FreqA := 3500000;

Now they have references to the IOmniRigX and IMultiRig interfaces and can make use of both old and new functions and properties. In the example above, the code uses the property Rig4 defined in IMultiRig, something that does not exist in IOmniRigX.

The IMultiRig interface should define only the functions and properties that are missing or different from IOmniRigX. Perhaps it could be defined as follows:

IMultiRig = interface(IDispatch)
    function Get_Rig1: IRigM; safecall;
    function Get_Rig2: IRigM; safecall;
    function Get_Rig3: IRigM; safecall;
    function Get_Rig4: IRigM; safecall;
    property Rig1: IRigM read Get_Rig1;
    property Rig2: IRigM read Get_Rig2;
    property Rig3: IRigM read Get_Rig2;
    property Rig4: IRigM read Get_Rig2;
  end;

Note that the Rig1..Rig4 properties are not of type IRigX, they are IRigM, a new interface that contains all of your improvements. For example, you could make all frequencies 64-bit values so that your engine works with VHF and UHF radios:

IRigM = interface(IDispatch)
  procedure Set_FreqA(Value: LargeUInt); safecall;
  ...
end;

You could also define your own enum type for the mode and make MultiRig support RTTY, PSK and DATA modes instead of just DIG. Many other improvements are possible if you make them in the new interface.

Alex thank you very much for info!