Working With Multiple Slices

  • 2
  • Question
  • Updated 5 years ago
Using FlexLib in the SmartSDR API I am experimenting with a small program as a learning exercise.  Was doing well until I started trying to control multiple slices.

If I start my app with one slice already up in SSDR, all is well, and I get displayed frequency, mode, etc.  If I add a second slice via SSDR all is still well, and my app simply switches to the new slice and shows its properties.  Changing active slices via SSDR works and the app tracks the changes. Frequency and mode changes show up OK as well.

But, I am stumped at the next step I want to take - display all current slices' properties, change those properties for each slices.  So far, I have been trying to use the FlexLib Radio.cs Radio Class' ObservableCollection<Slice> SliceList member.  Thought I could get the slice data for each slice in the list, set up local slice members, etc.  This has me going in circles (not the least part is this being the first time dealing with ObservableObject and collections of same).

Anyone already try this?  Am I making it too hard and a more obvious, direct, easier approach is
available?  Thanks for any help!

73, Tom
K1FR
Photo of K1FR

K1FR

  • 111 Posts
  • 9 Reply Likes

Posted 5 years ago

  • 2
Photo of Mark - W3II

Mark - W3II

  • 231 Posts
  • 50 Reply Likes
I am happy to help out. The Flex API component is a multi-threaded interface to the Radio. Based upon this fact you must deal with objects coming and going and events arriving on background threads. I have many questions like: Are you writing a command line, Forms or WPF application? Are you handling updates to your UI on the primary thread only? etc. So as opposed to a long back and forth exchange please send me your contact information at AA3RK (at) ARRL (dot) NET. Once we exchange ideas you can post back to this thread your resolution and observations if you like.

73,
Mark AA3RK
Photo of James Whiteway

James Whiteway

  • 1059 Posts
  • 302 Reply Likes
Having any luck Tom?
jamesWD5GWY
Photo of K1FR

K1FR

  • 111 Posts
  • 9 Reply Likes
Hi James.  Good to hear from you again.  Well, I had a most helpful email from AA3RK offering to help. Unfortunately, I was tied up at the time and now have a really full schedule for the next couple of weeks.  Also, realized from his email that I have a lot of basic learning to do about threading before I can get very far.  So, hope to get some time here and there to study up and hope that Mark has time to help once I have a better foundation to work from.

How is the API treating you?

73, Tom
K1FR
Photo of James Whiteway

James Whiteway

  • 1059 Posts
  • 302 Reply Likes
I haven't had much time to devote to working with the API lately either. But, I too have run into some issues with threading. Funny though, it happened with the Visual Basic version of the test app I have been learning with instead of the C# version.
 I am trying to create the same app in both languages to see which  language is easier to work with. Of course, I am partial to Visual Basic, but, I want to try and become proficient in C# if I can. So, that's the reason for doing the same thing in both languages. While some say C# is just a variation of Visual Basic, I tend to disagree. C# is not near as verbose as Visual Basic.
  I can send commands to the radio and see the results in SSDR from both versions, but, for some reason, the VB version will not do anything unless SSDR is already running. Whereas the C# version will get the basic parameters of the radio without SSDR running. (just cannot send commands or read things like VFO freq etc since the radio has not actually been initialized) I need to learn how to initialize the radio and load last settings etc and try and run the radio independent of SSDR. That would be fun and could lead to a simple program to run the radio remotely from a tablet without the overhead of a panafall display. Or at least that seems quite possible.
   I would be interested in seeing how you are updating things when you change freq in a slice from your app. Right now, I have it where I can manually enter a given frequency and it will change in SSDR and be reflected in a Label's Text property. But, that is because I cheat a bit and update it from the input from the Textbox where I enter the new Frequency and not actually from data returned from the radio itself.
(although the radio does change freq)
  So much fun and so little time to play. Hope you are doing well too.
james
WD5GWY
.   
Photo of K1FR

K1FR

  • 111 Posts
  • 9 Reply Likes
James:  Thought I had your email somewhere but cannot find it.  Please shoot an email with your email address to me at k1fr@arrl.net and I will send you a copy of my code.  Hope that might help.  Don't look too closely though - while it works, it is not pretty!  

73, Tom
K1FR
Photo of James Whiteway

James Whiteway

  • 1059 Posts
  • 302 Reply Likes
Email sent Tom. Don't worry about me looking too close at your code. I'm certain that it's much better than mine!!! (spaghetti code at it's finest!! :-)  
james
WD5GWY
 
Photo of K1FR

