forked from BySlin/VSCaptureMP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fix for float to double value conversion, json export
Bug fix for float to double value conversion, json export
- Loading branch information
1 parent
a8cf1f9
commit 8165759
Showing
4 changed files
with
35 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* This file is part of VitalSignsCaptureMP v1.005. | ||
* This file is part of VitalSignsCaptureMP v1.006. | ||
* Copyright (C) 2017-19 John George K., [email protected] | ||
VitalSignsCaptureMP is free software: you can redistribute it and/or modify | ||
|
@@ -183,10 +183,11 @@ public static void CreateWaveformSet(int nWaveSetType, List<byte> WaveTrtype) | |
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_ECG_ELEC_POTL_III"))))); | ||
break; | ||
case 2: | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x05))); //count | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x14))); //length | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x06))); //count | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x18))); //length | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_ECG_ELEC_POTL_II"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_ART_ABP"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_ART"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PULS_OXIM_PLETH"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_VEN_CENT"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_RESP"))))); | ||
|
@@ -227,11 +228,12 @@ public static void CreateWaveformSet(int nWaveSetType, List<byte> WaveTrtype) | |
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_ART"))))); | ||
break; | ||
case 8: | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x05))); //count | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x14))); //length | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x06))); //count | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x18))); //length | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_ECG_ELEC_POTL"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PULS_OXIM_PLETH"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_ART_ABP"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_ART"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_VEN_CENT"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_AWAY_CO2"))))); | ||
break; | ||
|
@@ -1094,8 +1096,8 @@ public static double FloattypeToValue(uint fvalue) | |
double value = 0; | ||
if (fvalue != DataConstants.FLOATTYPE_NAN) | ||
{ | ||
uint exponentbits = (fvalue >> 24); | ||
uint mantissabits = (fvalue << 8); | ||
int exponentbits = (int)(fvalue >> 24); | ||
int mantissabits = (int)(fvalue << 8); | ||
mantissabits = (mantissabits >> 8); | ||
|
||
sbyte signedexponentbits = (sbyte)exponentbits; // Get Two's complement signed byte | ||
|
@@ -1561,6 +1563,8 @@ public void PostJSONDataToServer(string postData) | |
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(m_jsonposturl); | ||
request.Method = "POST"; | ||
|
||
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; | ||
|
||
byte[] byteArray = Encoding.UTF8.GetBytes(postData); | ||
request.ContentType = "application/json"; | ||
request.ContentLength = byteArray.Length; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* This file is part of VitalSignsCaptureMP v1.005. | ||
* This file is part of VitalSignsCaptureMP v1.006. | ||
* Copyright (C) 2017-19 John George K., [email protected] | ||
* Portions of code (C) 2015 Richard L. Grier | ||
|
@@ -2757,6 +2757,10 @@ public class DataConstants | |
public const int MSMT_STATE_AL_INHIBITED = 0x0001; | ||
|
||
public const int FLOATTYPE_NAN = 0x007FFFFF; | ||
public const int FLOATTYPE_NRes = 0x800000; | ||
public const int FLOATTYPE_POSITIVE_INFINITY = 0x7FFFFE; | ||
public const int FLOATTYPE_NEGATIVE_INFINITY = 0x800002; | ||
|
||
|
||
//MetricCategory | ||
public const byte MCAT_UNSPEC = 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* This file is part of VitalSignsCaptureMP v1.005. | ||
* This file is part of VitalSignsCaptureMP v1.006. | ||
* Copyright (C) 2017-19 John George K., [email protected] | ||
VitalSignsCaptureMP is free software: you can redistribute it and/or modify | ||
|
@@ -508,10 +508,11 @@ public static void CreateWaveformSet(int nWaveSetType, List<byte> WaveTrtype) | |
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_ECG_ELEC_POTL_III"))))); | ||
break; | ||
case 2: | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x05))); //count | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x14))); //length | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x06))); //count | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x18))); //length | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_ECG_ELEC_POTL_II"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_ART_ABP"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_ART"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PULS_OXIM_PLETH"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_VEN_CENT"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_RESP"))))); | ||
|
@@ -552,11 +553,12 @@ public static void CreateWaveformSet(int nWaveSetType, List<byte> WaveTrtype) | |
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_ART"))))); | ||
break; | ||
case 8: | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x05))); //count | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x14))); //length | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x06))); //count | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianshortus(0x18))); //length | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_ECG_ELEC_POTL"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PULS_OXIM_PLETH"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_ART_ABP"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_ART"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_PRESS_BLD_VEN_CENT"))))); | ||
WaveTrtype.AddRange(BitConverter.GetBytes(correctendianuint((uint)(Enum.Parse(typeof(DataConstants.WavesIDLabels), "NLS_NOM_AWAY_CO2"))))); | ||
break; | ||
|
@@ -905,7 +907,7 @@ public void PollPacketDecoder(byte[] packetbuffer, int headersize) | |
} | ||
} | ||
|
||
if(m_dataexportset == 2) ExportNumValListToJSON("Numeric"); | ||
if (m_dataexportset == 2) ExportNumValListToJSON("Numeric"); | ||
ExportDataToCSV(); | ||
ExportWaveToCSV(); | ||
} | ||
|
@@ -1417,8 +1419,8 @@ public static double FloattypeToValue(uint fvalue) | |
double value = 0; | ||
if (fvalue != DataConstants.FLOATTYPE_NAN) | ||
{ | ||
uint exponentbits = (fvalue >> 24); | ||
uint mantissabits = (fvalue << 8); | ||
int exponentbits = (int)(fvalue >> 24); | ||
int mantissabits = (int)(fvalue << 8); | ||
mantissabits = (mantissabits >> 8); | ||
|
||
sbyte signedexponentbits = (sbyte)exponentbits; // Get Two's complement signed byte | ||
|
@@ -1883,6 +1885,8 @@ public void PostJSONDataToServer(string postData) | |
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(m_jsonposturl); | ||
request.Method = "POST"; | ||
|
||
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; | ||
|
||
byte[] byteArray = Encoding.UTF8.GetBytes(postData); | ||
request.ContentType = "application/json"; | ||
request.ContentLength = byteArray.Length; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* This file is part of VitalSignsCaptureMP v1.005. | ||
* This file is part of VitalSignsCaptureMP v1.006. | ||
* Copyright (C) 2017-19 John George K., [email protected] | ||
VitalSignsCaptureMP is free software: you can redistribute it and/or modify | ||
|
@@ -271,13 +271,13 @@ public static void ConnectviaLAN(string[] args) | |
Console.WriteLine("Waveform data export options:"); | ||
Console.WriteLine("0. None"); | ||
Console.WriteLine("1. ECG I, II, III"); | ||
Console.WriteLine("2. ECG II, ABP, PLETH, CVP, RESP"); | ||
Console.WriteLine("2. ECG II, ABP, ART IBP, PLETH, CVP, RESP"); | ||
Console.WriteLine("3. ECG AVR, ECG AVL, ECG AVF"); | ||
Console.WriteLine("4. ECG V1, ECG V2, ECG V3"); | ||
Console.WriteLine("5. ECG V4, ECG V5, ECG V6"); | ||
Console.WriteLine("6. EEG1, EEG2, EEG3, EEG4"); | ||
Console.WriteLine("7. ABP, ART IBP"); | ||
Console.WriteLine("8. Compound ECG, PLETH, ABP, CVP, CO2"); | ||
Console.WriteLine("8. Compound ECG, PLETH, ABP, ART IBP, CVP, CO2"); | ||
Console.WriteLine("9. All"); | ||
|
||
Console.WriteLine(); | ||
|
@@ -337,6 +337,8 @@ public static void ConnectviaLAN(string[] args) | |
Console.WriteLine(); | ||
Console.WriteLine("Press Escape button to Stop"); | ||
|
||
if (nDataExportset > 0 && nDataExportset < 3) _MPudpclient.m_dataexportset = nDataExportset; | ||
|
||
if (nCSVset > 0 && nCSVset < 4) _MPudpclient.m_csvexportset = nCSVset; | ||
|
||
if (nWavescaleSet == 1) _MPudpclient.m_calibratewavevalues = false; | ||
|
@@ -350,8 +352,6 @@ public static void ConnectviaLAN(string[] args) | |
_MPudpclient.m_DeviceID = DeviceID; | ||
_MPudpclient.m_jsonposturl = JSONPostUrl; | ||
|
||
if (nDataExportset > 0 && nDataExportset < 3) _MPudpclient.m_dataexportset = nDataExportset; | ||
|
||
try | ||
{ | ||
_MPudpclient.Connect(_MPudpclient.m_remoteIPtarget); | ||
|
@@ -579,13 +579,13 @@ public static void ConnectviaMIB(string[] args) | |
Console.WriteLine("Waveform data export priority options:"); | ||
Console.WriteLine("0. None"); | ||
Console.WriteLine("1. ECG I, II, III"); | ||
Console.WriteLine("2. ECG II, ABP, PLETH, CVP, RESP"); | ||
Console.WriteLine("2. ECG II, ABP, ART IBP, PLETH, CVP, RESP"); | ||
Console.WriteLine("3. ECG AVR, ECG AVL, ECG AVF"); | ||
Console.WriteLine("4. ECG V1, ECG V2, ECG V3"); | ||
Console.WriteLine("5. ECG V4, ECG V5, ECG V6"); | ||
Console.WriteLine("6. EEG1, EEG2, EEG3, EEG4"); | ||
Console.WriteLine("7. ABP, ART IBP"); | ||
Console.WriteLine("8. Compound ECG, PLETH, ABP, CVP, CO2"); | ||
Console.WriteLine("8. Compound ECG, PLETH, ABP, ART IBP, CVP, CO2"); | ||
Console.WriteLine("9. All"); | ||
|
||
Console.WriteLine(); | ||
|