[hpsdr] Signal level discrepancy RA Utility / Multimeter

George Byrkit ghbyrkit at chartermi.net
Fri Feb 12 13:54:32 PST 2016


Joe,
I don't think it involved System.Net.NetworkInformation at all.

You can see in the Kiss Konsole code some of the following:
1) create a NumberFormatInfo variable, maybe named 'nfi':
        NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;  // so we are region
independent in terms of ',' and '.' for floats (form1.cs around line 571)
This requires " using System.Globalization;" to resolve.  Not sure how the tag got on the
NetworkInformation line!

2) use a construct like: 'BlockNBThreshold.ToString(nfi)' to create a string version of a
float or double to write out
3) examine 'kkcsv.cs' to see reading in such a value.  I used an overloaded method
LookupKKCSVValue (on the default value, which is of the type that we want, say double,
that you can cast down to a float):            rcvr.BlockNBThreshold =
(float)LookupKKCSVValue("NB1 Threshold", rcvr.BlockNBThreshold, value);
4) here it uses ' Convert.ToDouble(stringValueThatIsADoubleOrFloat, nfi);', which creates
a double.

All that reference of ', nfi' causes the invariant culture to be applied.

A note to others: you cannot overload a method/function on return datatype, only on input
parameters (arguments).  So when I have overloads of 'LookupKKCSVValue', that relies on
the type of the default value matching the return value, which gives a valid overload.  If
the default value is a double, the return value should be a double...

Then it's just a matter of using "Split()" to split the CSV file line on "," (commas), and
processing each item on the line appropriately.

73,
George K9TRV

-----Original Message-----
From: Joe Martin [mailto:k5so at k5so.com] 
Sent: Friday, February 12, 2016 8:58 AM
To: George Byrkit
Cc: 'DK4RW'; hpsdr at lists.openhpsdr.org
Subject: Re: [hpsdr] Signal level discrepancy RA Utility / Multimeter

George, 

Thanks, I did try that earlier but I'll take a look at it again.  As I recall simply using
a "using System.Net.NetworkInformation" declaration as is done in KK  didn't solve the
issue for me earlier.  Maybe there is more that needs to be done to make it invariant? 

Joe K5SO

On Feb 12, 2016, at 5:01 AM, George Byrkit wrote:

> Joe,
> Your better course of action is to write the file with commas "," separating fields, and
> periods "." separating parts of a floating point value, and ensure that you write and
read
> them with 'invariant culture'.  That is you ensure that all floating point numbers are
> read and written as if they were in the US.  This is what Kiss Konsole has done with
> considerable success.  It also allows the files to be interchanged freely among hams.
> 
> George K9TRV
> 
> -----Original Message-----
> From: Hpsdr [mailto:hpsdr-bounces at lists.openhpsdr.org] On Behalf Of Joe Martin
> Sent: Thursday, February 11, 2016 10:43 PM
> To: DK4RW
> Cc: hpsdr at lists.openhpsdr.org
> Subject: Re: [hpsdr] Signal level discrepancy RA Utility / Multimeter
> 
> ***** High Performance Software Defined Radio Discussion List *****
> 
> RA utility users: 
> 
> It appears that semicolon is a standard column delimiter.  I believe if I include the
> statement "sep=;" in the first line of the .csv file and use a semicolon in each line of
> the two-column data to deliniate the columns when the data are written to disk things
> should work for both EU region and US region computer settings for the RA .csv files.  
> 
> We'll see. 
> 
> 73, Joe K5SO




More information about the Hpsdr mailing list