Darien Figueroa / Mbed OS Final_Program

Dependencies:   USBDevice

Committer:
darienf
Date:
Sat Apr 10 03:05:42 2021 +0000
Revision:
3:36de8b9e4b1a
ayoooo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
darienf 3:36de8b9e4b1a 1 /*******************************************************************************
darienf 3:36de8b9e4b1a 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All rights Reserved.
darienf 3:36de8b9e4b1a 3 *
darienf 3:36de8b9e4b1a 4 * This software is protected by copyright laws of the United States and
darienf 3:36de8b9e4b1a 5 * of foreign countries. This material may also be protected by patent laws
darienf 3:36de8b9e4b1a 6 * and technology transfer regulations of the United States and of foreign
darienf 3:36de8b9e4b1a 7 * countries. This software is furnished under a license agreement and/or a
darienf 3:36de8b9e4b1a 8 * nondisclosure agreement and may only be used or reproduced in accordance
darienf 3:36de8b9e4b1a 9 * with the terms of those agreements. Dissemination of this information to
darienf 3:36de8b9e4b1a 10 * any party or parties not specified in the license agreement and/or
darienf 3:36de8b9e4b1a 11 * nondisclosure agreement is expressly prohibited.
darienf 3:36de8b9e4b1a 12 *
darienf 3:36de8b9e4b1a 13 * The above copyright notice and this permission notice shall be included
darienf 3:36de8b9e4b1a 14 * in all copies or substantial portions of the Software.
darienf 3:36de8b9e4b1a 15 *
darienf 3:36de8b9e4b1a 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
darienf 3:36de8b9e4b1a 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
darienf 3:36de8b9e4b1a 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
darienf 3:36de8b9e4b1a 19 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
darienf 3:36de8b9e4b1a 20 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
darienf 3:36de8b9e4b1a 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
darienf 3:36de8b9e4b1a 22 * OTHER DEALINGS IN THE SOFTWARE.
darienf 3:36de8b9e4b1a 23 *
darienf 3:36de8b9e4b1a 24 * Except as contained in this notice, the name of Maxim Integrated
darienf 3:36de8b9e4b1a 25 * Products, Inc. shall not be used except as stated in the Maxim Integrated
darienf 3:36de8b9e4b1a 26 * Products, Inc. Branding Policy.
darienf 3:36de8b9e4b1a 27 *
darienf 3:36de8b9e4b1a 28 * The mere transfer of this software does not imply any licenses
darienf 3:36de8b9e4b1a 29 * of trade secrets, proprietary technology, copyrights, patents,
darienf 3:36de8b9e4b1a 30 * trademarks, maskwork rights, or any other form of intellectual
darienf 3:36de8b9e4b1a 31 * property whatsoever. Maxim Integrated Products, Inc. retains all
darienf 3:36de8b9e4b1a 32 * ownership rights.
darienf 3:36de8b9e4b1a 33 *******************************************************************************
darienf 3:36de8b9e4b1a 34 */
darienf 3:36de8b9e4b1a 35
darienf 3:36de8b9e4b1a 36 using System;
darienf 3:36de8b9e4b1a 37 using System.Collections.Generic;
darienf 3:36de8b9e4b1a 38 using System.Linq;
darienf 3:36de8b9e4b1a 39 using System.Text;
darienf 3:36de8b9e4b1a 40
darienf 3:36de8b9e4b1a 41 namespace HealthSensorPlatform.CustomControls
darienf 3:36de8b9e4b1a 42 {
darienf 3:36de8b9e4b1a 43 /// <summary>
darienf 3:36de8b9e4b1a 44 /// Data for initializing streaming or flash logging
darienf 3:36de8b9e4b1a 45 /// </summary>
darienf 3:36de8b9e4b1a 46 public class InitArgs
darienf 3:36de8b9e4b1a 47 {
darienf 3:36de8b9e4b1a 48 interface IInitArgs
darienf 3:36de8b9e4b1a 49 {
darienf 3:36de8b9e4b1a 50 string ToCommandString();
darienf 3:36de8b9e4b1a 51 //IInitArgs FromIntArray(int[] array);
darienf 3:36de8b9e4b1a 52 }
darienf 3:36de8b9e4b1a 53
darienf 3:36de8b9e4b1a 54 public struct RbiasInit
darienf 3:36de8b9e4b1a 55 {
darienf 3:36de8b9e4b1a 56 public int En_rbias;
darienf 3:36de8b9e4b1a 57 public int Rbias;
darienf 3:36de8b9e4b1a 58 public int Rbiasp;
darienf 3:36de8b9e4b1a 59 public int Rbiasn;
darienf 3:36de8b9e4b1a 60 public int Fmstr;
darienf 3:36de8b9e4b1a 61 }
darienf 3:36de8b9e4b1a 62
darienf 3:36de8b9e4b1a 63 public class EcgInitStart : IInitArgs
darienf 3:36de8b9e4b1a 64 {
darienf 3:36de8b9e4b1a 65 public int En_ecg;
darienf 3:36de8b9e4b1a 66 public int Openp;
darienf 3:36de8b9e4b1a 67 public int Openn;
darienf 3:36de8b9e4b1a 68 public int Pol;
darienf 3:36de8b9e4b1a 69 public int Calp_sel;
darienf 3:36de8b9e4b1a 70 public int Caln_sel;
darienf 3:36de8b9e4b1a 71 public int E_fit;
darienf 3:36de8b9e4b1a 72 public int Rate;
darienf 3:36de8b9e4b1a 73 public int Gain;
darienf 3:36de8b9e4b1a 74 public int Dhpf;
darienf 3:36de8b9e4b1a 75 public int Dlpf;
darienf 3:36de8b9e4b1a 76
darienf 3:36de8b9e4b1a 77 public string ToCommandString()
darienf 3:36de8b9e4b1a 78 {
darienf 3:36de8b9e4b1a 79 StringBuilder command = new StringBuilder();
darienf 3:36de8b9e4b1a 80 command.Append(En_ecg.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 81 command.Append(Openp.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 82 command.Append(Openn.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 83 command.Append(Pol.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 84 command.Append(Calp_sel.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 85 command.Append(Caln_sel.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 86 command.Append(E_fit.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 87 command.Append(Rate.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 88 command.Append(Gain.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 89 command.Append(Dhpf.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 90 command.Append(Dlpf.ToString("X2"));
darienf 3:36de8b9e4b1a 91
darienf 3:36de8b9e4b1a 92 return command.ToString();
darienf 3:36de8b9e4b1a 93 }
darienf 3:36de8b9e4b1a 94
darienf 3:36de8b9e4b1a 95 public int[] ToArray()
darienf 3:36de8b9e4b1a 96 {
darienf 3:36de8b9e4b1a 97 int[] array = new int[11];
darienf 3:36de8b9e4b1a 98
darienf 3:36de8b9e4b1a 99 array[0] = En_ecg;
darienf 3:36de8b9e4b1a 100 array[1] = Openp;
darienf 3:36de8b9e4b1a 101 array[2] = Openn;
darienf 3:36de8b9e4b1a 102 array[3] = Pol;
darienf 3:36de8b9e4b1a 103 array[4] = Calp_sel;
darienf 3:36de8b9e4b1a 104 array[5] = Caln_sel;
darienf 3:36de8b9e4b1a 105 array[6] = E_fit;
darienf 3:36de8b9e4b1a 106 array[7] = Rate;
darienf 3:36de8b9e4b1a 107 array[8] = Gain;
darienf 3:36de8b9e4b1a 108 array[9] = Dhpf;
darienf 3:36de8b9e4b1a 109 array[10] = Dlpf;
darienf 3:36de8b9e4b1a 110
darienf 3:36de8b9e4b1a 111 return array;
darienf 3:36de8b9e4b1a 112 }
darienf 3:36de8b9e4b1a 113
darienf 3:36de8b9e4b1a 114 public EcgInitStart FromIntArray(int[] array)
darienf 3:36de8b9e4b1a 115 {
darienf 3:36de8b9e4b1a 116 if (array.Length == 11)
darienf 3:36de8b9e4b1a 117 {
darienf 3:36de8b9e4b1a 118 En_ecg = array[0];
darienf 3:36de8b9e4b1a 119 Openp = array[1];
darienf 3:36de8b9e4b1a 120 Openn = array[2];
darienf 3:36de8b9e4b1a 121 Pol = array[3];
darienf 3:36de8b9e4b1a 122 Calp_sel = array[4];
darienf 3:36de8b9e4b1a 123 Caln_sel = array[5];
darienf 3:36de8b9e4b1a 124 E_fit = array[6];
darienf 3:36de8b9e4b1a 125 Rate = array[7];
darienf 3:36de8b9e4b1a 126 Gain = array[8];
darienf 3:36de8b9e4b1a 127 Dhpf = array[9];
darienf 3:36de8b9e4b1a 128 Dlpf = array[10];
darienf 3:36de8b9e4b1a 129 }
darienf 3:36de8b9e4b1a 130 else
darienf 3:36de8b9e4b1a 131 {
darienf 3:36de8b9e4b1a 132 throw new InvalidOperationException("Array length incorrect");
darienf 3:36de8b9e4b1a 133 }
darienf 3:36de8b9e4b1a 134
darienf 3:36de8b9e4b1a 135 return this;
darienf 3:36de8b9e4b1a 136 }
darienf 3:36de8b9e4b1a 137 }
darienf 3:36de8b9e4b1a 138
darienf 3:36de8b9e4b1a 139 public struct EcgFastInit
darienf 3:36de8b9e4b1a 140 {
darienf 3:36de8b9e4b1a 141 public int Clr_Fast;
darienf 3:36de8b9e4b1a 142 public int Fast;
darienf 3:36de8b9e4b1a 143 public int Fast_Th;
darienf 3:36de8b9e4b1a 144 }
darienf 3:36de8b9e4b1a 145
darienf 3:36de8b9e4b1a 146 public class FMSTRInitStart : IInitArgs
darienf 3:36de8b9e4b1a 147 {
darienf 3:36de8b9e4b1a 148 public int En_rbias;
darienf 3:36de8b9e4b1a 149 public int Rbiasv;
darienf 3:36de8b9e4b1a 150 public int Rbiasp;
darienf 3:36de8b9e4b1a 151 public int Rbiasn;
darienf 3:36de8b9e4b1a 152 public int Fmstr;
darienf 3:36de8b9e4b1a 153
darienf 3:36de8b9e4b1a 154 public string ToCommandString()
darienf 3:36de8b9e4b1a 155 {
darienf 3:36de8b9e4b1a 156 StringBuilder command = new StringBuilder();
darienf 3:36de8b9e4b1a 157 command.Append(En_rbias.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 158 command.Append(Rbiasv.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 159 command.Append(Rbiasp.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 160 command.Append(Rbiasn.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 161 command.Append(Fmstr.ToString("X2"));
darienf 3:36de8b9e4b1a 162
darienf 3:36de8b9e4b1a 163 return command.ToString();
darienf 3:36de8b9e4b1a 164 }
darienf 3:36de8b9e4b1a 165
darienf 3:36de8b9e4b1a 166 public FMSTRInitStart FromIntArray(int[] array)
darienf 3:36de8b9e4b1a 167 {
darienf 3:36de8b9e4b1a 168 if (array.Length == 5)
darienf 3:36de8b9e4b1a 169 {
darienf 3:36de8b9e4b1a 170 En_rbias = array[0];
darienf 3:36de8b9e4b1a 171 Rbiasv = array[1];
darienf 3:36de8b9e4b1a 172 Rbiasp = array[2];
darienf 3:36de8b9e4b1a 173 Rbiasn = array[3];
darienf 3:36de8b9e4b1a 174 Fmstr = array[4];
darienf 3:36de8b9e4b1a 175 }
darienf 3:36de8b9e4b1a 176 else
darienf 3:36de8b9e4b1a 177 {
darienf 3:36de8b9e4b1a 178 throw new InvalidOperationException("Array length incorrect");
darienf 3:36de8b9e4b1a 179 }
darienf 3:36de8b9e4b1a 180
darienf 3:36de8b9e4b1a 181 return this;
darienf 3:36de8b9e4b1a 182 }
darienf 3:36de8b9e4b1a 183 }
darienf 3:36de8b9e4b1a 184
darienf 3:36de8b9e4b1a 185 public class PACEInitStart : IInitArgs
darienf 3:36de8b9e4b1a 186 {
darienf 3:36de8b9e4b1a 187 public int En_pace;
darienf 3:36de8b9e4b1a 188 public int Clr_pedge;
darienf 3:36de8b9e4b1a 189 public int Pol;
darienf 3:36de8b9e4b1a 190 public int Gn_diff_off;
darienf 3:36de8b9e4b1a 191 public int Gain;
darienf 3:36de8b9e4b1a 192 public int Aout_lbw;
darienf 3:36de8b9e4b1a 193 public int Aout;
darienf 3:36de8b9e4b1a 194 public int Dacp;
darienf 3:36de8b9e4b1a 195 public int Dacn;
darienf 3:36de8b9e4b1a 196
darienf 3:36de8b9e4b1a 197 public string ToCommandString()
darienf 3:36de8b9e4b1a 198 {
darienf 3:36de8b9e4b1a 199 StringBuilder command = new StringBuilder();
darienf 3:36de8b9e4b1a 200 command.Append(En_pace.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 201 command.Append(Clr_pedge.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 202 command.Append(Gn_diff_off.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 203 command.Append(Gain.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 204 command.Append(Aout_lbw.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 205 command.Append(Aout.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 206 command.Append(Dacp.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 207 command.Append(Dacn.ToString("X2"));
darienf 3:36de8b9e4b1a 208
darienf 3:36de8b9e4b1a 209 return command.ToString();
darienf 3:36de8b9e4b1a 210 }
darienf 3:36de8b9e4b1a 211
darienf 3:36de8b9e4b1a 212 public int[] ToArray()
darienf 3:36de8b9e4b1a 213 {
darienf 3:36de8b9e4b1a 214 int[] array = new int[9];
darienf 3:36de8b9e4b1a 215
darienf 3:36de8b9e4b1a 216 array[0] = En_pace;
darienf 3:36de8b9e4b1a 217 array[1] = Clr_pedge;
darienf 3:36de8b9e4b1a 218 array[2] = Pol;
darienf 3:36de8b9e4b1a 219 array[3] = Gn_diff_off;
darienf 3:36de8b9e4b1a 220 array[4] = Gain;
darienf 3:36de8b9e4b1a 221 array[5] = Aout_lbw;
darienf 3:36de8b9e4b1a 222 array[6] = Aout;
darienf 3:36de8b9e4b1a 223 array[7] = Dacp;
darienf 3:36de8b9e4b1a 224 array[8] = Dacn;
darienf 3:36de8b9e4b1a 225
darienf 3:36de8b9e4b1a 226 return array;
darienf 3:36de8b9e4b1a 227 }
darienf 3:36de8b9e4b1a 228
darienf 3:36de8b9e4b1a 229 public PACEInitStart FromIntArray(int[] array)
darienf 3:36de8b9e4b1a 230 {
darienf 3:36de8b9e4b1a 231 if (array.Length == 8)
darienf 3:36de8b9e4b1a 232 {
darienf 3:36de8b9e4b1a 233 En_pace = array[0];
darienf 3:36de8b9e4b1a 234 Clr_pedge = array[1];
darienf 3:36de8b9e4b1a 235 Pol = array[2];
darienf 3:36de8b9e4b1a 236 Gn_diff_off = array[3];
darienf 3:36de8b9e4b1a 237 Gain = array[4];
darienf 3:36de8b9e4b1a 238 Aout_lbw = array[5];
darienf 3:36de8b9e4b1a 239 Dacp = array[6];
darienf 3:36de8b9e4b1a 240 Dacn = array[7];
darienf 3:36de8b9e4b1a 241 }
darienf 3:36de8b9e4b1a 242 else
darienf 3:36de8b9e4b1a 243 {
darienf 3:36de8b9e4b1a 244 throw new InvalidOperationException("Array length incorrect");
darienf 3:36de8b9e4b1a 245 }
darienf 3:36de8b9e4b1a 246
darienf 3:36de8b9e4b1a 247 return this;
darienf 3:36de8b9e4b1a 248 }
darienf 3:36de8b9e4b1a 249 }
darienf 3:36de8b9e4b1a 250
darienf 3:36de8b9e4b1a 251 public class BIOZInitStart : IInitArgs
darienf 3:36de8b9e4b1a 252 {
darienf 3:36de8b9e4b1a 253 public int En_bioz;
darienf 3:36de8b9e4b1a 254 public int Openp;
darienf 3:36de8b9e4b1a 255 public int Openn;
darienf 3:36de8b9e4b1a 256 public int Calp_sel;
darienf 3:36de8b9e4b1a 257 public int Caln_sel;
darienf 3:36de8b9e4b1a 258 public int CG_mode;
darienf 3:36de8b9e4b1a 259 public int B_fit;
darienf 3:36de8b9e4b1a 260 public int Rate;
darienf 3:36de8b9e4b1a 261 public int Ahpf;
darienf 3:36de8b9e4b1a 262 public int Ext_rbias;
darienf 3:36de8b9e4b1a 263 public int Gain;
darienf 3:36de8b9e4b1a 264 public int Dhpf;
darienf 3:36de8b9e4b1a 265 public int Dlpf;
darienf 3:36de8b9e4b1a 266 public int Fcgen;
darienf 3:36de8b9e4b1a 267 public int Cgmon;
darienf 3:36de8b9e4b1a 268 public int Cgmag;
darienf 3:36de8b9e4b1a 269 public int Phoff;
darienf 3:36de8b9e4b1a 270
darienf 3:36de8b9e4b1a 271 public string ToCommandString()
darienf 3:36de8b9e4b1a 272 {
darienf 3:36de8b9e4b1a 273 StringBuilder command = new StringBuilder();
darienf 3:36de8b9e4b1a 274 command.Append(En_bioz.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 275 command.Append(Openp.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 276 command.Append(Openn.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 277 command.Append(Calp_sel.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 278 command.Append(Caln_sel.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 279 command.Append(CG_mode.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 280 command.Append(B_fit.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 281 command.Append(Rate.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 282 command.Append(Ahpf.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 283 command.Append(Ext_rbias.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 284 command.Append(Gain.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 285 command.Append(Dhpf.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 286 command.Append(Dlpf.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 287 command.Append(Fcgen.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 288 command.Append(Cgmon.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 289 command.Append(Cgmag.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 290 command.Append(Phoff.ToString("X2"));
darienf 3:36de8b9e4b1a 291
darienf 3:36de8b9e4b1a 292 return command.ToString();
darienf 3:36de8b9e4b1a 293 }
darienf 3:36de8b9e4b1a 294
darienf 3:36de8b9e4b1a 295 public int[] ToArray()
darienf 3:36de8b9e4b1a 296 {
darienf 3:36de8b9e4b1a 297 int[] array = new int[17];
darienf 3:36de8b9e4b1a 298
darienf 3:36de8b9e4b1a 299 array[0] = En_bioz;
darienf 3:36de8b9e4b1a 300 array[1] = Openp;
darienf 3:36de8b9e4b1a 301 array[2] = Openn;
darienf 3:36de8b9e4b1a 302 array[3] = Calp_sel;
darienf 3:36de8b9e4b1a 303 array[4] = Caln_sel;
darienf 3:36de8b9e4b1a 304 array[5] = CG_mode;
darienf 3:36de8b9e4b1a 305 array[6] = B_fit;
darienf 3:36de8b9e4b1a 306 array[7] = Rate;
darienf 3:36de8b9e4b1a 307 array[8] = Ahpf;
darienf 3:36de8b9e4b1a 308 array[9] = Ext_rbias;
darienf 3:36de8b9e4b1a 309 array[10] = Gain;
darienf 3:36de8b9e4b1a 310 array[11] = Dhpf;
darienf 3:36de8b9e4b1a 311 array[12] = Dlpf;
darienf 3:36de8b9e4b1a 312 array[13] = Fcgen;
darienf 3:36de8b9e4b1a 313 array[14] = Cgmon;
darienf 3:36de8b9e4b1a 314 array[15] = Cgmag;
darienf 3:36de8b9e4b1a 315 array[16] = Phoff;
darienf 3:36de8b9e4b1a 316
darienf 3:36de8b9e4b1a 317 return array;
darienf 3:36de8b9e4b1a 318 }
darienf 3:36de8b9e4b1a 319
darienf 3:36de8b9e4b1a 320 public BIOZInitStart FromIntArray(int[] array)
darienf 3:36de8b9e4b1a 321 {
darienf 3:36de8b9e4b1a 322 if (array.Length == 17)
darienf 3:36de8b9e4b1a 323 {
darienf 3:36de8b9e4b1a 324 En_bioz = array[0];
darienf 3:36de8b9e4b1a 325 Openp = array[1];
darienf 3:36de8b9e4b1a 326 Openn = array[2];
darienf 3:36de8b9e4b1a 327 Calp_sel = array[3];
darienf 3:36de8b9e4b1a 328 Caln_sel = array[4];
darienf 3:36de8b9e4b1a 329 CG_mode = array[5];
darienf 3:36de8b9e4b1a 330 B_fit = array[6];
darienf 3:36de8b9e4b1a 331 Rate = array[7];
darienf 3:36de8b9e4b1a 332 Ahpf = array[8];
darienf 3:36de8b9e4b1a 333 Ext_rbias = array[9];
darienf 3:36de8b9e4b1a 334 Gain = array[10];
darienf 3:36de8b9e4b1a 335 Dhpf = array[11];
darienf 3:36de8b9e4b1a 336 Dlpf = array[12];
darienf 3:36de8b9e4b1a 337 Fcgen = array[13];
darienf 3:36de8b9e4b1a 338 Cgmon = array[14];
darienf 3:36de8b9e4b1a 339 Cgmag = array[15];
darienf 3:36de8b9e4b1a 340 Phoff = array[16];
darienf 3:36de8b9e4b1a 341 }
darienf 3:36de8b9e4b1a 342 else
darienf 3:36de8b9e4b1a 343 {
darienf 3:36de8b9e4b1a 344 throw new InvalidOperationException("Array size incorrect");
darienf 3:36de8b9e4b1a 345 }
darienf 3:36de8b9e4b1a 346
darienf 3:36de8b9e4b1a 347 return this;
darienf 3:36de8b9e4b1a 348 }
darienf 3:36de8b9e4b1a 349 }
darienf 3:36de8b9e4b1a 350
darienf 3:36de8b9e4b1a 351 public class RToRInitStart : IInitArgs
darienf 3:36de8b9e4b1a 352 {
darienf 3:36de8b9e4b1a 353 public int En_rtor;
darienf 3:36de8b9e4b1a 354 public int Wndw;
darienf 3:36de8b9e4b1a 355 public int Gain;
darienf 3:36de8b9e4b1a 356 public int Pavg;
darienf 3:36de8b9e4b1a 357 public int Ptsf;
darienf 3:36de8b9e4b1a 358 public int Hoff;
darienf 3:36de8b9e4b1a 359 public int Ravg;
darienf 3:36de8b9e4b1a 360 public int Rhsf;
darienf 3:36de8b9e4b1a 361 public int Clr_rrint;
darienf 3:36de8b9e4b1a 362
darienf 3:36de8b9e4b1a 363 public string ToCommandString()
darienf 3:36de8b9e4b1a 364 {
darienf 3:36de8b9e4b1a 365 StringBuilder command = new StringBuilder();
darienf 3:36de8b9e4b1a 366 command.Append(En_rtor.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 367 command.Append(Wndw.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 368 command.Append(Gain.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 369 command.Append(Pavg.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 370 command.Append(Ptsf.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 371 command.Append(Hoff.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 372 command.Append(Ravg.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 373 command.Append(Rhsf.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 374 command.Append(Clr_rrint.ToString("X2"));
darienf 3:36de8b9e4b1a 375
darienf 3:36de8b9e4b1a 376 return command.ToString();
darienf 3:36de8b9e4b1a 377 }
darienf 3:36de8b9e4b1a 378
darienf 3:36de8b9e4b1a 379 public int[] ToArray()
darienf 3:36de8b9e4b1a 380 {
darienf 3:36de8b9e4b1a 381 int[] array = new int[9];
darienf 3:36de8b9e4b1a 382
darienf 3:36de8b9e4b1a 383 array[0] = En_rtor;
darienf 3:36de8b9e4b1a 384 array[1] = Wndw;
darienf 3:36de8b9e4b1a 385 array[2] = Gain;
darienf 3:36de8b9e4b1a 386 array[3] = Pavg;
darienf 3:36de8b9e4b1a 387 array[4] = Ptsf;
darienf 3:36de8b9e4b1a 388 array[5] = Hoff;
darienf 3:36de8b9e4b1a 389 array[6] = Ravg;
darienf 3:36de8b9e4b1a 390 array[7] = Rhsf;
darienf 3:36de8b9e4b1a 391 array[8] = Clr_rrint;
darienf 3:36de8b9e4b1a 392
darienf 3:36de8b9e4b1a 393 return array;
darienf 3:36de8b9e4b1a 394 }
darienf 3:36de8b9e4b1a 395
darienf 3:36de8b9e4b1a 396 public RToRInitStart FromIntArray(int[] array)
darienf 3:36de8b9e4b1a 397 {
darienf 3:36de8b9e4b1a 398 if (array.Length == 9)
darienf 3:36de8b9e4b1a 399 {
darienf 3:36de8b9e4b1a 400 En_rtor = array[0];
darienf 3:36de8b9e4b1a 401 Wndw = array[1];
darienf 3:36de8b9e4b1a 402 Gain = array[2];
darienf 3:36de8b9e4b1a 403 Pavg = array[3];
darienf 3:36de8b9e4b1a 404 Ptsf = array[4];
darienf 3:36de8b9e4b1a 405 Hoff = array[5];
darienf 3:36de8b9e4b1a 406 Ravg = array[6];
darienf 3:36de8b9e4b1a 407 Rhsf = array[7];
darienf 3:36de8b9e4b1a 408 Clr_rrint = array[8];
darienf 3:36de8b9e4b1a 409 }
darienf 3:36de8b9e4b1a 410 else
darienf 3:36de8b9e4b1a 411 {
darienf 3:36de8b9e4b1a 412 throw new InvalidOperationException("Array size incorrect");
darienf 3:36de8b9e4b1a 413 }
darienf 3:36de8b9e4b1a 414
darienf 3:36de8b9e4b1a 415 return this;
darienf 3:36de8b9e4b1a 416 }
darienf 3:36de8b9e4b1a 417 }
darienf 3:36de8b9e4b1a 418
darienf 3:36de8b9e4b1a 419 public struct CalInitStart
darienf 3:36de8b9e4b1a 420 {
darienf 3:36de8b9e4b1a 421 public int Vmode;
darienf 3:36de8b9e4b1a 422 public int Vmag;
darienf 3:36de8b9e4b1a 423 public int Fcal;
darienf 3:36de8b9e4b1a 424 public int Thigh;
darienf 3:36de8b9e4b1a 425 public int Fifty;
darienf 3:36de8b9e4b1a 426 public int En_Vcal;
darienf 3:36de8b9e4b1a 427 }
darienf 3:36de8b9e4b1a 428
darienf 3:36de8b9e4b1a 429 public class SpO2HRModeInitStart : IInitArgs
darienf 3:36de8b9e4b1a 430 {
darienf 3:36de8b9e4b1a 431 public int FifoWaterlevelMark;
darienf 3:36de8b9e4b1a 432 public int SampleAverage;
darienf 3:36de8b9e4b1a 433 public int SampleRate;
darienf 3:36de8b9e4b1a 434 public int PulseWidth;
darienf 3:36de8b9e4b1a 435 public int RedLedCurrent;
darienf 3:36de8b9e4b1a 436 public int IRLedCurrent;
darienf 3:36de8b9e4b1a 437
darienf 3:36de8b9e4b1a 438 public string ToCommandString()
darienf 3:36de8b9e4b1a 439 {
darienf 3:36de8b9e4b1a 440 StringBuilder command = new StringBuilder();
darienf 3:36de8b9e4b1a 441 command.Append(FifoWaterlevelMark.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 442 command.Append(SampleAverage.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 443 command.Append(SampleRate.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 444 command.Append(PulseWidth.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 445 command.Append(RedLedCurrent.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 446 command.Append(IRLedCurrent.ToString("X2"));
darienf 3:36de8b9e4b1a 447
darienf 3:36de8b9e4b1a 448 return command.ToString();
darienf 3:36de8b9e4b1a 449 }
darienf 3:36de8b9e4b1a 450
darienf 3:36de8b9e4b1a 451 public SpO2HRModeInitStart FromIntArray(int[] array)
darienf 3:36de8b9e4b1a 452 {
darienf 3:36de8b9e4b1a 453 if (array.Length == 6)
darienf 3:36de8b9e4b1a 454 {
darienf 3:36de8b9e4b1a 455 FifoWaterlevelMark = array[0];
darienf 3:36de8b9e4b1a 456 SampleAverage = array[1];
darienf 3:36de8b9e4b1a 457 SampleRate = array[2];
darienf 3:36de8b9e4b1a 458 PulseWidth = array[3];
darienf 3:36de8b9e4b1a 459 RedLedCurrent = array[4];
darienf 3:36de8b9e4b1a 460 IRLedCurrent = array[5];
darienf 3:36de8b9e4b1a 461 }
darienf 3:36de8b9e4b1a 462 else if (array.Length == 5)
darienf 3:36de8b9e4b1a 463 {
darienf 3:36de8b9e4b1a 464 FifoWaterlevelMark = array[0];
darienf 3:36de8b9e4b1a 465 SampleAverage = array[1];
darienf 3:36de8b9e4b1a 466 SampleRate = array[2];
darienf 3:36de8b9e4b1a 467 PulseWidth = array[3];
darienf 3:36de8b9e4b1a 468 RedLedCurrent = array[4];
darienf 3:36de8b9e4b1a 469 }
darienf 3:36de8b9e4b1a 470 else
darienf 3:36de8b9e4b1a 471 {
darienf 3:36de8b9e4b1a 472 throw new InvalidOperationException("Array size incorrect");
darienf 3:36de8b9e4b1a 473 }
darienf 3:36de8b9e4b1a 474
darienf 3:36de8b9e4b1a 475 return this;
darienf 3:36de8b9e4b1a 476 }
darienf 3:36de8b9e4b1a 477 }
darienf 3:36de8b9e4b1a 478
darienf 3:36de8b9e4b1a 479 public class HRModeInitStart : IInitArgs
darienf 3:36de8b9e4b1a 480 {
darienf 3:36de8b9e4b1a 481 public int FifoWaterlevelMark;
darienf 3:36de8b9e4b1a 482 public int SampleAverage;
darienf 3:36de8b9e4b1a 483 public int SampleRate;
darienf 3:36de8b9e4b1a 484 public int PulseWidth;
darienf 3:36de8b9e4b1a 485 public int RedLedCurrent;
darienf 3:36de8b9e4b1a 486 public int IRLedCurrent;
darienf 3:36de8b9e4b1a 487
darienf 3:36de8b9e4b1a 488 public string ToCommandString()
darienf 3:36de8b9e4b1a 489 {
darienf 3:36de8b9e4b1a 490 StringBuilder command = new StringBuilder();
darienf 3:36de8b9e4b1a 491 command.Append(FifoWaterlevelMark.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 492 command.Append(SampleAverage.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 493 command.Append(SampleRate.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 494 command.Append(PulseWidth.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 495 command.Append(RedLedCurrent.ToString("X2"));
darienf 3:36de8b9e4b1a 496
darienf 3:36de8b9e4b1a 497 return command.ToString();
darienf 3:36de8b9e4b1a 498 }
darienf 3:36de8b9e4b1a 499
darienf 3:36de8b9e4b1a 500 public HRModeInitStart FromIntArray(int[] array)
darienf 3:36de8b9e4b1a 501 {
darienf 3:36de8b9e4b1a 502 if (array.Length == 5)
darienf 3:36de8b9e4b1a 503 {
darienf 3:36de8b9e4b1a 504 FifoWaterlevelMark = array[0];
darienf 3:36de8b9e4b1a 505 SampleAverage = array[1];
darienf 3:36de8b9e4b1a 506 SampleRate = array[2];
darienf 3:36de8b9e4b1a 507 PulseWidth = array[3];
darienf 3:36de8b9e4b1a 508 RedLedCurrent = array[4];
darienf 3:36de8b9e4b1a 509 }
darienf 3:36de8b9e4b1a 510 else
darienf 3:36de8b9e4b1a 511 {
darienf 3:36de8b9e4b1a 512 throw new InvalidOperationException("Array size incorrect");
darienf 3:36de8b9e4b1a 513 }
darienf 3:36de8b9e4b1a 514
darienf 3:36de8b9e4b1a 515 return this;
darienf 3:36de8b9e4b1a 516 }
darienf 3:36de8b9e4b1a 517 }
darienf 3:36de8b9e4b1a 518
darienf 3:36de8b9e4b1a 519 public class MultiModeInitStart : IInitArgs
darienf 3:36de8b9e4b1a 520 {
darienf 3:36de8b9e4b1a 521 public int FifoWaterlevelMark;
darienf 3:36de8b9e4b1a 522 public int SampleAverage;
darienf 3:36de8b9e4b1a 523 public int SampleRate;
darienf 3:36de8b9e4b1a 524 public int PulseWidth;
darienf 3:36de8b9e4b1a 525 public int RedLedCurrent;
darienf 3:36de8b9e4b1a 526 public int IRLedCurrent;
darienf 3:36de8b9e4b1a 527 public int GreenLedCurrent;
darienf 3:36de8b9e4b1a 528 public int Slot1;
darienf 3:36de8b9e4b1a 529 public int Slot2;
darienf 3:36de8b9e4b1a 530 public int Slot3;
darienf 3:36de8b9e4b1a 531 public int Slot4;
darienf 3:36de8b9e4b1a 532
darienf 3:36de8b9e4b1a 533 public string ToCommandString()
darienf 3:36de8b9e4b1a 534 {
darienf 3:36de8b9e4b1a 535 StringBuilder command = new StringBuilder();
darienf 3:36de8b9e4b1a 536 command.Append(FifoWaterlevelMark.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 537 command.Append(SampleAverage.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 538 command.Append(SampleRate.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 539 command.Append(PulseWidth.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 540 command.Append(RedLedCurrent.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 541 command.Append(IRLedCurrent.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 542 command.Append(GreenLedCurrent.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 543 command.Append(Slot1.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 544 command.Append(Slot2.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 545 command.Append(Slot3.ToString("X2")).Append(" ");
darienf 3:36de8b9e4b1a 546 command.Append(Slot4.ToString("X2"));
darienf 3:36de8b9e4b1a 547
darienf 3:36de8b9e4b1a 548 return command.ToString();
darienf 3:36de8b9e4b1a 549 }
darienf 3:36de8b9e4b1a 550
darienf 3:36de8b9e4b1a 551 public MultiModeInitStart FromIntArray(int[] array)
darienf 3:36de8b9e4b1a 552 {
darienf 3:36de8b9e4b1a 553 if (array.Length == 11)
darienf 3:36de8b9e4b1a 554 {
darienf 3:36de8b9e4b1a 555 FifoWaterlevelMark = array[0];
darienf 3:36de8b9e4b1a 556 SampleAverage = array[1];
darienf 3:36de8b9e4b1a 557 SampleRate = array[2];
darienf 3:36de8b9e4b1a 558 PulseWidth = array[3];
darienf 3:36de8b9e4b1a 559 RedLedCurrent = array[4];
darienf 3:36de8b9e4b1a 560 IRLedCurrent = array[5];
darienf 3:36de8b9e4b1a 561 GreenLedCurrent = array[6];
darienf 3:36de8b9e4b1a 562 Slot1 = array[7];
darienf 3:36de8b9e4b1a 563 Slot2 = array[8];
darienf 3:36de8b9e4b1a 564 Slot3 = array[9];
darienf 3:36de8b9e4b1a 565 Slot4 = array[10];
darienf 3:36de8b9e4b1a 566 }
darienf 3:36de8b9e4b1a 567 else
darienf 3:36de8b9e4b1a 568 {
darienf 3:36de8b9e4b1a 569 throw new InvalidOperationException("Array size incorrect");
darienf 3:36de8b9e4b1a 570 }
darienf 3:36de8b9e4b1a 571
darienf 3:36de8b9e4b1a 572 return this;
darienf 3:36de8b9e4b1a 573 }
darienf 3:36de8b9e4b1a 574 }
darienf 3:36de8b9e4b1a 575 }
darienf 3:36de8b9e4b1a 576 }