New Slice creation - slice.Index set to -1

  • 1
  • Question
  • Updated 5 years ago
Hi all,

I can create new slice with the following example:

           double freq = 14.123d;
            string RXA = "ANT1";
            string Mode = "CW";

             Slice Slice1 = new Slice(radio);

            Slice1 = radio.CreateSlice(freq, RXA, Mode);
            Slice1.RequestSliceFromRadio();

The slice is successfully created in the readio, but...

- Slice1.Index shows  -1
- The actual slice frequency and mode are different from requested.

The slice Index cannot be changed, it is read-only, so I cannot place newly created slice in my existing slice array.

What am I doing wrong?

Paul RN3A


Photo of Paul RN3A

Paul RN3A

  • 56 Posts
  • 6 Reply Likes

Posted 5 years ago

  • 1
Photo of Eric - KE5DTO

Eric - KE5DTO, Official Rep

  • 840 Posts
  • 300 Reply Likes
When are you checking the slice index?  It is going to be -1 initially until the radio receives the slice create command (sent via the RequestSliceFromRadio function) and sends back a reply.  Have you tried waiting before checking index?  The best way to do this is probably to subscribe to the PropertyChanged event for the slice before calling RequestSliceFromRadio and then look for a change to RadioAck to true.  When this happens, look at index and I bet it will be valid.

Obviously there are times when you request a slice and one won't be available.  Like if you already have 8 slices on a 6700 (4 slices on a 6500).  I'm sure this isn't the case here, but figured I would put it in the answer for completeness when others see this.
Photo of Paul RN3A

Paul RN3A

  • 56 Posts
  • 6 Reply Likes
Thank you Eric.

I still must be doing something wrong. Can you please explain.

When I create and request a new slice, it goes through Slice Add call, when it first appears, and then it several times calls slice Property change, and every time it does different things. The slice number appears to be correct at this point. But sometimes slice does not show up on the SSDR screen. And it obviously requires some time for the process to complete. Simply adding timer does not seem to be a good idea. There should be a reliable pattern. Which properties do I need to monitor to make a reliable decison that slice has been created and I can start changing it inside my program? And why new slice sometimes do not appear on SSDR screen? 
Photo of Paul RN3A

Paul RN3A

  • 56 Posts
  • 6 Reply Likes
Thank you, Eric.

There are 8 slices possible in the radio (4 for 6500). How many slice property change event subscriptions need? One fits all, or equal to number of open slices?

Photo of Eric - KE5DTO

Eric - KE5DTO, Official Rep

  • 840 Posts
  • 300 Reply Likes
This is really up to the application developer.  Some people might want to do different things for different Slices.  For example, the CAT code uses 2 different handlers I think as it handles things differently for VFOA and VFOB.  In SmartSDR-Win, we end up needing access to the changing properties at several different levels, so you'll find PropertyChanged event handlers in several places in our code.
Photo of Paul RN3A

Paul RN3A

  • 56 Posts
  • 6 Reply Likes
Thank you, Eric.

I have palyed with it, and I have some findings.

1. When I create new slice, sometimes it does not appear on SSDR pan screen. However, it is there, because I can read it's frequency, mode, etc. Is it a bug?

2. For example, I create a new slice with the following command:

 Slice1 = radio.CreateSlice(14.080d, "ANT1", "DIGL");
 bool b = Slice1.RequestSliceFromRadio();

The slice which already exist in the current pan is set to CW, 14,023. The new slice seems to not accept frequency and mode settings. The slice is created, but on 14.000 and CW. New slice seems to follow the the nearest slice mode, antenna and other settings, with the exception of frequency. Is it a bug?

3. For example, my existing slice is set to 14.200, and Panadapter zoom level is set so,  that 14.000 frequency mark is off the screen. When I create new slice, and as in #2 it defaults to 14.000, the new slice never appears on the Panadapter screen. The slice is still created, I can read it's properties. But if I change Pan zoom level in such a way that 14.000 is visible on the screen, in 90% of the cases slice appears there. The same behaviour exist on all bands, and depends on pan zoom level. Is it a bug?

Photo of Eric - KE5DTO

Eric - KE5DTO, Official Rep

  • 840 Posts
  • 300 Reply Likes
I'm not sure about #1.  I will have to double check our code to find out what the expected behavior is when you add a Slice outside of SmartSDR-Win.

I tested #2 and this looks like a bug.  Thanks for reporting this.

If I understand what you are doing in #3, I think this is the same as #1.  I will get back to you on this.
Photo of Eric - KE5DTO

Eric - KE5DTO, Official Rep

  • 840 Posts
  • 300 Reply Likes
#2 is definitely a bug and has been entered as DE1986.  Thanks for reporting this.