repo time
Dependencies: mbed MAX14720 MAX30205 USBDevice
HspGuiSourceV301/HSPGui/View/FileLogView/RawFileLogView.cs@20:6d2af70c92ab, 2021-04-06 (annotated)
- Committer:
- darienf
- Date:
- Tue Apr 06 06:41:40 2021 +0000
- Revision:
- 20:6d2af70c92ab
another repo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
darienf | 20:6d2af70c92ab | 1 | /******************************************************************************* |
darienf | 20:6d2af70c92ab | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All rights Reserved. |
darienf | 20:6d2af70c92ab | 3 | * |
darienf | 20:6d2af70c92ab | 4 | * This software is protected by copyright laws of the United States and |
darienf | 20:6d2af70c92ab | 5 | * of foreign countries. This material may also be protected by patent laws |
darienf | 20:6d2af70c92ab | 6 | * and technology transfer regulations of the United States and of foreign |
darienf | 20:6d2af70c92ab | 7 | * countries. This software is furnished under a license agreement and/or a |
darienf | 20:6d2af70c92ab | 8 | * nondisclosure agreement and may only be used or reproduced in accordance |
darienf | 20:6d2af70c92ab | 9 | * with the terms of those agreements. Dissemination of this information to |
darienf | 20:6d2af70c92ab | 10 | * any party or parties not specified in the license agreement and/or |
darienf | 20:6d2af70c92ab | 11 | * nondisclosure agreement is expressly prohibited. |
darienf | 20:6d2af70c92ab | 12 | * |
darienf | 20:6d2af70c92ab | 13 | * The above copyright notice and this permission notice shall be included |
darienf | 20:6d2af70c92ab | 14 | * in all copies or substantial portions of the Software. |
darienf | 20:6d2af70c92ab | 15 | * |
darienf | 20:6d2af70c92ab | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
darienf | 20:6d2af70c92ab | 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
darienf | 20:6d2af70c92ab | 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
darienf | 20:6d2af70c92ab | 19 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
darienf | 20:6d2af70c92ab | 20 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
darienf | 20:6d2af70c92ab | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
darienf | 20:6d2af70c92ab | 22 | * OTHER DEALINGS IN THE SOFTWARE. |
darienf | 20:6d2af70c92ab | 23 | * |
darienf | 20:6d2af70c92ab | 24 | * Except as contained in this notice, the name of Maxim Integrated |
darienf | 20:6d2af70c92ab | 25 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
darienf | 20:6d2af70c92ab | 26 | * Products, Inc. Branding Policy. |
darienf | 20:6d2af70c92ab | 27 | * |
darienf | 20:6d2af70c92ab | 28 | * The mere transfer of this software does not imply any licenses |
darienf | 20:6d2af70c92ab | 29 | * of trade secrets, proprietary technology, copyrights, patents, |
darienf | 20:6d2af70c92ab | 30 | * trademarks, maskwork rights, or any other form of intellectual |
darienf | 20:6d2af70c92ab | 31 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
darienf | 20:6d2af70c92ab | 32 | * ownership rights. |
darienf | 20:6d2af70c92ab | 33 | ******************************************************************************* |
darienf | 20:6d2af70c92ab | 34 | */ |
darienf | 20:6d2af70c92ab | 35 | |
darienf | 20:6d2af70c92ab | 36 | using System; |
darienf | 20:6d2af70c92ab | 37 | using System.Collections.Generic; |
darienf | 20:6d2af70c92ab | 38 | using System.Linq; |
darienf | 20:6d2af70c92ab | 39 | using System.Text; |
darienf | 20:6d2af70c92ab | 40 | |
darienf | 20:6d2af70c92ab | 41 | using Maxim.Utility; |
darienf | 20:6d2af70c92ab | 42 | using HealthSensorPlatform.Model; |
darienf | 20:6d2af70c92ab | 43 | |
darienf | 20:6d2af70c92ab | 44 | namespace HealthSensorPlatform.View |
darienf | 20:6d2af70c92ab | 45 | { |
darienf | 20:6d2af70c92ab | 46 | class RawFileLogView : FileLog, IRawFileLogView |
darienf | 20:6d2af70c92ab | 47 | { |
darienf | 20:6d2af70c92ab | 48 | /* Fields */ |
darienf | 20:6d2af70c92ab | 49 | private bool enable = false; |
darienf | 20:6d2af70c92ab | 50 | //private double sampleRate = 0; |
darienf | 20:6d2af70c92ab | 51 | //private int count = 0; |
darienf | 20:6d2af70c92ab | 52 | |
darienf | 20:6d2af70c92ab | 53 | /* Constructors */ |
darienf | 20:6d2af70c92ab | 54 | |
darienf | 20:6d2af70c92ab | 55 | /* Events */ |
darienf | 20:6d2af70c92ab | 56 | public new event EventHandler<Maxim.Global.ErrorEventArgs> Error; |
darienf | 20:6d2af70c92ab | 57 | |
darienf | 20:6d2af70c92ab | 58 | /* Properties */ |
darienf | 20:6d2af70c92ab | 59 | public bool Enable |
darienf | 20:6d2af70c92ab | 60 | { |
darienf | 20:6d2af70c92ab | 61 | get |
darienf | 20:6d2af70c92ab | 62 | { |
darienf | 20:6d2af70c92ab | 63 | return enable; |
darienf | 20:6d2af70c92ab | 64 | } |
darienf | 20:6d2af70c92ab | 65 | set |
darienf | 20:6d2af70c92ab | 66 | { |
darienf | 20:6d2af70c92ab | 67 | enable = value; |
darienf | 20:6d2af70c92ab | 68 | if (enable == false) |
darienf | 20:6d2af70c92ab | 69 | Close(); |
darienf | 20:6d2af70c92ab | 70 | } |
darienf | 20:6d2af70c92ab | 71 | } |
darienf | 20:6d2af70c92ab | 72 | |
darienf | 20:6d2af70c92ab | 73 | /* Methods */ |
darienf | 20:6d2af70c92ab | 74 | public void StreamStartStop() |
darienf | 20:6d2af70c92ab | 75 | { |
darienf | 20:6d2af70c92ab | 76 | } |
darienf | 20:6d2af70c92ab | 77 | |
darienf | 20:6d2af70c92ab | 78 | public void DisplayEcg(double[] time, EcgFifo[] ecgData) |
darienf | 20:6d2af70c92ab | 79 | { |
darienf | 20:6d2af70c92ab | 80 | DisplayEcg(time, ecgData, null); |
darienf | 20:6d2af70c92ab | 81 | } |
darienf | 20:6d2af70c92ab | 82 | |
darienf | 20:6d2af70c92ab | 83 | public void DisplayEcg(double[] time, EcgFifo[] ecgData, DCLeadOff leadOff) |
darienf | 20:6d2af70c92ab | 84 | { |
darienf | 20:6d2af70c92ab | 85 | StringBuilder sb = new StringBuilder(); |
darienf | 20:6d2af70c92ab | 86 | |
darienf | 20:6d2af70c92ab | 87 | for (int i = 0; i < ecgData.Length; i++) |
darienf | 20:6d2af70c92ab | 88 | { |
darienf | 20:6d2af70c92ab | 89 | sb.Append(time[i]); |
darienf | 20:6d2af70c92ab | 90 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 91 | sb.Append(ecgData[i].EcgData); |
darienf | 20:6d2af70c92ab | 92 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 93 | sb.Append(ecgData[i].ETag); |
darienf | 20:6d2af70c92ab | 94 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 95 | sb.Append(ecgData[i].PTag); |
darienf | 20:6d2af70c92ab | 96 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 97 | sb.Append(ecgData[i].Data); |
darienf | 20:6d2af70c92ab | 98 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 99 | |
darienf | 20:6d2af70c92ab | 100 | if (leadOff != null) |
darienf | 20:6d2af70c92ab | 101 | { |
darienf | 20:6d2af70c92ab | 102 | sb.Append(leadOff.PostiveHigh ? 1 : 0); |
darienf | 20:6d2af70c92ab | 103 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 104 | sb.Append(leadOff.PostiveLow ? 1 : 0); |
darienf | 20:6d2af70c92ab | 105 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 106 | sb.Append(leadOff.NegativeHigh ? 1 : 0); |
darienf | 20:6d2af70c92ab | 107 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 108 | sb.Append(leadOff.NegativeLow ? 1 : 0); |
darienf | 20:6d2af70c92ab | 109 | } |
darienf | 20:6d2af70c92ab | 110 | |
darienf | 20:6d2af70c92ab | 111 | |
darienf | 20:6d2af70c92ab | 112 | if (i != ecgData.Length - 1) |
darienf | 20:6d2af70c92ab | 113 | sb.Append(Environment.NewLine); |
darienf | 20:6d2af70c92ab | 114 | } |
darienf | 20:6d2af70c92ab | 115 | |
darienf | 20:6d2af70c92ab | 116 | WriteLine(sb.ToString()); |
darienf | 20:6d2af70c92ab | 117 | |
darienf | 20:6d2af70c92ab | 118 | } |
darienf | 20:6d2af70c92ab | 119 | |
darienf | 20:6d2af70c92ab | 120 | public void DisplayBioZ(double[] time, BioZFifo[] bioZData) |
darienf | 20:6d2af70c92ab | 121 | { |
darienf | 20:6d2af70c92ab | 122 | DisplayBioZ(time, bioZData, null, null); |
darienf | 20:6d2af70c92ab | 123 | } |
darienf | 20:6d2af70c92ab | 124 | |
darienf | 20:6d2af70c92ab | 125 | public void DisplayBioZ(double[] time, BioZFifo[] bioZData, DCLeadOff leadOff) |
darienf | 20:6d2af70c92ab | 126 | { |
darienf | 20:6d2af70c92ab | 127 | DisplayBioZ(time, bioZData, leadOff, null); |
darienf | 20:6d2af70c92ab | 128 | } |
darienf | 20:6d2af70c92ab | 129 | |
darienf | 20:6d2af70c92ab | 130 | public void DisplayBioZ(double[] time, BioZFifo[] bioZData, ACLeadOff acLeadOff) |
darienf | 20:6d2af70c92ab | 131 | { |
darienf | 20:6d2af70c92ab | 132 | DisplayBioZ(time, bioZData, null, acLeadOff); |
darienf | 20:6d2af70c92ab | 133 | } |
darienf | 20:6d2af70c92ab | 134 | |
darienf | 20:6d2af70c92ab | 135 | public void DisplayBioZ(double[] time, BioZFifo[] bioZData, DCLeadOff leadOff, ACLeadOff acLeadOff) |
darienf | 20:6d2af70c92ab | 136 | { |
darienf | 20:6d2af70c92ab | 137 | StringBuilder sb = new StringBuilder(); |
darienf | 20:6d2af70c92ab | 138 | |
darienf | 20:6d2af70c92ab | 139 | for (int i = 0; i < bioZData.Length; i++) |
darienf | 20:6d2af70c92ab | 140 | { |
darienf | 20:6d2af70c92ab | 141 | sb.Append(time[i]); |
darienf | 20:6d2af70c92ab | 142 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 143 | sb.Append(bioZData[i].BioZData); |
darienf | 20:6d2af70c92ab | 144 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 145 | sb.Append(bioZData[i].BTag); |
darienf | 20:6d2af70c92ab | 146 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 147 | sb.Append(bioZData[i].Data); |
darienf | 20:6d2af70c92ab | 148 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 149 | |
darienf | 20:6d2af70c92ab | 150 | if (leadOff != null) |
darienf | 20:6d2af70c92ab | 151 | { |
darienf | 20:6d2af70c92ab | 152 | sb.Append(leadOff.PostiveHigh ? 1 : 0); |
darienf | 20:6d2af70c92ab | 153 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 154 | sb.Append(leadOff.PostiveLow ? 1 : 0); |
darienf | 20:6d2af70c92ab | 155 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 156 | sb.Append(leadOff.NegativeHigh ? 1 : 0); |
darienf | 20:6d2af70c92ab | 157 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 158 | sb.Append(leadOff.NegativeLow ? 1 : 0); |
darienf | 20:6d2af70c92ab | 159 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 160 | } |
darienf | 20:6d2af70c92ab | 161 | else |
darienf | 20:6d2af70c92ab | 162 | sb.Append(", , , ,"); |
darienf | 20:6d2af70c92ab | 163 | |
darienf | 20:6d2af70c92ab | 164 | if (acLeadOff != null) |
darienf | 20:6d2af70c92ab | 165 | { |
darienf | 20:6d2af70c92ab | 166 | sb.Append(acLeadOff.BioZOverRange ? 1 : 0); |
darienf | 20:6d2af70c92ab | 167 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 168 | sb.Append(acLeadOff.BioZUnderRange ? 1 : 0); |
darienf | 20:6d2af70c92ab | 169 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 170 | } |
darienf | 20:6d2af70c92ab | 171 | |
darienf | 20:6d2af70c92ab | 172 | if (i != bioZData.Length - 1) |
darienf | 20:6d2af70c92ab | 173 | sb.Append(Environment.NewLine); |
darienf | 20:6d2af70c92ab | 174 | } |
darienf | 20:6d2af70c92ab | 175 | |
darienf | 20:6d2af70c92ab | 176 | WriteLine(sb.ToString()); |
darienf | 20:6d2af70c92ab | 177 | |
darienf | 20:6d2af70c92ab | 178 | } |
darienf | 20:6d2af70c92ab | 179 | |
darienf | 20:6d2af70c92ab | 180 | public void DisplayRToR(int rToRData, double rToRCorrectedSeconds) |
darienf | 20:6d2af70c92ab | 181 | { |
darienf | 20:6d2af70c92ab | 182 | StringBuilder sb = new StringBuilder(); |
darienf | 20:6d2af70c92ab | 183 | |
darienf | 20:6d2af70c92ab | 184 | sb.Append(rToRData); |
darienf | 20:6d2af70c92ab | 185 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 186 | sb.Append(rToRCorrectedSeconds); |
darienf | 20:6d2af70c92ab | 187 | |
darienf | 20:6d2af70c92ab | 188 | WriteLine(sb.ToString()); |
darienf | 20:6d2af70c92ab | 189 | } |
darienf | 20:6d2af70c92ab | 190 | |
darienf | 20:6d2af70c92ab | 191 | public void DisplayPace(double[] time, PaceData.PaceEdge[] paceData) |
darienf | 20:6d2af70c92ab | 192 | { |
darienf | 20:6d2af70c92ab | 193 | StringBuilder sb = new StringBuilder(); |
darienf | 20:6d2af70c92ab | 194 | |
darienf | 20:6d2af70c92ab | 195 | for (int i = 0; i < time.Length; i++) |
darienf | 20:6d2af70c92ab | 196 | { |
darienf | 20:6d2af70c92ab | 197 | sb.Append(time[i]); |
darienf | 20:6d2af70c92ab | 198 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 199 | sb.Append(paceData[i].Data); |
darienf | 20:6d2af70c92ab | 200 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 201 | sb.Append(paceData[i].Polarity ? 'R' : 'F'); |
darienf | 20:6d2af70c92ab | 202 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 203 | sb.Append(paceData[i].Last ? '1' : '0'); |
darienf | 20:6d2af70c92ab | 204 | |
darienf | 20:6d2af70c92ab | 205 | if (i != time.Length - 1) |
darienf | 20:6d2af70c92ab | 206 | sb.Append(Environment.NewLine); |
darienf | 20:6d2af70c92ab | 207 | |
darienf | 20:6d2af70c92ab | 208 | } |
darienf | 20:6d2af70c92ab | 209 | |
darienf | 20:6d2af70c92ab | 210 | WriteLine(sb.ToString()); |
darienf | 20:6d2af70c92ab | 211 | } |
darienf | 20:6d2af70c92ab | 212 | |
darienf | 20:6d2af70c92ab | 213 | public void DisplayPressure(int[] hexTemperature, double[] temperature, int[] hexPressure, double[] pressure) |
darienf | 20:6d2af70c92ab | 214 | { |
darienf | 20:6d2af70c92ab | 215 | StringBuilder sb = new StringBuilder(); |
darienf | 20:6d2af70c92ab | 216 | |
darienf | 20:6d2af70c92ab | 217 | for (int i = 0; i < hexTemperature.Length; i++) |
darienf | 20:6d2af70c92ab | 218 | { |
darienf | 20:6d2af70c92ab | 219 | sb.Append(hexTemperature[i]); |
darienf | 20:6d2af70c92ab | 220 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 221 | sb.Append(temperature[i]); |
darienf | 20:6d2af70c92ab | 222 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 223 | sb.Append(hexPressure[i]); |
darienf | 20:6d2af70c92ab | 224 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 225 | sb.Append(pressure[i]); |
darienf | 20:6d2af70c92ab | 226 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 227 | |
darienf | 20:6d2af70c92ab | 228 | if (i != hexTemperature.Length - 1) |
darienf | 20:6d2af70c92ab | 229 | sb.Append(Environment.NewLine); |
darienf | 20:6d2af70c92ab | 230 | } |
darienf | 20:6d2af70c92ab | 231 | |
darienf | 20:6d2af70c92ab | 232 | WriteLine(sb.ToString()); |
darienf | 20:6d2af70c92ab | 233 | } |
darienf | 20:6d2af70c92ab | 234 | |
darienf | 20:6d2af70c92ab | 235 | public void DisplayTemperature(int[] hex, double[] temperature) |
darienf | 20:6d2af70c92ab | 236 | { |
darienf | 20:6d2af70c92ab | 237 | StringBuilder sb = new StringBuilder(); |
darienf | 20:6d2af70c92ab | 238 | |
darienf | 20:6d2af70c92ab | 239 | for (int i = 0; i < hex.Length; i++) |
darienf | 20:6d2af70c92ab | 240 | { |
darienf | 20:6d2af70c92ab | 241 | sb.Append(hex[i]); |
darienf | 20:6d2af70c92ab | 242 | sb.Append(", "); |
darienf | 20:6d2af70c92ab | 243 | sb.Append(temperature[i].ToString("F3")); |
darienf | 20:6d2af70c92ab | 244 | |
darienf | 20:6d2af70c92ab | 245 | if (i != hex.Length - 1) |
darienf | 20:6d2af70c92ab | 246 | sb.Append(Environment.NewLine); |
darienf | 20:6d2af70c92ab | 247 | } |
darienf | 20:6d2af70c92ab | 248 | |
darienf | 20:6d2af70c92ab | 249 | WriteLine(sb.ToString()); |
darienf | 20:6d2af70c92ab | 250 | } |
darienf | 20:6d2af70c92ab | 251 | |
darienf | 20:6d2af70c92ab | 252 | public void DisplayPpg(double[] time, int[][] data) |
darienf | 20:6d2af70c92ab | 253 | { |
darienf | 20:6d2af70c92ab | 254 | StringBuilder strBuilder = new StringBuilder(); |
darienf | 20:6d2af70c92ab | 255 | |
darienf | 20:6d2af70c92ab | 256 | int channelCount = 0; |
darienf | 20:6d2af70c92ab | 257 | |
darienf | 20:6d2af70c92ab | 258 | int[] data1 = data[0]; |
darienf | 20:6d2af70c92ab | 259 | int[] data2 = data[1]; |
darienf | 20:6d2af70c92ab | 260 | int[] data3 = data[2]; |
darienf | 20:6d2af70c92ab | 261 | //int[] data4 = data[3]; |
darienf | 20:6d2af70c92ab | 262 | |
darienf | 20:6d2af70c92ab | 263 | //if (data4.Length != 0) |
darienf | 20:6d2af70c92ab | 264 | // channelCount = 4; |
darienf | 20:6d2af70c92ab | 265 | if (data3.Length != 0) |
darienf | 20:6d2af70c92ab | 266 | channelCount = 3; |
darienf | 20:6d2af70c92ab | 267 | else if (data2.Length != 0) |
darienf | 20:6d2af70c92ab | 268 | channelCount = 2; |
darienf | 20:6d2af70c92ab | 269 | else if (data1.Length != 0) |
darienf | 20:6d2af70c92ab | 270 | channelCount = 1; |
darienf | 20:6d2af70c92ab | 271 | |
darienf | 20:6d2af70c92ab | 272 | for (int i = 0; i < data1.Length; i++) |
darienf | 20:6d2af70c92ab | 273 | { |
darienf | 20:6d2af70c92ab | 274 | strBuilder.Append(time[i]); |
darienf | 20:6d2af70c92ab | 275 | strBuilder.Append(","); |
darienf | 20:6d2af70c92ab | 276 | for (int j = 0; j < channelCount; j++) |
darienf | 20:6d2af70c92ab | 277 | { |
darienf | 20:6d2af70c92ab | 278 | //strBuilder.Append(data[j][i] & 0x7FFFF); // Data Code |
darienf | 20:6d2af70c92ab | 279 | //strBuilder.Append(","); |
darienf | 20:6d2af70c92ab | 280 | //strBuilder.Append(data[j][i] >> 19); // DAC code |
darienf | 20:6d2af70c92ab | 281 | //strBuilder.Append(data[j][i] & 0x7FFFF); // Data Code |
darienf | 20:6d2af70c92ab | 282 | strBuilder.Append(data[j][i]); |
darienf | 20:6d2af70c92ab | 283 | strBuilder.Append(","); |
darienf | 20:6d2af70c92ab | 284 | } |
darienf | 20:6d2af70c92ab | 285 | WriteLine(strBuilder.ToString()); |
darienf | 20:6d2af70c92ab | 286 | strBuilder.Clear(); |
darienf | 20:6d2af70c92ab | 287 | } |
darienf | 20:6d2af70c92ab | 288 | } |
darienf | 20:6d2af70c92ab | 289 | |
darienf | 20:6d2af70c92ab | 290 | public void DisplayPpg(int[][] data) |
darienf | 20:6d2af70c92ab | 291 | { |
darienf | 20:6d2af70c92ab | 292 | long time = DateTime.Now.Ticks; |
darienf | 20:6d2af70c92ab | 293 | long startTime = DateTime.Now.Ticks; |
darienf | 20:6d2af70c92ab | 294 | string timeStr; |
darienf | 20:6d2af70c92ab | 295 | StringBuilder strBuilder = new StringBuilder(); |
darienf | 20:6d2af70c92ab | 296 | |
darienf | 20:6d2af70c92ab | 297 | int channelCount = 0; |
darienf | 20:6d2af70c92ab | 298 | |
darienf | 20:6d2af70c92ab | 299 | //string datetime = string.Format("{0:HH-mm-ss.fff}", DateTime.Now) + ", "; |
darienf | 20:6d2af70c92ab | 300 | timeStr = ((time - startTime) / 10000000.0).ToString() + ", "; |
darienf | 20:6d2af70c92ab | 301 | |
darienf | 20:6d2af70c92ab | 302 | int[] data1 = data[0]; |
darienf | 20:6d2af70c92ab | 303 | int[] data2 = data[1]; |
darienf | 20:6d2af70c92ab | 304 | int[] data3 = data[2]; |
darienf | 20:6d2af70c92ab | 305 | //int[] data4 = data[3]; |
darienf | 20:6d2af70c92ab | 306 | |
darienf | 20:6d2af70c92ab | 307 | //if (data4.Length != 0) |
darienf | 20:6d2af70c92ab | 308 | // channelCount = 4; |
darienf | 20:6d2af70c92ab | 309 | if (data3.Length != 0) |
darienf | 20:6d2af70c92ab | 310 | channelCount = 3; |
darienf | 20:6d2af70c92ab | 311 | else if (data2.Length != 0) |
darienf | 20:6d2af70c92ab | 312 | channelCount = 2; |
darienf | 20:6d2af70c92ab | 313 | else if (data1.Length != 0) |
darienf | 20:6d2af70c92ab | 314 | channelCount = 1; |
darienf | 20:6d2af70c92ab | 315 | |
darienf | 20:6d2af70c92ab | 316 | for (int i = 0; i < data1.Length; i++) |
darienf | 20:6d2af70c92ab | 317 | { |
darienf | 20:6d2af70c92ab | 318 | strBuilder.Append(timeStr); |
darienf | 20:6d2af70c92ab | 319 | for (int j = 0; j < channelCount; j++) |
darienf | 20:6d2af70c92ab | 320 | { |
darienf | 20:6d2af70c92ab | 321 | //strBuilder.Append(data[j][i] & 0x7FFFF); // Data Code |
darienf | 20:6d2af70c92ab | 322 | //strBuilder.Append(","); |
darienf | 20:6d2af70c92ab | 323 | //strBuilder.Append(data[j][i] >> 19); // DAC code |
darienf | 20:6d2af70c92ab | 324 | //strBuilder.Append(data[j][i] & 0x7FFFF); // Data Code |
darienf | 20:6d2af70c92ab | 325 | strBuilder.Append(data[j][i]); |
darienf | 20:6d2af70c92ab | 326 | strBuilder.Append(","); |
darienf | 20:6d2af70c92ab | 327 | } |
darienf | 20:6d2af70c92ab | 328 | WriteLine(strBuilder.ToString()); |
darienf | 20:6d2af70c92ab | 329 | strBuilder.Clear(); |
darienf | 20:6d2af70c92ab | 330 | } |
darienf | 20:6d2af70c92ab | 331 | |
darienf | 20:6d2af70c92ab | 332 | } |
darienf | 20:6d2af70c92ab | 333 | |
darienf | 20:6d2af70c92ab | 334 | public void DisplayXYZ(double[] time, int[][] data) |
darienf | 20:6d2af70c92ab | 335 | { |
darienf | 20:6d2af70c92ab | 336 | StringBuilder strBuilder = new StringBuilder(); |
darienf | 20:6d2af70c92ab | 337 | |
darienf | 20:6d2af70c92ab | 338 | int[] data1 = data[0]; |
darienf | 20:6d2af70c92ab | 339 | int[] data2 = data[1]; |
darienf | 20:6d2af70c92ab | 340 | int[] data3 = data[2]; |
darienf | 20:6d2af70c92ab | 341 | //int[] data4 = data[3]; |
darienf | 20:6d2af70c92ab | 342 | |
darienf | 20:6d2af70c92ab | 343 | for (int i = 0; i < data3.Length; i++) |
darienf | 20:6d2af70c92ab | 344 | { |
darienf | 20:6d2af70c92ab | 345 | strBuilder.Append(time[i]); |
darienf | 20:6d2af70c92ab | 346 | strBuilder.Append(","); |
darienf | 20:6d2af70c92ab | 347 | strBuilder.Append(data[0][i]); |
darienf | 20:6d2af70c92ab | 348 | strBuilder.Append(","); |
darienf | 20:6d2af70c92ab | 349 | strBuilder.Append(data[1][i]); |
darienf | 20:6d2af70c92ab | 350 | strBuilder.Append(","); |
darienf | 20:6d2af70c92ab | 351 | strBuilder.Append(data[2][i]); |
darienf | 20:6d2af70c92ab | 352 | |
darienf | 20:6d2af70c92ab | 353 | WriteLine(strBuilder.ToString()); |
darienf | 20:6d2af70c92ab | 354 | strBuilder.Clear(); |
darienf | 20:6d2af70c92ab | 355 | } |
darienf | 20:6d2af70c92ab | 356 | } |
darienf | 20:6d2af70c92ab | 357 | |
darienf | 20:6d2af70c92ab | 358 | public void DisplayXYZ(int[][] data) |
darienf | 20:6d2af70c92ab | 359 | { |
darienf | 20:6d2af70c92ab | 360 | long time = DateTime.Now.Ticks; |
darienf | 20:6d2af70c92ab | 361 | long startTime = DateTime.Now.Ticks; |
darienf | 20:6d2af70c92ab | 362 | string timeStr; |
darienf | 20:6d2af70c92ab | 363 | StringBuilder strBuilder = new StringBuilder(); |
darienf | 20:6d2af70c92ab | 364 | |
darienf | 20:6d2af70c92ab | 365 | //string datetime = string.Format("{0:HH-mm-ss.fff}", DateTime.Now) + ", "; |
darienf | 20:6d2af70c92ab | 366 | timeStr = ((time - startTime) / 10000000.0).ToString() + ", "; |
darienf | 20:6d2af70c92ab | 367 | |
darienf | 20:6d2af70c92ab | 368 | int[] data1 = data[0]; |
darienf | 20:6d2af70c92ab | 369 | int[] data2 = data[1]; |
darienf | 20:6d2af70c92ab | 370 | int[] data3 = data[2]; |
darienf | 20:6d2af70c92ab | 371 | //int[] data4 = data[3]; |
darienf | 20:6d2af70c92ab | 372 | |
darienf | 20:6d2af70c92ab | 373 | for (int i = 0; i < data3.Length; i++) |
darienf | 20:6d2af70c92ab | 374 | { |
darienf | 20:6d2af70c92ab | 375 | strBuilder.Append(time); |
darienf | 20:6d2af70c92ab | 376 | strBuilder.Append(data[0][i]); |
darienf | 20:6d2af70c92ab | 377 | strBuilder.Append(","); |
darienf | 20:6d2af70c92ab | 378 | strBuilder.Append(data[1][i]); |
darienf | 20:6d2af70c92ab | 379 | strBuilder.Append(","); |
darienf | 20:6d2af70c92ab | 380 | strBuilder.Append(data[2][i]); |
darienf | 20:6d2af70c92ab | 381 | |
darienf | 20:6d2af70c92ab | 382 | WriteLine(strBuilder.ToString()); |
darienf | 20:6d2af70c92ab | 383 | strBuilder.Clear(); |
darienf | 20:6d2af70c92ab | 384 | } |
darienf | 20:6d2af70c92ab | 385 | } |
darienf | 20:6d2af70c92ab | 386 | } |
darienf | 20:6d2af70c92ab | 387 | } |