SmartSDR v3.8.19 and the SmartSDR v3.8.19 Release Notes | SmartSDR v2.12.1 and the SmartSDR v2.12.1 Release Notes
SmartSDR v1.12.1 and the SmartSDR v1.12.1 Release Notes
Power Genius XL Utility v3.8.8 and the Power Genius XL Release Notes v3.8.8
Tuner Genius XL Utility v1.2.11 and the Tuner Genius XL Release Notes v1.2.11
Antenna Genius Utility v4.1.8
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.
Reading Meter events
Using the Object Browser in Visual Studio 2010, I can see in Flexlib, the MeterDataReadyEventHandler, which I believe is what I need to work with in order to read things like the S meter etc. BUT, I cannot seem to grasp how to go about using that event to provide input to something like the Progress Bar, or even a Label with numbers that change corresponding to changes in Signal Strength. I am slowly relearning C#, and I'm sure that is a big part of the problem.
I have read all the posts here on this subforum and I have seen one that said I needed to "subscribe" to an event in order to use it. Do I need to read the actual packets and separate them according to Header info ? Or is there a Method in Flexlib that gets around that?
A bit of sample code on handling streaming data might be helpful. ( I know, I've been using a lot of others examples already and I'm very grateful for it)
I knew none of this would be simple, and I like a challenge, but, getting my head wrapped about using C# instead of VB.NET again, is tough for this old brain of mine!!! :-)
I hope someone here takes pity on an old guy and offers a few crumbs!!
Thanks for reading this.
james
WD5GWY
Answers
-
You first need to specify a method in initialization which will be called in response to the event. It is called an “event handler”. This is what is meant by subscribing to the event.Then in the class, you define the event handler of the proper type. If you look at the source for my small program called "Flexit", you will see in the initialization area
API.RadioAdded += API_RadioAdded; //This is subscribing to the event.
Then in the region ON RADIO ADDED OR REMOVED,
private void API_RadioAdded(Radio radio)
{
…….
} // This is the definition of the event handler.
Let me know if you need “Flexit”.
Paul
0 -
Thanks Paul, you sent me Flexit along with it's source code via email a while back. I couldn't open it in Visual Studio 2010 and so I could not see what you have done. BUT, I am downloading VS 2012 Express Edition and should be able to solve that one. Or, I could start Windows 7 and use VS 2013 Community Edition that I have installed there. Either way, thanks for the info and the pointers.
Usually, I can open almost any project with Wordpad and at least see the code, if I cannot open it in VS 2010. For some reason that didn't work with your project. I can only guess that VS 2012 Express saves the files in a different format that Wordpad cannot handle.
I'll let you know how things go.
james
WD5GWY
0 -
Paul, I downloaded VS 2012 Express and it would not install in Vista. THEN, I checked the system requirements!! Vista is not supported. So, I switched to Win7 and looked at your code from VS 2013 Community Edition. It did the same thing that VS 2010 did, it shows the project as being incomplete. No form data displayed nor any code. Might be that the zip file you originally sent did not contain the completed project, only the exe and the references it needed.
(although it does show the basic folder structure and file names, eg, form1.cs etc. Just no code there!)
Thanks for your help.
james
WD5GWY
0 -
James, I'm not sure what you did, but the folder I sent you for the VSE Flexit project is titled FlexitVSProj.zip. The other folder just contains the executable. You should extract the FlexitVSProj.zip folder to a folder of your choice. Then you need to go down in the subfolders to find a file called Flexit.csproj. Double click on that one to open the project (assuming you have installed VSE 2012.
That should do it for you.
0 -
I think not having VS 2012 installed is the problem Paul. But, I finally got around not being able to read the source code by opening it in Word. I will have to re-download VS 2012 and install it on my Win7 drive. I would have thought that VS 2013 Community Edition would be able to open the project and if there were any incompatibilities, offer to convert the project to that edition.
I'm betting once I do that, things should click.
james
WD5GWY
0 -
You may be able to IMPORT the VS 2012 project into VS 2013, but I don't know. I had to convert a 2010 project into 2012 by importing.
0 -
That's exactly what I just did and now it works and I can see your code! Thanks for putting up with all my questions Paul. I really do appreciate it.
james
WD5GWY
0 -
Hoping to keep this subject alive a bit longer. I am still not sure how, using Flexlib, to read an ever changing event like the S meter in real time. And reflect that change in a Label's text property and have it update correctly. I can read static properties like Nam, Call, etc. ( which is obvious as Paul and others here posted example code to do that) I can even read the current VFO / SLICE freq. but, if it changes, I have to refresh mt test program to reflect the change. I'm on the road right now, so no computer here to check, do Labels in C# have a Property Changed Event that could be used in real time to keep a running update for something like the s meter or vfo changing? I would feel beyond dumb if it were as simple as that! :-)0
-
I just love making myself look **** on a public forum! Google Search from my phone works! MSDN is online and the answer to part of my question was there. Labels do have a Property Changed event. But, that is not what I need to do what I want. Earlier posts from Steve and Paul both have, what appears to me, the answer. Binding a label's Text property to one of the Meter's changed events. So, maybe a SMALL amount of light is showing in this dim bulb I call my brain!0
-
James - I'm just guessing, but I don't think you want to wait on an event which signals meter change. What I think you want is to create a separate program thread which runs continuously and continuously samples the meter. This sampling will be concurrent with other code function you might have. You might read up on "threads" in MSDN.0
-
Believe it or not, I'm still having issues working with Meter Events trying to get Signal Strength info to update a simple label. I look at the Meter Event Handler code in the Object Browser in Visual Studio and see what I "thnk" I need to do to create the event handler. But, VS keeps gripping about how I go about writing up the code to handle the call to the Meter events. (intellisense is having a field day today with me!)
james
WD5GWY
0 -
slice.SMeterDataReady += slice_SMeterDataReady;
static void slice_SMeterDataReady(float data) { }
0 -
Thanks Larry, I had forgot the first bit of code you posted. I was trying to get the second part going and that was where Visual Studio was complaining. Now I see why!
Live and learn!
james
WD5GWY
0 -
Paul,
I am just getting started writing .net programs for Flex. Could you send me your sample program as well? n6dmr at dmreese dot com
Thanks in advance,
Duane
0 -
Email sent to you Duane.
0 -
Paul, thanks again for the advice on Threading. I have found that several things I have been working on started working, (so far) once I made a few changes that included threading. Still playing with the S Meter thing. Larry's example above helped a lot. ( sometimes I miss the obvious) But, still struggling/learning!
james
WD5GWY
0
Leave a Comment
Categories
- All Categories
- 289 Community Topics
- 2.1K New Ideas
- 535 The Flea Market
- 7.5K Software
- 6K SmartSDR for Windows
- 146 SmartSDR for Maestro and M models
- 360 SmartSDR for Mac
- 249 SmartSDR for iOS
- 231 SmartSDR CAT
- 172 DAX
- 352 SmartSDR API
- 8.8K Radios and Accessories
- 7K FLEX-6000 Signature Series
- 26 FLEX-8000 Signature Series
- 850 Maestro
- 44 FlexControl
- 847 FLEX Series (Legacy) Radios
- 796 Genius Products
- 416 Power Genius XL Amplifier
- 277 Tuner Genius XL
- 103 Antenna Genius
- 243 Shack Infrastructure
- 166 Networking
- 404 Remote Operation (SmartLink)
- 130 Contesting
- 631 Peripherals & Station Integration
- 125 Amateur Radio Interests
- 870 Third-Party Software