K1FR

  • 111 Posts
  • 9 Reply Likes
James:  Let me know if you had any problem opening and running the samples sent to your email.  73, Tom K1FR
Photo of James Whiteway

James Whiteway

  • 1059 Posts
  • 302 Reply Likes
Thanks Tom. Checked email a moment ago. But had not shown up yet. Probably earthlink just being slow! I'm on the road(again) but, I will be home Friday. I will let you know how much I'm able to mess things up then!
Thanks for your help.
james
WD5GWY
Photo of James Whiteway

James Whiteway

  • 1059 Posts
  • 302 Reply Likes
Hello again Tom, I have yet to receive your email. I checked my spam folder on earthlink and it's not there. So, I'm not sure what happened. If you get the time, try sending again to:
jjames700@earthlink.net

thanks,
james
WD5GWY
Photo of K1FR

K1FR

  • 111 Posts
  • 9 Reply Likes
James:  I got your email today and have resent my msg from Feb 8 with the sample attached.  Also sent a freshly zipped version and from another of my email accounts.  Hopefully one of them will get through!!  73, Tom K1FR
Photo of James Whiteway

James Whiteway

  • 1059 Posts
  • 302 Reply Likes
Thanks Tom. I haven't seen the email as of yet. I checked the Spam folder on my Earthlink account and it is not there. Sometimes Earthlink decides for itself that incoming email is spam and dumps things there that shouldn't be. It's odd that a similar issue occurred when I sent you some code  to your ARRL account. That is why I looked up your other email address and sent it that way. I figured that maybe the ARRL didn't allow attachments with their email accounts. Or their spam filters stripped it out.
Thanks again,
james
WD5GWY
 
Photo of K1FR

K1FR

  • 111 Posts
  • 9 Reply Likes
James:  Wow!  I just sent you another email (without atch) from my work email.  Please let me know if that makes it.  Tom
Photo of James Whiteway

James Whiteway

  • 1059 Posts
  • 302 Reply Likes
We'll see! I just sent you and email. It seems.....(blush) that the Spam Blocker settings on my Earthlink Webmail account had the Verizon domain blocked. Probably because I had received spam or viruses in the past from that domain. I went thru the folder settings and Verizon was blocked. So, I removed it. Not sure how fast it will take effect.
Thanks and sorry for all the problems. Certainly not on your end!
james
WD5GWY


Photo of K1FR

K1FR

  • 111 Posts
  • 9 Reply Likes
James:  :)  Ain't computers fun??  So, I just sent you a link to the file on my Google Drive.  This should go to you as a .gmail.com.  Let me know.  73, Tom K1FR
Photo of James Whiteway

James Whiteway

  • 1059 Posts
  • 302 Reply Likes
Finally got it Tom!! And it was in my Spam Folder. I don't know what criteria Earthlink uses for their spam filters, but, that's where it put it. I tried to run it in VS2010 and it wouldn't (with Windows Vista). So, I switched to my Win7 hard drive and VS 2013 Community Edition and it loaded and ran just great! Nothing wrong with your code at all as far as I can see. In fact, it helped me see how to go about updated a textbox or label when changing frequency correctly. As it was, I would manually enter a new frequency and in SmartSDR the frequency would change, but, the textbox I created to show the current Slice frequency did not update. So, I cheated a bit and just had the update freq textbox update from the manually entered frequency. (after the Tune button on my form was clicked) A real kludge and not what needed to happen as I was not getting the feedback from the radio itself to my app.
Thanks for sharing.
james
WD5GWY
Photo of K1FR

K1FR

  • 111 Posts
  • 9 Reply Likes
James:  Glad it worked!  I am hoping to get back to tinkering with the API soon.  Problem is I will probably have to go and relearn all I thought I knew two weeks ago!  :)

73, Tom
K1FR
Photo of James Whiteway

James Whiteway

  • 1059 Posts
  • 302 Reply Likes
It seems I have to do some relearning every weekend when I get back from being out on the road! But, that makes for some fun. Today, I'm stuck at home. All the roads are iced over and the guy that owns my truck says no go! So, I get to play radio and attempt to program for an additional day! Hope my brain cells can take the extra load!  :-)
james
WD5GWY
Photo of Jay / NO5J

Jay / NO5J

  • 1674 Posts
  • 263 Reply Likes
A day is a much better thing to waste, than a mind is. Code up something I can debug and learn from. Leave the bugs in. It's more educational. If it has to be rewritten from scratch, I'll include some of your blank space and give you credit and thanks!
Jay - NO5J