repo time

Dependencies:   mbed MAX14720 MAX30205 USBDevice

Committer:
darienf
Date:
Tue Apr 06 06:41:40 2021 +0000
Revision:
20:6d2af70c92ab
another repo

Who changed what in which revision?

UserRevisionLine numberNew 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.ComponentModel;
darienf 20:6d2af70c92ab 39 using System.Drawing;
darienf 20:6d2af70c92ab 40 using System.Data;
darienf 20:6d2af70c92ab 41 using System.Linq;
darienf 20:6d2af70c92ab 42 using System.Text;
darienf 20:6d2af70c92ab 43 using System.Windows.Forms;
darienf 20:6d2af70c92ab 44 using System.Globalization;
darienf 20:6d2af70c92ab 45
darienf 20:6d2af70c92ab 46 using HealthSensorPlatform.Model;
darienf 20:6d2af70c92ab 47
darienf 20:6d2af70c92ab 48 namespace HealthSensorPlatform.CustomControls
darienf 20:6d2af70c92ab 49 {
darienf 20:6d2af70c92ab 50 public partial class DataLoggingView : UserControl, IDeviceView, IDataLoggingView
darienf 20:6d2af70c92ab 51 {
darienf 20:6d2af70c92ab 52 /* Fields */
darienf 20:6d2af70c92ab 53 public GetEcgInitArgs GetEcgInitArgsPointer;
darienf 20:6d2af70c92ab 54 public GetRToRInitArgs GetRToRInitArgsPointer;
darienf 20:6d2af70c92ab 55 public GetBioZInitArgs GetBioZInitArgsPointer;
darienf 20:6d2af70c92ab 56 public GetPaceInitArgs GetPaceInitArgsPointer;
darienf 20:6d2af70c92ab 57 public GetFMSTRInitArgs GetFMSTRInitArgsPointer;
darienf 20:6d2af70c92ab 58 public GetHRModeInitArgs GetHRModeInitArgsPointer;
darienf 20:6d2af70c92ab 59 public GetSpO2HRModeInitArgs GetSpO2HRModeInitArgsPointer;
darienf 20:6d2af70c92ab 60 public GetMultiModeInitArgs GetMultiModeInitArgsPointer;
darienf 20:6d2af70c92ab 61
darienf 20:6d2af70c92ab 62 private RPCSupport.RPCClient rpcClient;
darienf 20:6d2af70c92ab 63
darienf 20:6d2af70c92ab 64 private InitArgs.EcgInitStart ecgArgs;
darienf 20:6d2af70c92ab 65 private InitArgs.BIOZInitStart bioZArgs;
darienf 20:6d2af70c92ab 66 private InitArgs.RToRInitStart rToRArgs;
darienf 20:6d2af70c92ab 67 private InitArgs.PACEInitStart paceArgs;
darienf 20:6d2af70c92ab 68 private InitArgs.FMSTRInitStart fmstrArgs;
darienf 20:6d2af70c92ab 69 private InitArgs.HRModeInitStart hrModeArgs;
darienf 20:6d2af70c92ab 70 private InitArgs.SpO2HRModeInitStart spO2HRModeArgs;
darienf 20:6d2af70c92ab 71 private InitArgs.MultiModeInitStart multiModeArgs;
darienf 20:6d2af70c92ab 72
darienf 20:6d2af70c92ab 73 private Model.DataLogModel dataLogModel;
darienf 20:6d2af70c92ab 74 bool internalUpdate = false;
darienf 20:6d2af70c92ab 75
darienf 20:6d2af70c92ab 76 /* Constructor */
darienf 20:6d2af70c92ab 77 public DataLoggingView()
darienf 20:6d2af70c92ab 78 {
darienf 20:6d2af70c92ab 79 InitializeComponent();
darienf 20:6d2af70c92ab 80
darienf 20:6d2af70c92ab 81 dataLogModel = new Model.DataLogModel(rpcClient);
darienf 20:6d2af70c92ab 82 dataLogModel.LogStreamDone += new EventHandler<EventArgs>(OnLogStreamDone);
darienf 20:6d2af70c92ab 83 }
darienf 20:6d2af70c92ab 84
darienf 20:6d2af70c92ab 85 /* Events */
darienf 20:6d2af70c92ab 86 public event EventHandler<EventArgs> LogDownloadStart;
darienf 20:6d2af70c92ab 87 public event EventHandler<EventArgs> MissionWrite;
darienf 20:6d2af70c92ab 88 public event EventHandler<EventArgs> MissionRead;
darienf 20:6d2af70c92ab 89 public event EventHandler<EventArgs> MissionErase;
darienf 20:6d2af70c92ab 90
darienf 20:6d2af70c92ab 91 /* Properties */
darienf 20:6d2af70c92ab 92 public RPCSupport.RPCClient RPCClient
darienf 20:6d2af70c92ab 93 {
darienf 20:6d2af70c92ab 94 set
darienf 20:6d2af70c92ab 95 {
darienf 20:6d2af70c92ab 96 rpcClient = value;
darienf 20:6d2af70c92ab 97 }
darienf 20:6d2af70c92ab 98 }
darienf 20:6d2af70c92ab 99
darienf 20:6d2af70c92ab 100 public bool Connected { get; set; }
darienf 20:6d2af70c92ab 101
darienf 20:6d2af70c92ab 102 public InitArgs.EcgInitStart EcgArgs
darienf 20:6d2af70c92ab 103 {
darienf 20:6d2af70c92ab 104 get
darienf 20:6d2af70c92ab 105 {
darienf 20:6d2af70c92ab 106 return ecgArgs;
darienf 20:6d2af70c92ab 107 }
darienf 20:6d2af70c92ab 108 set
darienf 20:6d2af70c92ab 109 {
darienf 20:6d2af70c92ab 110 ecgArgs = value;
darienf 20:6d2af70c92ab 111 if (ecgArgs != null)
darienf 20:6d2af70c92ab 112 tbEcgParameters.Text = ecgArgs.ToCommandString();
darienf 20:6d2af70c92ab 113 else
darienf 20:6d2af70c92ab 114 tbEcgParameters.Text = "";
darienf 20:6d2af70c92ab 115 }
darienf 20:6d2af70c92ab 116 }
darienf 20:6d2af70c92ab 117 public InitArgs.BIOZInitStart BioZArgs
darienf 20:6d2af70c92ab 118 {
darienf 20:6d2af70c92ab 119 get
darienf 20:6d2af70c92ab 120 {
darienf 20:6d2af70c92ab 121 return bioZArgs;
darienf 20:6d2af70c92ab 122 }
darienf 20:6d2af70c92ab 123 set
darienf 20:6d2af70c92ab 124 {
darienf 20:6d2af70c92ab 125 bioZArgs = value;
darienf 20:6d2af70c92ab 126 if (bioZArgs != null)
darienf 20:6d2af70c92ab 127 tbBiozParameters.Text = bioZArgs.ToCommandString();
darienf 20:6d2af70c92ab 128 else
darienf 20:6d2af70c92ab 129 tbBiozParameters.Text = "";
darienf 20:6d2af70c92ab 130 }
darienf 20:6d2af70c92ab 131 }
darienf 20:6d2af70c92ab 132 public InitArgs.RToRInitStart RToRArgs
darienf 20:6d2af70c92ab 133 {
darienf 20:6d2af70c92ab 134 get
darienf 20:6d2af70c92ab 135 {
darienf 20:6d2af70c92ab 136 return rToRArgs;
darienf 20:6d2af70c92ab 137 }
darienf 20:6d2af70c92ab 138 set
darienf 20:6d2af70c92ab 139 {
darienf 20:6d2af70c92ab 140 rToRArgs = value;
darienf 20:6d2af70c92ab 141 if (rToRArgs != null)
darienf 20:6d2af70c92ab 142 tbRtoRParameters.Text = rToRArgs.ToCommandString();
darienf 20:6d2af70c92ab 143 else
darienf 20:6d2af70c92ab 144 tbRtoRParameters.Text = "";
darienf 20:6d2af70c92ab 145 }
darienf 20:6d2af70c92ab 146 }
darienf 20:6d2af70c92ab 147 public InitArgs.PACEInitStart PaceArgs
darienf 20:6d2af70c92ab 148 {
darienf 20:6d2af70c92ab 149 get
darienf 20:6d2af70c92ab 150 {
darienf 20:6d2af70c92ab 151 return paceArgs;
darienf 20:6d2af70c92ab 152 }
darienf 20:6d2af70c92ab 153 set
darienf 20:6d2af70c92ab 154 {
darienf 20:6d2af70c92ab 155 paceArgs = value;
darienf 20:6d2af70c92ab 156 if (paceArgs != null)
darienf 20:6d2af70c92ab 157 tbPaceParameters.Text = paceArgs.ToCommandString();
darienf 20:6d2af70c92ab 158 else
darienf 20:6d2af70c92ab 159 tbPaceParameters.Text = "";
darienf 20:6d2af70c92ab 160 }
darienf 20:6d2af70c92ab 161 }
darienf 20:6d2af70c92ab 162 public InitArgs.FMSTRInitStart FMSTRArgs
darienf 20:6d2af70c92ab 163 {
darienf 20:6d2af70c92ab 164 get
darienf 20:6d2af70c92ab 165 {
darienf 20:6d2af70c92ab 166 return fmstrArgs;
darienf 20:6d2af70c92ab 167 }
darienf 20:6d2af70c92ab 168 set
darienf 20:6d2af70c92ab 169 {
darienf 20:6d2af70c92ab 170 fmstrArgs = value;
darienf 20:6d2af70c92ab 171 if (fmstrArgs != null && (ecgArgs != null || bioZArgs != null || rToRArgs != null || paceArgs != null))
darienf 20:6d2af70c92ab 172 tbFMSTRParameters.Text = fmstrArgs.ToCommandString();
darienf 20:6d2af70c92ab 173 else
darienf 20:6d2af70c92ab 174 tbFMSTRParameters.Text = "";
darienf 20:6d2af70c92ab 175 }
darienf 20:6d2af70c92ab 176 }
darienf 20:6d2af70c92ab 177 public InitArgs.SpO2HRModeInitStart SpO2HRModeArgs
darienf 20:6d2af70c92ab 178 {
darienf 20:6d2af70c92ab 179 get
darienf 20:6d2af70c92ab 180 {
darienf 20:6d2af70c92ab 181 return spO2HRModeArgs;
darienf 20:6d2af70c92ab 182 }
darienf 20:6d2af70c92ab 183 set
darienf 20:6d2af70c92ab 184 {
darienf 20:6d2af70c92ab 185 spO2HRModeArgs = value;
darienf 20:6d2af70c92ab 186 if (spO2HRModeArgs == null)
darienf 20:6d2af70c92ab 187 tbSpO2Parameters.Text = "";
darienf 20:6d2af70c92ab 188 else
darienf 20:6d2af70c92ab 189 tbSpO2Parameters.Text = spO2HRModeArgs.ToCommandString();
darienf 20:6d2af70c92ab 190 }
darienf 20:6d2af70c92ab 191 }
darienf 20:6d2af70c92ab 192 public InitArgs.HRModeInitStart HRModeArgs
darienf 20:6d2af70c92ab 193 {
darienf 20:6d2af70c92ab 194 get
darienf 20:6d2af70c92ab 195 {
darienf 20:6d2af70c92ab 196 return hrModeArgs;
darienf 20:6d2af70c92ab 197 }
darienf 20:6d2af70c92ab 198 set
darienf 20:6d2af70c92ab 199 {
darienf 20:6d2af70c92ab 200 hrModeArgs = value;
darienf 20:6d2af70c92ab 201 if (hrModeArgs == null)
darienf 20:6d2af70c92ab 202 tbHRParameters.Text = "";
darienf 20:6d2af70c92ab 203 else
darienf 20:6d2af70c92ab 204 tbHRParameters.Text = hrModeArgs.ToCommandString();
darienf 20:6d2af70c92ab 205 }
darienf 20:6d2af70c92ab 206 }
darienf 20:6d2af70c92ab 207 public InitArgs.MultiModeInitStart MultiModeArgs
darienf 20:6d2af70c92ab 208 {
darienf 20:6d2af70c92ab 209 get
darienf 20:6d2af70c92ab 210 {
darienf 20:6d2af70c92ab 211 return multiModeArgs;
darienf 20:6d2af70c92ab 212 }
darienf 20:6d2af70c92ab 213 set
darienf 20:6d2af70c92ab 214 {
darienf 20:6d2af70c92ab 215 multiModeArgs = value;
darienf 20:6d2af70c92ab 216 if (multiModeArgs != null)
darienf 20:6d2af70c92ab 217 tbMultiParameters.Text = multiModeArgs.ToCommandString();
darienf 20:6d2af70c92ab 218 else
darienf 20:6d2af70c92ab 219 tbMultiParameters.Text = "";
darienf 20:6d2af70c92ab 220 }
darienf 20:6d2af70c92ab 221 }
darienf 20:6d2af70c92ab 222
darienf 20:6d2af70c92ab 223 /* Setters and Getters attempting to disconnect the GUI controls from the internal code */
darienf 20:6d2af70c92ab 224 public bool EnableEcg
darienf 20:6d2af70c92ab 225 {
darienf 20:6d2af70c92ab 226 get
darienf 20:6d2af70c92ab 227 {
darienf 20:6d2af70c92ab 228 return ckbxEcg.Checked;
darienf 20:6d2af70c92ab 229 }
darienf 20:6d2af70c92ab 230 set
darienf 20:6d2af70c92ab 231 {
darienf 20:6d2af70c92ab 232 ckbxEcg.Checked = value;
darienf 20:6d2af70c92ab 233 }
darienf 20:6d2af70c92ab 234 }
darienf 20:6d2af70c92ab 235 public bool EnablePace
darienf 20:6d2af70c92ab 236 {
darienf 20:6d2af70c92ab 237 get
darienf 20:6d2af70c92ab 238 {
darienf 20:6d2af70c92ab 239 return ckbxPace.Checked;
darienf 20:6d2af70c92ab 240 }
darienf 20:6d2af70c92ab 241 set
darienf 20:6d2af70c92ab 242 {
darienf 20:6d2af70c92ab 243 ckbxPace.Checked = value;
darienf 20:6d2af70c92ab 244 }
darienf 20:6d2af70c92ab 245 }
darienf 20:6d2af70c92ab 246 public bool EnableBioz
darienf 20:6d2af70c92ab 247 {
darienf 20:6d2af70c92ab 248 get
darienf 20:6d2af70c92ab 249 {
darienf 20:6d2af70c92ab 250 return ckbxBioz.Checked;
darienf 20:6d2af70c92ab 251 }
darienf 20:6d2af70c92ab 252 set
darienf 20:6d2af70c92ab 253 {
darienf 20:6d2af70c92ab 254 ckbxBioz.Checked = value;
darienf 20:6d2af70c92ab 255 }
darienf 20:6d2af70c92ab 256 }
darienf 20:6d2af70c92ab 257 public bool EnableRToR
darienf 20:6d2af70c92ab 258 {
darienf 20:6d2af70c92ab 259 get
darienf 20:6d2af70c92ab 260 {
darienf 20:6d2af70c92ab 261 return ckbxRtoR.Checked;
darienf 20:6d2af70c92ab 262 }
darienf 20:6d2af70c92ab 263 set
darienf 20:6d2af70c92ab 264 {
darienf 20:6d2af70c92ab 265 ckbxRtoR.Checked = value;
darienf 20:6d2af70c92ab 266 }
darienf 20:6d2af70c92ab 267 }
darienf 20:6d2af70c92ab 268 public bool EnableFMSTR
darienf 20:6d2af70c92ab 269 {
darienf 20:6d2af70c92ab 270 get
darienf 20:6d2af70c92ab 271 {
darienf 20:6d2af70c92ab 272 return EnableEcg || EnableBioz || EnablePace || EnableRToR;
darienf 20:6d2af70c92ab 273 }
darienf 20:6d2af70c92ab 274 }
darienf 20:6d2af70c92ab 275 public bool EnableOpticalSpO2
darienf 20:6d2af70c92ab 276 {
darienf 20:6d2af70c92ab 277 get
darienf 20:6d2af70c92ab 278 {
darienf 20:6d2af70c92ab 279 return (string)cboOpticalMode.SelectedItem == "SpO2";
darienf 20:6d2af70c92ab 280 }
darienf 20:6d2af70c92ab 281 set
darienf 20:6d2af70c92ab 282 {
darienf 20:6d2af70c92ab 283 if (value)
darienf 20:6d2af70c92ab 284 cboOpticalMode.SelectedItem = "SpO2";
darienf 20:6d2af70c92ab 285 }
darienf 20:6d2af70c92ab 286 }
darienf 20:6d2af70c92ab 287 public bool EnableOpticalHR
darienf 20:6d2af70c92ab 288 {
darienf 20:6d2af70c92ab 289 get
darienf 20:6d2af70c92ab 290 {
darienf 20:6d2af70c92ab 291 return (string)cboOpticalMode.SelectedItem == "HR";
darienf 20:6d2af70c92ab 292 }
darienf 20:6d2af70c92ab 293 set
darienf 20:6d2af70c92ab 294 {
darienf 20:6d2af70c92ab 295 if (value)
darienf 20:6d2af70c92ab 296 cboOpticalMode.SelectedItem = "HR";
darienf 20:6d2af70c92ab 297 }
darienf 20:6d2af70c92ab 298 }
darienf 20:6d2af70c92ab 299 public bool EnableOpticalMulti
darienf 20:6d2af70c92ab 300 {
darienf 20:6d2af70c92ab 301 get
darienf 20:6d2af70c92ab 302 {
darienf 20:6d2af70c92ab 303 return (string)cboOpticalMode.SelectedItem == "Multi";
darienf 20:6d2af70c92ab 304 }
darienf 20:6d2af70c92ab 305 set
darienf 20:6d2af70c92ab 306 {
darienf 20:6d2af70c92ab 307 if (value)
darienf 20:6d2af70c92ab 308 cboOpticalMode.SelectedItem = "Multi";
darienf 20:6d2af70c92ab 309 }
darienf 20:6d2af70c92ab 310 }
darienf 20:6d2af70c92ab 311 public bool EnableTemperature1
darienf 20:6d2af70c92ab 312 {
darienf 20:6d2af70c92ab 313 get
darienf 20:6d2af70c92ab 314 {
darienf 20:6d2af70c92ab 315 return ckbxTemp1.Checked;
darienf 20:6d2af70c92ab 316 }
darienf 20:6d2af70c92ab 317 set
darienf 20:6d2af70c92ab 318 {
darienf 20:6d2af70c92ab 319 ckbxTemp1.Checked = value;
darienf 20:6d2af70c92ab 320 }
darienf 20:6d2af70c92ab 321 }
darienf 20:6d2af70c92ab 322 public bool EnableTemperature2
darienf 20:6d2af70c92ab 323 {
darienf 20:6d2af70c92ab 324 get
darienf 20:6d2af70c92ab 325 {
darienf 20:6d2af70c92ab 326 return ckbxTemp2.Checked;
darienf 20:6d2af70c92ab 327 }
darienf 20:6d2af70c92ab 328 set
darienf 20:6d2af70c92ab 329 {
darienf 20:6d2af70c92ab 330 ckbxTemp2.Checked = value;
darienf 20:6d2af70c92ab 331 }
darienf 20:6d2af70c92ab 332 }
darienf 20:6d2af70c92ab 333 public bool EnableAccelerometer
darienf 20:6d2af70c92ab 334 {
darienf 20:6d2af70c92ab 335 get
darienf 20:6d2af70c92ab 336 {
darienf 20:6d2af70c92ab 337 return ckbxAccel.Checked;
darienf 20:6d2af70c92ab 338 }
darienf 20:6d2af70c92ab 339 set
darienf 20:6d2af70c92ab 340 {
darienf 20:6d2af70c92ab 341 ckbxAccel.Checked = value;
darienf 20:6d2af70c92ab 342 }
darienf 20:6d2af70c92ab 343 }
darienf 20:6d2af70c92ab 344 public bool EnablePressure
darienf 20:6d2af70c92ab 345 {
darienf 20:6d2af70c92ab 346 get
darienf 20:6d2af70c92ab 347 {
darienf 20:6d2af70c92ab 348 return ckbxPressure.Checked;
darienf 20:6d2af70c92ab 349 }
darienf 20:6d2af70c92ab 350 set
darienf 20:6d2af70c92ab 351 {
darienf 20:6d2af70c92ab 352 ckbxPressure.Checked = value;
darienf 20:6d2af70c92ab 353 }
darienf 20:6d2af70c92ab 354 }
darienf 20:6d2af70c92ab 355
darienf 20:6d2af70c92ab 356 public int AccelSampleRate
darienf 20:6d2af70c92ab 357 {
darienf 20:6d2af70c92ab 358 get
darienf 20:6d2af70c92ab 359 {
darienf 20:6d2af70c92ab 360 return Int32.Parse((string)cboAccelSampleRate.SelectedItem);
darienf 20:6d2af70c92ab 361 }
darienf 20:6d2af70c92ab 362 }
darienf 20:6d2af70c92ab 363
darienf 20:6d2af70c92ab 364 /* Delegates */
darienf 20:6d2af70c92ab 365 public delegate InitArgs.EcgInitStart GetEcgInitArgs();
darienf 20:6d2af70c92ab 366 public delegate InitArgs.RToRInitStart GetRToRInitArgs();
darienf 20:6d2af70c92ab 367 public delegate InitArgs.BIOZInitStart GetBioZInitArgs();
darienf 20:6d2af70c92ab 368 public delegate InitArgs.PACEInitStart GetPaceInitArgs();
darienf 20:6d2af70c92ab 369 public delegate InitArgs.FMSTRInitStart GetFMSTRInitArgs();
darienf 20:6d2af70c92ab 370 public delegate InitArgs.HRModeInitStart GetHRModeInitArgs();
darienf 20:6d2af70c92ab 371 public delegate InitArgs.SpO2HRModeInitStart GetSpO2HRModeInitArgs();
darienf 20:6d2af70c92ab 372 public delegate InitArgs.MultiModeInitStart GetMultiModeInitArgs();
darienf 20:6d2af70c92ab 373
darienf 20:6d2af70c92ab 374 public delegate void LoggingParametersHandler(object sender, EventArgs e);
darienf 20:6d2af70c92ab 375
darienf 20:6d2af70c92ab 376 /* Events */
darienf 20:6d2af70c92ab 377 public event LoggingParametersHandler LoggingParametersChanged;
darienf 20:6d2af70c92ab 378
darienf 20:6d2af70c92ab 379 private void LoggingView_Load(object sender, EventArgs e)
darienf 20:6d2af70c92ab 380 {
darienf 20:6d2af70c92ab 381 cboOpticalMode.SelectedIndex = 0;
darienf 20:6d2af70c92ab 382 cboAccelSampleRate.SelectedIndex = 0;
darienf 20:6d2af70c92ab 383 }
darienf 20:6d2af70c92ab 384
darienf 20:6d2af70c92ab 385 private void btnRead_Click(object sender, EventArgs e)
darienf 20:6d2af70c92ab 386 {
darienf 20:6d2af70c92ab 387 if (MissionRead != null)
darienf 20:6d2af70c92ab 388 MissionRead(this, e);
darienf 20:6d2af70c92ab 389
darienf 20:6d2af70c92ab 390 if (Connected)
darienf 20:6d2af70c92ab 391 {
darienf 20:6d2af70c92ab 392 if (LoggingParametersChanged != null)
darienf 20:6d2af70c92ab 393 LoggingParametersChanged(this, EventArgs.Empty);
darienf 20:6d2af70c92ab 394
darienf 20:6d2af70c92ab 395 //btnWrite.Enabled = false;
darienf 20:6d2af70c92ab 396 }
darienf 20:6d2af70c92ab 397 }
darienf 20:6d2af70c92ab 398
darienf 20:6d2af70c92ab 399 private void btnErase_Click(object sender, EventArgs e)
darienf 20:6d2af70c92ab 400 {
darienf 20:6d2af70c92ab 401 if (MissionErase != null)
darienf 20:6d2af70c92ab 402 {
darienf 20:6d2af70c92ab 403 MissionErase(this, e);
darienf 20:6d2af70c92ab 404 }
darienf 20:6d2af70c92ab 405 }
darienf 20:6d2af70c92ab 406
darienf 20:6d2af70c92ab 407 private void btnWrite_Click(object sender, EventArgs e)
darienf 20:6d2af70c92ab 408 {
darienf 20:6d2af70c92ab 409 if (MissionWrite != null)
darienf 20:6d2af70c92ab 410 {
darienf 20:6d2af70c92ab 411 MissionWrite(this, e);
darienf 20:6d2af70c92ab 412 }
darienf 20:6d2af70c92ab 413 }
darienf 20:6d2af70c92ab 414
darienf 20:6d2af70c92ab 415 private void btnTestMission_Click(object sender, EventArgs e)
darienf 20:6d2af70c92ab 416 {
darienf 20:6d2af70c92ab 417 rpcClient.DataLogging.TestMission();
darienf 20:6d2af70c92ab 418 }
darienf 20:6d2af70c92ab 419
darienf 20:6d2af70c92ab 420 private void btnTestWriteLogMemory_Click(object sender, EventArgs e)
darienf 20:6d2af70c92ab 421 {
darienf 20:6d2af70c92ab 422 //Process
darienf 20:6d2af70c92ab 423 //rpcClient.DataLogging.TestWriteLog();
darienf 20:6d2af70c92ab 424 }
darienf 20:6d2af70c92ab 425
darienf 20:6d2af70c92ab 426 private void btnTestReadLogMemory_Click(object sender, EventArgs e)
darienf 20:6d2af70c92ab 427 {
darienf 20:6d2af70c92ab 428 rpcClient.DataLogging.TestReadLog();
darienf 20:6d2af70c92ab 429 }
darienf 20:6d2af70c92ab 430
darienf 20:6d2af70c92ab 431 private void btnBulkErase_Click(object sender, EventArgs e)
darienf 20:6d2af70c92ab 432 {
darienf 20:6d2af70c92ab 433 rpcClient.DataLogging.TestBulkErase();
darienf 20:6d2af70c92ab 434 }
darienf 20:6d2af70c92ab 435
darienf 20:6d2af70c92ab 436 private void btnLogSectorsErase_Click(object sender, EventArgs e)
darienf 20:6d2af70c92ab 437 {
darienf 20:6d2af70c92ab 438 rpcClient.DataLogging.TestLogSectorsErase();
darienf 20:6d2af70c92ab 439 }
darienf 20:6d2af70c92ab 440
darienf 20:6d2af70c92ab 441 private int[] ParseHexString(String hexStr)
darienf 20:6d2af70c92ab 442 {
darienf 20:6d2af70c92ab 443 int val;
darienf 20:6d2af70c92ab 444 List<int> intList = new List<int>();
darienf 20:6d2af70c92ab 445 String[] strings = hexStr.Split(new char[] { ' ' });
darienf 20:6d2af70c92ab 446 foreach (String str in strings)
darienf 20:6d2af70c92ab 447 {
darienf 20:6d2af70c92ab 448 if (int.TryParse(str, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out val))
darienf 20:6d2af70c92ab 449 {
darienf 20:6d2af70c92ab 450 intList.Add(val);
darienf 20:6d2af70c92ab 451 }
darienf 20:6d2af70c92ab 452 else
darienf 20:6d2af70c92ab 453 {
darienf 20:6d2af70c92ab 454 throw new Exception(String.Format("Error In hex string \"{0}\" in \"{1}\"", str, hexStr));
darienf 20:6d2af70c92ab 455 }
darienf 20:6d2af70c92ab 456 }
darienf 20:6d2af70c92ab 457 return intList.ToArray();
darienf 20:6d2af70c92ab 458 }
darienf 20:6d2af70c92ab 459
darienf 20:6d2af70c92ab 460 /// <summary>
darienf 20:6d2af70c92ab 461 /// Write GUI elements to flash
darienf 20:6d2af70c92ab 462 /// Call ValidateGuiElements() to verify user input acceptable before calling ProcessGuiElements()
darienf 20:6d2af70c92ab 463 /// </summary>
darienf 20:6d2af70c92ab 464 public bool ProcessGuiElements()
darienf 20:6d2af70c92ab 465 {
darienf 20:6d2af70c92ab 466 int[] temperature1 = new int[1] {10};
darienf 20:6d2af70c92ab 467 int[] temperature2 = new int[1] {10};
darienf 20:6d2af70c92ab 468 int[] barometer = new int[1];
darienf 20:6d2af70c92ab 469
darienf 20:6d2af70c92ab 470 if (EnableTemperature1)
darienf 20:6d2af70c92ab 471 temperature1[0] = Int32.Parse(txtTemp1SampleTime.Text.Trim());
darienf 20:6d2af70c92ab 472 if (EnableTemperature2)
darienf 20:6d2af70c92ab 473 temperature2[0] = Int32.Parse(txtTemp2SampleTime.Text.Trim());
darienf 20:6d2af70c92ab 474 if (EnablePressure)
darienf 20:6d2af70c92ab 475 barometer[0] = Int32.Parse(txtPressureSampleTime.Text.Trim());
darienf 20:6d2af70c92ab 476
darienf 20:6d2af70c92ab 477 // Pre Commands
darienf 20:6d2af70c92ab 478 rpcClient.DataLogging.PreCommand.Define(tbPreCmd.Text.Trim());
darienf 20:6d2af70c92ab 479 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.PreCommand);
darienf 20:6d2af70c92ab 480 // ecg
darienf 20:6d2af70c92ab 481 if (EnableEcg)
darienf 20:6d2af70c92ab 482 {
darienf 20:6d2af70c92ab 483 InitArgs.EcgInitStart ecgArgs = GetEcgInitArgsPointer();
darienf 20:6d2af70c92ab 484 //rpcClient.DataLogging.MAX30001_Ecg.AssignByIntArray(ParseHexString(tbEcgParameters.Text));
darienf 20:6d2af70c92ab 485 rpcClient.DataLogging.MAX30001_Ecg.AssignByValue(
darienf 20:6d2af70c92ab 486 1, //ecgArgs.En_ecg,
darienf 20:6d2af70c92ab 487 ecgArgs.Openp,
darienf 20:6d2af70c92ab 488 ecgArgs.Openn,
darienf 20:6d2af70c92ab 489 ecgArgs.Pol,
darienf 20:6d2af70c92ab 490 ecgArgs.Calp_sel,
darienf 20:6d2af70c92ab 491 ecgArgs.Caln_sel,
darienf 20:6d2af70c92ab 492 ecgArgs.E_fit,
darienf 20:6d2af70c92ab 493 ecgArgs.Rate,
darienf 20:6d2af70c92ab 494 ecgArgs.Gain,
darienf 20:6d2af70c92ab 495 ecgArgs.Dhpf,
darienf 20:6d2af70c92ab 496 ecgArgs.Dlpf
darienf 20:6d2af70c92ab 497 );
darienf 20:6d2af70c92ab 498 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.MAX30001_Ecg);
darienf 20:6d2af70c92ab 499 }
darienf 20:6d2af70c92ab 500 // pace
darienf 20:6d2af70c92ab 501 if (EnablePace)
darienf 20:6d2af70c92ab 502 {
darienf 20:6d2af70c92ab 503 InitArgs.PACEInitStart paceArgs = GetPaceInitArgsPointer();
darienf 20:6d2af70c92ab 504 //rpcClient.DataLogging.MAX30001_Pace.AssignByIntArray(ParseHexString(tbPaceParameters.Text));
darienf 20:6d2af70c92ab 505 rpcClient.DataLogging.MAX30001_Pace.AssignByValue(
darienf 20:6d2af70c92ab 506 1,//paceArgs.En_pace,
darienf 20:6d2af70c92ab 507 paceArgs.Clr_pedge,
darienf 20:6d2af70c92ab 508 paceArgs.Pol,
darienf 20:6d2af70c92ab 509 paceArgs.Gn_diff_off,
darienf 20:6d2af70c92ab 510 paceArgs.Gain,
darienf 20:6d2af70c92ab 511 paceArgs.Aout_lbw,
darienf 20:6d2af70c92ab 512 paceArgs.Aout,
darienf 20:6d2af70c92ab 513 paceArgs.Dacp,
darienf 20:6d2af70c92ab 514 paceArgs.Dacn
darienf 20:6d2af70c92ab 515 );
darienf 20:6d2af70c92ab 516 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.MAX30001_Pace);
darienf 20:6d2af70c92ab 517 }
darienf 20:6d2af70c92ab 518 // bioz
darienf 20:6d2af70c92ab 519 if (EnableBioz)
darienf 20:6d2af70c92ab 520 {
darienf 20:6d2af70c92ab 521 InitArgs.BIOZInitStart biozArgs = GetBioZInitArgsPointer();
darienf 20:6d2af70c92ab 522 //rpcClient.DataLogging.MAX30001_Bioz.AssignByIntArray(ParseHexString(tbBiozParameters.Text));
darienf 20:6d2af70c92ab 523 rpcClient.DataLogging.MAX30001_Bioz.AssignByValue(
darienf 20:6d2af70c92ab 524 1, //biozArgs.En_bioz,
darienf 20:6d2af70c92ab 525 biozArgs.Openp,
darienf 20:6d2af70c92ab 526 biozArgs.Openn,
darienf 20:6d2af70c92ab 527 biozArgs.Calp_sel,
darienf 20:6d2af70c92ab 528 biozArgs.Caln_sel,
darienf 20:6d2af70c92ab 529 biozArgs.CG_mode,
darienf 20:6d2af70c92ab 530 biozArgs.B_fit,
darienf 20:6d2af70c92ab 531 biozArgs.Rate,
darienf 20:6d2af70c92ab 532 biozArgs.Ahpf,
darienf 20:6d2af70c92ab 533 biozArgs.Ext_rbias,
darienf 20:6d2af70c92ab 534 biozArgs.Gain,
darienf 20:6d2af70c92ab 535 biozArgs.Dhpf,
darienf 20:6d2af70c92ab 536 biozArgs.Dlpf,
darienf 20:6d2af70c92ab 537 biozArgs.Fcgen,
darienf 20:6d2af70c92ab 538 biozArgs.Cgmon,
darienf 20:6d2af70c92ab 539 biozArgs.Cgmag,
darienf 20:6d2af70c92ab 540 biozArgs.Phoff
darienf 20:6d2af70c92ab 541 );
darienf 20:6d2af70c92ab 542 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.MAX30001_Bioz);
darienf 20:6d2af70c92ab 543 }
darienf 20:6d2af70c92ab 544 // RtoR
darienf 20:6d2af70c92ab 545 if (EnableRToR)
darienf 20:6d2af70c92ab 546 {
darienf 20:6d2af70c92ab 547 InitArgs.RToRInitStart rtorArgs = GetRToRInitArgsPointer();
darienf 20:6d2af70c92ab 548 //rpcClient.DataLogging.MAX30001_RtoR.AssignByIntArray(ParseHexString(tbRtoRParameters.Text));
darienf 20:6d2af70c92ab 549 rpcClient.DataLogging.MAX30001_RtoR.AssignByValue(
darienf 20:6d2af70c92ab 550 1, //rtorArgs.En_rtor,
darienf 20:6d2af70c92ab 551 rtorArgs.Wndw,
darienf 20:6d2af70c92ab 552 rtorArgs.Gain,
darienf 20:6d2af70c92ab 553 rtorArgs.Pavg,
darienf 20:6d2af70c92ab 554 rtorArgs.Ptsf,
darienf 20:6d2af70c92ab 555 rtorArgs.Hoff,
darienf 20:6d2af70c92ab 556 rtorArgs.Ravg,
darienf 20:6d2af70c92ab 557 rtorArgs.Rhsf,
darienf 20:6d2af70c92ab 558 rtorArgs.Clr_rrint
darienf 20:6d2af70c92ab 559 );
darienf 20:6d2af70c92ab 560 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.MAX30001_RtoR);
darienf 20:6d2af70c92ab 561 }
darienf 20:6d2af70c92ab 562 // SpO2
darienf 20:6d2af70c92ab 563 if (EnableOpticalSpO2)
darienf 20:6d2af70c92ab 564 {
darienf 20:6d2af70c92ab 565 rpcClient.DataLogging.MAX30101_SpO2.AssignByIntArray(ParseHexString(tbSpO2Parameters.Text));
darienf 20:6d2af70c92ab 566 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.MAX30101_SpO2);
darienf 20:6d2af70c92ab 567 }
darienf 20:6d2af70c92ab 568 // HR
darienf 20:6d2af70c92ab 569 if (EnableOpticalHR)
darienf 20:6d2af70c92ab 570 {
darienf 20:6d2af70c92ab 571 rpcClient.DataLogging.MAX30101_HR.AssignByIntArray(ParseHexString(tbHRParameters.Text));
darienf 20:6d2af70c92ab 572 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.MAX30101_HR);
darienf 20:6d2af70c92ab 573 }
darienf 20:6d2af70c92ab 574 // Multi
darienf 20:6d2af70c92ab 575 if (EnableOpticalMulti)
darienf 20:6d2af70c92ab 576 {
darienf 20:6d2af70c92ab 577 rpcClient.DataLogging.MAX30101_Multi.AssignByIntArray(ParseHexString(tbMultiParameters.Text));
darienf 20:6d2af70c92ab 578 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.MAX30101_Multi);
darienf 20:6d2af70c92ab 579 }
darienf 20:6d2af70c92ab 580 // Temp1
darienf 20:6d2af70c92ab 581 if (EnableTemperature1)
darienf 20:6d2af70c92ab 582 {
darienf 20:6d2af70c92ab 583 rpcClient.DataLogging.MAX31725_1.AssignByIntArray(temperature1);
darienf 20:6d2af70c92ab 584 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.MAX31725_1);
darienf 20:6d2af70c92ab 585 }
darienf 20:6d2af70c92ab 586 // Temp2
darienf 20:6d2af70c92ab 587 if (EnableTemperature2)
darienf 20:6d2af70c92ab 588 {
darienf 20:6d2af70c92ab 589 rpcClient.DataLogging.MAX31725_2.AssignByIntArray(temperature2);
darienf 20:6d2af70c92ab 590 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.MAX31725_2);
darienf 20:6d2af70c92ab 591 }
darienf 20:6d2af70c92ab 592 // Accel
darienf 20:6d2af70c92ab 593 if (EnableAccelerometer)
darienf 20:6d2af70c92ab 594 {
darienf 20:6d2af70c92ab 595 rpcClient.DataLogging.LIS2DH.AssignByIntArray(new int[] {cboAccelSampleRate.SelectedIndex + 1, 15}); // FIFO depth is second parameter
darienf 20:6d2af70c92ab 596 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.LIS2DH);
darienf 20:6d2af70c92ab 597 }
darienf 20:6d2af70c92ab 598 // Pressure
darienf 20:6d2af70c92ab 599 if (EnablePressure)
darienf 20:6d2af70c92ab 600 {
darienf 20:6d2af70c92ab 601 rpcClient.DataLogging.BMP280.AssignByIntArray(barometer);
darienf 20:6d2af70c92ab 602 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.BMP280);
darienf 20:6d2af70c92ab 603 }
darienf 20:6d2af70c92ab 604
darienf 20:6d2af70c92ab 605 // add Rbias if we are using any of the MAX30001 commands
darienf 20:6d2af70c92ab 606 if (EnableEcg || EnableBioz || EnablePace || EnableRToR)
darienf 20:6d2af70c92ab 607 {
darienf 20:6d2af70c92ab 608 //rpcClient.DataLogging.MAX30001_Rbias.Define("/MAX30001/Rbias_FMSTR_Init 01 02 01 01 00");
darienf 20:6d2af70c92ab 609 rpcClient.DataLogging.MAX30001_Rbias_Fmstr.AssignByIntArray(ParseHexString(tbFMSTRParameters.Text));
darienf 20:6d2af70c92ab 610 //rpcClient.DataLogging.MAX30001_Rbias.Define("/MAX30001/Rbias_FMSTR_Init " + tbFMSTRParameters.Text);
darienf 20:6d2af70c92ab 611 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.MAX30001_Rbias_Fmstr);
darienf 20:6d2af70c92ab 612 }
darienf 20:6d2af70c92ab 613 // Post Commands
darienf 20:6d2af70c92ab 614 rpcClient.DataLogging.PostCommand.Define(tbPostCmd.Text.Trim());
darienf 20:6d2af70c92ab 615 rpcClient.DataLogging.MissionAppend(rpcClient.DataLogging.PostCommand);
darienf 20:6d2af70c92ab 616
darienf 20:6d2af70c92ab 617 return true;
darienf 20:6d2af70c92ab 618 }
darienf 20:6d2af70c92ab 619
darienf 20:6d2af70c92ab 620 public bool ValidateGuiElements()
darienf 20:6d2af70c92ab 621 {
darienf 20:6d2af70c92ab 622 const int MaxTime = 1000; // TODO Ask Jerry to calculate the 16 bit timer limit
darienf 20:6d2af70c92ab 623 const int MinTime = 0;
darienf 20:6d2af70c92ab 624 const int MinRecommendedTempTime = 10;
darienf 20:6d2af70c92ab 625 int[] temperature1 = new int[1] { 10 };
darienf 20:6d2af70c92ab 626 int[] temperature2 = new int[1] { 10 };
darienf 20:6d2af70c92ab 627 int[] barometer = new int[1];
darienf 20:6d2af70c92ab 628
darienf 20:6d2af70c92ab 629 try
darienf 20:6d2af70c92ab 630 {
darienf 20:6d2af70c92ab 631 if (EnableTemperature1)
darienf 20:6d2af70c92ab 632 temperature1[0] = Int32.Parse(txtTemp1SampleTime.Text.Trim());
darienf 20:6d2af70c92ab 633 if (EnableTemperature2)
darienf 20:6d2af70c92ab 634 temperature2[0] = Int32.Parse(txtTemp2SampleTime.Text.Trim());
darienf 20:6d2af70c92ab 635 if (EnablePressure)
darienf 20:6d2af70c92ab 636 barometer[0] = Int32.Parse(txtPressureSampleTime.Text.Trim());
darienf 20:6d2af70c92ab 637 // TODO Limit Max and Min Range
darienf 20:6d2af70c92ab 638 if (temperature1[0] > MaxTime || temperature2[0] > MaxTime || barometer[0] > MaxTime)
darienf 20:6d2af70c92ab 639 {
darienf 20:6d2af70c92ab 640 MessageBox.Show("Time value cannot be larger than " + MaxTime);
darienf 20:6d2af70c92ab 641 }
darienf 20:6d2af70c92ab 642 else if (temperature1[0] < MinTime || temperature2[0] < MinTime || barometer[0] < MinTime)
darienf 20:6d2af70c92ab 643 {
darienf 20:6d2af70c92ab 644 MessageBox.Show("Time value cannot be less than " + MinTime);
darienf 20:6d2af70c92ab 645 }
darienf 20:6d2af70c92ab 646 else if (temperature1[0] < MinRecommendedTempTime || temperature2[0] < MinRecommendedTempTime)
darienf 20:6d2af70c92ab 647 {
darienf 20:6d2af70c92ab 648 MessageBox.Show("The recommended temperature sample period is >" + MinRecommendedTempTime + " seconds due to self heating effects.", "Warning");
darienf 20:6d2af70c92ab 649 }
darienf 20:6d2af70c92ab 650 }
darienf 20:6d2af70c92ab 651 catch (Exception)
darienf 20:6d2af70c92ab 652 {
darienf 20:6d2af70c92ab 653 if (EnableTemperature1 || EnableTemperature2 || EnablePressure)
darienf 20:6d2af70c92ab 654 {
darienf 20:6d2af70c92ab 655 MessageBox.Show("Temperature 1 & 2 and Barometer must contain only digits", "Sample Rates");
darienf 20:6d2af70c92ab 656 return false;
darienf 20:6d2af70c92ab 657 }
darienf 20:6d2af70c92ab 658 }
darienf 20:6d2af70c92ab 659
darienf 20:6d2af70c92ab 660 return true;
darienf 20:6d2af70c92ab 661 }
darienf 20:6d2af70c92ab 662
darienf 20:6d2af70c92ab 663
darienf 20:6d2af70c92ab 664 /// <summary>
darienf 20:6d2af70c92ab 665 /// Update GUI with data read from flash
darienf 20:6d2af70c92ab 666 /// </summary>
darienf 20:6d2af70c92ab 667 public void UpdateGuiElements(Mission missionSettings)
darienf 20:6d2af70c92ab 668 {
darienf 20:6d2af70c92ab 669 internalUpdate = true;
darienf 20:6d2af70c92ab 670
darienf 20:6d2af70c92ab 671 // Set optical state to none
darienf 20:6d2af70c92ab 672 cboOpticalMode.SelectedIndex = 0;
darienf 20:6d2af70c92ab 673
darienf 20:6d2af70c92ab 674 // pre cmd
darienf 20:6d2af70c92ab 675 tbPreCmd.Text = missionSettings.PreCommand;
darienf 20:6d2af70c92ab 676 // ecg
darienf 20:6d2af70c92ab 677 EnableEcg = missionSettings.EnableEcg;
darienf 20:6d2af70c92ab 678 if (EnableEcg)
darienf 20:6d2af70c92ab 679 EcgArgs = EcgArgs.FromIntArray(missionSettings.EcgArgs);
darienf 20:6d2af70c92ab 680 else
darienf 20:6d2af70c92ab 681 EcgArgs = null;
darienf 20:6d2af70c92ab 682 // pace
darienf 20:6d2af70c92ab 683 EnablePace = missionSettings.EnablePace;
darienf 20:6d2af70c92ab 684 if (EnablePace)
darienf 20:6d2af70c92ab 685 PaceArgs = PaceArgs.FromIntArray(missionSettings.PaceArgs);
darienf 20:6d2af70c92ab 686 else
darienf 20:6d2af70c92ab 687 PaceArgs = null;
darienf 20:6d2af70c92ab 688 // bioz
darienf 20:6d2af70c92ab 689 EnableBioz = missionSettings.EnableBioZ;
darienf 20:6d2af70c92ab 690 if (EnableBioz)
darienf 20:6d2af70c92ab 691 BioZArgs = BioZArgs.FromIntArray(missionSettings.BioZArgs);
darienf 20:6d2af70c92ab 692 else
darienf 20:6d2af70c92ab 693 BioZArgs = null;
darienf 20:6d2af70c92ab 694 // RtoR
darienf 20:6d2af70c92ab 695 EnableRToR = missionSettings.EnableRToR;
darienf 20:6d2af70c92ab 696 if (EnableRToR)
darienf 20:6d2af70c92ab 697 RToRArgs = RToRArgs.FromIntArray(missionSettings.RToRArgs);
darienf 20:6d2af70c92ab 698 else
darienf 20:6d2af70c92ab 699 RToRArgs = null;
darienf 20:6d2af70c92ab 700 // Rbias, FMSTR
darienf 20:6d2af70c92ab 701 if (EnableFMSTR && missionSettings.EnableRBias) // Only applies when OT90 is used
darienf 20:6d2af70c92ab 702 FMSTRArgs = FMSTRArgs.FromIntArray(missionSettings.RBiasArgs);
darienf 20:6d2af70c92ab 703 else
darienf 20:6d2af70c92ab 704 FMSTRArgs = null;
darienf 20:6d2af70c92ab 705 // SpO2, HR
darienf 20:6d2af70c92ab 706 EnableOpticalSpO2 = missionSettings.EnableOpticalSpO2;
darienf 20:6d2af70c92ab 707 if (EnableOpticalSpO2)
darienf 20:6d2af70c92ab 708 SpO2HRModeArgs = SpO2HRModeArgs.FromIntArray(missionSettings.SpO2HRModeArgs);
darienf 20:6d2af70c92ab 709 else
darienf 20:6d2af70c92ab 710 SpO2HRModeArgs = null;
darienf 20:6d2af70c92ab 711 EnableOpticalHR = missionSettings.EnableOpticalHR;
darienf 20:6d2af70c92ab 712 if (EnableOpticalHR)
darienf 20:6d2af70c92ab 713 HRModeArgs = HRModeArgs.FromIntArray(missionSettings.HRModeArgs);
darienf 20:6d2af70c92ab 714 else
darienf 20:6d2af70c92ab 715 HRModeArgs = null;
darienf 20:6d2af70c92ab 716 // Multi
darienf 20:6d2af70c92ab 717 EnableOpticalMulti = missionSettings.EnableOpticalMulti;
darienf 20:6d2af70c92ab 718 if (EnableOpticalMulti)
darienf 20:6d2af70c92ab 719 MultiModeArgs = MultiModeArgs.FromIntArray(missionSettings.MultiModeArgs);
darienf 20:6d2af70c92ab 720 else
darienf 20:6d2af70c92ab 721 MultiModeArgs = null;
darienf 20:6d2af70c92ab 722
darienf 20:6d2af70c92ab 723 if (EnableOpticalSpO2)
darienf 20:6d2af70c92ab 724 {
darienf 20:6d2af70c92ab 725 cboOpticalMode.SelectedItem = "SpO2";
darienf 20:6d2af70c92ab 726 }
darienf 20:6d2af70c92ab 727 else if (EnableOpticalHR)
darienf 20:6d2af70c92ab 728 {
darienf 20:6d2af70c92ab 729 cboOpticalMode.SelectedItem = "HR";
darienf 20:6d2af70c92ab 730 }
darienf 20:6d2af70c92ab 731 else if (EnableOpticalMulti)
darienf 20:6d2af70c92ab 732 {
darienf 20:6d2af70c92ab 733 cboOpticalMode.SelectedItem = "Multi";
darienf 20:6d2af70c92ab 734 }
darienf 20:6d2af70c92ab 735 else
darienf 20:6d2af70c92ab 736 {
darienf 20:6d2af70c92ab 737 cboOpticalMode.SelectedItem = "None";
darienf 20:6d2af70c92ab 738 }
darienf 20:6d2af70c92ab 739
darienf 20:6d2af70c92ab 740 /* These Parameters to not effect the other GUI tabs, thus are not accessible in a property field */
darienf 20:6d2af70c92ab 741 // Temp1
darienf 20:6d2af70c92ab 742 EnableTemperature1 = missionSettings.EnableTemperature1;
darienf 20:6d2af70c92ab 743 txtTemp1SampleTime.Text = EnableTemperature1 ? missionSettings.Temperature1Parameters[0].ToString() : "";
darienf 20:6d2af70c92ab 744 // Temp2
darienf 20:6d2af70c92ab 745 EnableTemperature2 = missionSettings.EnableTemperature2;
darienf 20:6d2af70c92ab 746 txtTemp2SampleTime.Text = EnableTemperature2 ? missionSettings.Temperature2Parameters[0].ToString() : "";
darienf 20:6d2af70c92ab 747 // Accel
darienf 20:6d2af70c92ab 748 EnableAccelerometer = missionSettings.EnableAccelerometer;
darienf 20:6d2af70c92ab 749 cboAccelSampleRate.SelectedIndex = EnableAccelerometer ? missionSettings.AccelerometerParameters[0] - 1 : 0;
darienf 20:6d2af70c92ab 750 // Pressure
darienf 20:6d2af70c92ab 751 EnablePressure = missionSettings.EnablePressure;
darienf 20:6d2af70c92ab 752 txtPressureSampleTime.Text = EnablePressure ? missionSettings.PressureParameters[0].ToString() : "";
darienf 20:6d2af70c92ab 753 // post cmd
darienf 20:6d2af70c92ab 754 tbPostCmd.Text = missionSettings.PostCommand;
darienf 20:6d2af70c92ab 755
darienf 20:6d2af70c92ab 756 internalUpdate = false;
darienf 20:6d2af70c92ab 757 }
darienf 20:6d2af70c92ab 758
darienf 20:6d2af70c92ab 759 /// <summary>
darienf 20:6d2af70c92ab 760 /// Update the logging parameters
darienf 20:6d2af70c92ab 761 /// </summary>
darienf 20:6d2af70c92ab 762 public void UpdateArgs()
darienf 20:6d2af70c92ab 763 {
darienf 20:6d2af70c92ab 764 updateArgsOT90();
darienf 20:6d2af70c92ab 765 updateArgsOS24();
darienf 20:6d2af70c92ab 766 }
darienf 20:6d2af70c92ab 767
darienf 20:6d2af70c92ab 768 private void updateArgsOT90()
darienf 20:6d2af70c92ab 769 {
darienf 20:6d2af70c92ab 770 InitArgs.EcgInitStart eargs;
darienf 20:6d2af70c92ab 771 InitArgs.BIOZInitStart bargs;
darienf 20:6d2af70c92ab 772 InitArgs.RToRInitStart rargs;
darienf 20:6d2af70c92ab 773 InitArgs.PACEInitStart pargs;
darienf 20:6d2af70c92ab 774 InitArgs.FMSTRInitStart fargs;
darienf 20:6d2af70c92ab 775
darienf 20:6d2af70c92ab 776 //btnWrite.Enabled = true;
darienf 20:6d2af70c92ab 777
darienf 20:6d2af70c92ab 778 // Override enable bit since if command is being sent, this should be set to 1
darienf 20:6d2af70c92ab 779 // based the data logging enable bit and not the GUI tab enable controls
darienf 20:6d2af70c92ab 780 if (GetEcgInitArgsPointer != null)
darienf 20:6d2af70c92ab 781 {
darienf 20:6d2af70c92ab 782 eargs = GetEcgInitArgsPointer();
darienf 20:6d2af70c92ab 783 eargs.En_ecg = 1;
darienf 20:6d2af70c92ab 784
darienf 20:6d2af70c92ab 785 EcgArgs = eargs;
darienf 20:6d2af70c92ab 786 }
darienf 20:6d2af70c92ab 787
darienf 20:6d2af70c92ab 788 if (GetBioZInitArgsPointer != null)
darienf 20:6d2af70c92ab 789 {
darienf 20:6d2af70c92ab 790 bargs = GetBioZInitArgsPointer();
darienf 20:6d2af70c92ab 791 bargs.En_bioz = 1;
darienf 20:6d2af70c92ab 792
darienf 20:6d2af70c92ab 793 BioZArgs = bargs;
darienf 20:6d2af70c92ab 794 }
darienf 20:6d2af70c92ab 795
darienf 20:6d2af70c92ab 796 if (GetRToRInitArgsPointer != null)
darienf 20:6d2af70c92ab 797 {
darienf 20:6d2af70c92ab 798 rargs = GetRToRInitArgsPointer();
darienf 20:6d2af70c92ab 799 rargs.En_rtor = 1;
darienf 20:6d2af70c92ab 800
darienf 20:6d2af70c92ab 801 RToRArgs = rargs;
darienf 20:6d2af70c92ab 802 }
darienf 20:6d2af70c92ab 803
darienf 20:6d2af70c92ab 804 if (GetPaceInitArgsPointer != null)
darienf 20:6d2af70c92ab 805 {
darienf 20:6d2af70c92ab 806 pargs = GetPaceInitArgsPointer();
darienf 20:6d2af70c92ab 807 pargs.En_pace = 1;
darienf 20:6d2af70c92ab 808
darienf 20:6d2af70c92ab 809 PaceArgs = pargs;
darienf 20:6d2af70c92ab 810 }
darienf 20:6d2af70c92ab 811
darienf 20:6d2af70c92ab 812 if (GetFMSTRInitArgsPointer != null)
darienf 20:6d2af70c92ab 813 {
darienf 20:6d2af70c92ab 814 fargs = GetFMSTRInitArgsPointer();
darienf 20:6d2af70c92ab 815
darienf 20:6d2af70c92ab 816 FMSTRArgs = fargs;
darienf 20:6d2af70c92ab 817 }
darienf 20:6d2af70c92ab 818
darienf 20:6d2af70c92ab 819 }
darienf 20:6d2af70c92ab 820
darienf 20:6d2af70c92ab 821 private void updateArgsOS24()
darienf 20:6d2af70c92ab 822 {
darienf 20:6d2af70c92ab 823 if (GetSpO2HRModeInitArgsPointer != null)
darienf 20:6d2af70c92ab 824 {
darienf 20:6d2af70c92ab 825 SpO2HRModeArgs = GetSpO2HRModeInitArgsPointer();
darienf 20:6d2af70c92ab 826 }
darienf 20:6d2af70c92ab 827
darienf 20:6d2af70c92ab 828 if (GetHRModeInitArgsPointer != null)
darienf 20:6d2af70c92ab 829 {
darienf 20:6d2af70c92ab 830 HRModeArgs = GetHRModeInitArgsPointer();
darienf 20:6d2af70c92ab 831 }
darienf 20:6d2af70c92ab 832
darienf 20:6d2af70c92ab 833 if (GetMultiModeInitArgsPointer != null)
darienf 20:6d2af70c92ab 834 {
darienf 20:6d2af70c92ab 835 MultiModeArgs = GetMultiModeInitArgsPointer();
darienf 20:6d2af70c92ab 836 }
darienf 20:6d2af70c92ab 837
darienf 20:6d2af70c92ab 838 }
darienf 20:6d2af70c92ab 839
darienf 20:6d2af70c92ab 840 public void PaceFunction(bool enable)
darienf 20:6d2af70c92ab 841 {
darienf 20:6d2af70c92ab 842 ckbxPace.Enabled = enable;
darienf 20:6d2af70c92ab 843 lblPace.Enabled = enable;
darienf 20:6d2af70c92ab 844 tbPaceParameters.Enabled = enable;
darienf 20:6d2af70c92ab 845 }
darienf 20:6d2af70c92ab 846
darienf 20:6d2af70c92ab 847 public void BioZFunction(bool enable)
darienf 20:6d2af70c92ab 848 {
darienf 20:6d2af70c92ab 849 ckbxBioz.Enabled = enable;
darienf 20:6d2af70c92ab 850 lblBioZ.Enabled = enable;
darienf 20:6d2af70c92ab 851 tbBiozParameters.Enabled = enable;
darienf 20:6d2af70c92ab 852 }
darienf 20:6d2af70c92ab 853
darienf 20:6d2af70c92ab 854 private void btnAdvanced_Click(object sender, EventArgs e)
darienf 20:6d2af70c92ab 855 {
darienf 20:6d2af70c92ab 856 grpParameters.Visible = !grpParameters.Visible;
darienf 20:6d2af70c92ab 857 grpPrePostCommands.Visible = !grpPrePostCommands.Visible;
darienf 20:6d2af70c92ab 858 }
darienf 20:6d2af70c92ab 859
darienf 20:6d2af70c92ab 860 private void cboOpticalMode_SelectedIndexChanged(object sender, EventArgs e)
darienf 20:6d2af70c92ab 861 {
darienf 20:6d2af70c92ab 862 MaximStyle.MaximComboBox cbo = (MaximStyle.MaximComboBox)sender;
darienf 20:6d2af70c92ab 863
darienf 20:6d2af70c92ab 864 if (internalUpdate == true)
darienf 20:6d2af70c92ab 865 return;
darienf 20:6d2af70c92ab 866
darienf 20:6d2af70c92ab 867 internalUpdate = true;
darienf 20:6d2af70c92ab 868
darienf 20:6d2af70c92ab 869 if ((string)cbo.SelectedItem == "SpO2")
darienf 20:6d2af70c92ab 870 {
darienf 20:6d2af70c92ab 871 EnableOpticalSpO2 = true;
darienf 20:6d2af70c92ab 872 EnableOpticalHR = false;
darienf 20:6d2af70c92ab 873 EnableOpticalMulti = false;
darienf 20:6d2af70c92ab 874 }
darienf 20:6d2af70c92ab 875 else if ((string)cbo.SelectedItem == "HR")
darienf 20:6d2af70c92ab 876 {
darienf 20:6d2af70c92ab 877 EnableOpticalSpO2 = false;
darienf 20:6d2af70c92ab 878 EnableOpticalHR = true;
darienf 20:6d2af70c92ab 879 EnableOpticalMulti = false;
darienf 20:6d2af70c92ab 880 }
darienf 20:6d2af70c92ab 881 else if ((string)cbo.SelectedItem == "Multi")
darienf 20:6d2af70c92ab 882 {
darienf 20:6d2af70c92ab 883 EnableOpticalSpO2 = false;
darienf 20:6d2af70c92ab 884 EnableOpticalHR = false;
darienf 20:6d2af70c92ab 885 EnableOpticalMulti = true;
darienf 20:6d2af70c92ab 886 }
darienf 20:6d2af70c92ab 887 else
darienf 20:6d2af70c92ab 888 {
darienf 20:6d2af70c92ab 889 EnableOpticalSpO2 = false;
darienf 20:6d2af70c92ab 890 EnableOpticalHR = false;
darienf 20:6d2af70c92ab 891 EnableOpticalMulti = false;
darienf 20:6d2af70c92ab 892 }
darienf 20:6d2af70c92ab 893
darienf 20:6d2af70c92ab 894 updateArgsOS24();
darienf 20:6d2af70c92ab 895
darienf 20:6d2af70c92ab 896 internalUpdate = false;
darienf 20:6d2af70c92ab 897 }
darienf 20:6d2af70c92ab 898
darienf 20:6d2af70c92ab 899 private void btnSaveToFile_Click(object sender, EventArgs e)
darienf 20:6d2af70c92ab 900 {
darienf 20:6d2af70c92ab 901 if (LogDownloadStart != null)
darienf 20:6d2af70c92ab 902 LogDownloadStart(this, e);
darienf 20:6d2af70c92ab 903
darienf 20:6d2af70c92ab 904 //btnWrite.Enabled = false;
darienf 20:6d2af70c92ab 905
darienf 20:6d2af70c92ab 906 }
darienf 20:6d2af70c92ab 907
darienf 20:6d2af70c92ab 908 private void OnLogStreamDone(object sender, EventArgs e)
darienf 20:6d2af70c92ab 909 {
darienf 20:6d2af70c92ab 910 if (LogDownloadStart != null)
darienf 20:6d2af70c92ab 911 LogDownloadStart(this, e);
darienf 20:6d2af70c92ab 912 }
darienf 20:6d2af70c92ab 913
darienf 20:6d2af70c92ab 914 private void ckbxBioz_CheckedChanged(object sender, EventArgs e)
darienf 20:6d2af70c92ab 915 {
darienf 20:6d2af70c92ab 916 if (ckbxEcg.Checked)
darienf 20:6d2af70c92ab 917 ckbxRtoR.Enabled = true;
darienf 20:6d2af70c92ab 918
darienf 20:6d2af70c92ab 919 if (ckbxEcg.Checked == false)
darienf 20:6d2af70c92ab 920 {
darienf 20:6d2af70c92ab 921 if (ckbxRtoR.Checked == true)
darienf 20:6d2af70c92ab 922 ckbxRtoR.Checked = false;
darienf 20:6d2af70c92ab 923
darienf 20:6d2af70c92ab 924 ckbxRtoR.Enabled = false;
darienf 20:6d2af70c92ab 925 }
darienf 20:6d2af70c92ab 926
darienf 20:6d2af70c92ab 927 MaximStyle.MaximCheckBox cbo = (MaximStyle.MaximCheckBox)sender;
darienf 20:6d2af70c92ab 928 if (cbo.Checked)
darienf 20:6d2af70c92ab 929 updateArgsOT90();
darienf 20:6d2af70c92ab 930 }
darienf 20:6d2af70c92ab 931
darienf 20:6d2af70c92ab 932 }
darienf 20:6d2af70c92ab 933 }