Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PaceTest.cs
00001 /******************************************************************************* 00002 * Copyright (C) 2016 Maxim Integrated Products, Inc., All rights Reserved. 00003 * 00004 * This software is protected by copyright laws of the United States and 00005 * of foreign countries. This material may also be protected by patent laws 00006 * and technology transfer regulations of the United States and of foreign 00007 * countries. This software is furnished under a license agreement and/or a 00008 * nondisclosure agreement and may only be used or reproduced in accordance 00009 * with the terms of those agreements. Dissemination of this information to 00010 * any party or parties not specified in the license agreement and/or 00011 * nondisclosure agreement is expressly prohibited. 00012 * 00013 * The above copyright notice and this permission notice shall be included 00014 * in all copies or substantial portions of the Software. 00015 * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00017 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00018 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00019 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES 00020 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00021 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00022 * OTHER DEALINGS IN THE SOFTWARE. 00023 * 00024 * Except as contained in this notice, the name of Maxim Integrated 00025 * Products, Inc. shall not be used except as stated in the Maxim Integrated 00026 * Products, Inc. Branding Policy. 00027 * 00028 * The mere transfer of this software does not imply any licenses 00029 * of trade secrets, proprietary technology, copyrights, patents, 00030 * trademarks, maskwork rights, or any other form of intellectual 00031 * property whatsoever. Maxim Integrated Products, Inc. retains all 00032 * ownership rights. 00033 ******************************************************************************* 00034 */ 00035 00036 using System; 00037 using NUnit.Framework; 00038 using HealthSensorPlatform.CustomControls; 00039 using HealthSensorPlatform.Model; 00040 using RPCSupport.Streaming; 00041 using System.Windows.Forms; 00042 00043 namespace EcgViewTest 00044 { 00045 [TestFixture] 00046 public partial class EcgTest 00047 { 00048 /* 00049 [Test] 00050 public void PaceDataTag0() 00051 { 00052 Form form = new Form(); 00053 EcgView ecgView = new EcgView(); 00054 PaceData result; 00055 PartialArrayIntAvailableEventArgs args = new PartialArrayIntAvailableEventArgs(); 00056 PartialArrayIntAvailableEventArgs ecgArgs = new PartialArrayIntAvailableEventArgs(); 00057 00058 ecgArgs = new PartialArrayIntAvailableEventArgs(); 00059 ecgArgs.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_ECG; 00060 args.sampleNumberOffset = 5; 00061 args.array1 = new int[] { 00062 7, 00063 7, 00064 0, // Tag 0 has pace data 00065 7, 00066 7 00067 }; 00068 00069 args.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_PACE; 00070 args.sampleNumberOffset = 18; 00071 args.array1 = new int[] { 00072 0 << 14 | 0 << 13 | 0 << 12 | 1 << 2 | 1 << 1 | 1, 123456, 123456, 00073 123456, 123456, 123456, 00074 123456, 123456, 123456, 00075 123456, 123456, 123456, 00076 123456, 123456, 123456, 00077 123456, 123456, 123456 00078 }; 00079 00080 form.Controls.Add(ecgView); 00081 ecgView.On_AppendChart(this, args); 00082 result = ecgView.paceData; 00083 00084 Assert.AreEqual(-1, result.PaceLength(0)); 00085 } 00086 00087 [Test] 00088 public void PaceDataTag1() 00089 { 00090 Form form = new Form(); 00091 EcgView ecgView = new EcgView(); 00092 PaceData result; 00093 PartialArrayIntAvailableEventArgs args = new PartialArrayIntAvailableEventArgs(); 00094 PartialArrayIntAvailableEventArgs ecgArgs = new PartialArrayIntAvailableEventArgs(); 00095 00096 ecgArgs = new PartialArrayIntAvailableEventArgs(); 00097 ecgArgs.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_ECG; 00098 args.sampleNumberOffset = 5; 00099 args.array1 = new int[] { 00100 7, 00101 7, 00102 1, // Tag 0 has pace data 00103 7, 00104 7 00105 }; 00106 00107 args.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_PACE; 00108 args.sampleNumberOffset = 18; 00109 args.array1 = new int[] { 00110 123456, 123456, 123456, 00111 0 << 14 | 0 << 13 | 0 << 12 | 1 << 2 | 1 << 1 | 1, 123456, 123456, 00112 123456, 123456, 123456, 00113 123456, 123456, 123456, 00114 123456, 123456, 123456, 00115 123456, 123456, 123456 00116 }; 00117 00118 form.Controls.Add(ecgView); 00119 ecgView.On_AppendChart(this, args); 00120 result = ecgView.paceData; 00121 00122 Assert.AreEqual(-1, result.PaceLength(1)); 00123 } 00124 00125 [Test] 00126 public void PaceDataTag2() 00127 { 00128 Form form = new Form(); 00129 EcgView ecgView = new EcgView(); 00130 PaceData result; 00131 PartialArrayIntAvailableEventArgs args = new PartialArrayIntAvailableEventArgs(); 00132 PartialArrayIntAvailableEventArgs ecgArgs = new PartialArrayIntAvailableEventArgs(); 00133 00134 ecgArgs = new PartialArrayIntAvailableEventArgs(); 00135 ecgArgs.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_ECG; 00136 args.sampleNumberOffset = 5; 00137 args.array1 = new int[] { 00138 7, 00139 7, 00140 2, // Tag 0 has pace data 00141 7, 00142 7 00143 }; 00144 00145 args.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_PACE; 00146 args.sampleNumberOffset = 18; 00147 args.array1 = new int[] { 00148 123456, 123456, 123456, 00149 123456, 123456, 123456, 00150 0 << 14 | 0 << 13 | 0 << 12 | 1 << 2 | 1 << 1 | 1, 123456, 123456, 00151 123456, 123456, 123456, 00152 123456, 123456, 123456, 00153 123456, 123456, 123456 00154 }; 00155 00156 form.Controls.Add(ecgView); 00157 ecgView.On_AppendChart(this, args); 00158 result = ecgView.paceData; 00159 00160 Assert.AreEqual(-1, result.PaceLength(2)); 00161 } 00162 00163 [Test] 00164 public void PaceDataTag5() 00165 { 00166 Form form = new Form(); 00167 EcgView ecgView = new EcgView(); 00168 PaceData result; 00169 PartialArrayIntAvailableEventArgs args = new PartialArrayIntAvailableEventArgs(); 00170 PartialArrayIntAvailableEventArgs ecgArgs = new PartialArrayIntAvailableEventArgs(); 00171 00172 ecgArgs = new PartialArrayIntAvailableEventArgs(); 00173 ecgArgs.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_ECG; 00174 args.sampleNumberOffset = 5; 00175 args.array1 = new int[] { 00176 7, 00177 7, 00178 5, // Tag 0 has pace data 00179 7, 00180 7 00181 }; 00182 00183 args.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_PACE; 00184 args.sampleNumberOffset = 18; 00185 args.array1 = new int[] { 00186 123456, 123456, 123456, 00187 123456, 123456, 123456, 00188 123456, 123456, 123456, 00189 123456, 123456, 123456, 00190 123456, 123456, 123456, 00191 0 << 14 | 0 << 13 | 0 << 12 | 1 << 2 | 1 << 1 | 1, 123456, 123456 00192 }; 00193 00194 form.Controls.Add(ecgView); 00195 ecgView.On_AppendChart(this, args); 00196 result = ecgView.paceData; 00197 00198 Assert.AreEqual(-1, result.PaceLength(5)); 00199 } 00200 00201 [Test] 00202 public void PaceDataTag5Last() 00203 { 00204 Form form = new Form(); 00205 EcgView ecgView = new EcgView(); 00206 PaceData result; 00207 PartialArrayIntAvailableEventArgs args = new PartialArrayIntAvailableEventArgs(); 00208 PartialArrayIntAvailableEventArgs ecgArgs = new PartialArrayIntAvailableEventArgs(); 00209 00210 ecgArgs = new PartialArrayIntAvailableEventArgs(); 00211 ecgArgs.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_ECG; 00212 args.sampleNumberOffset = 5; 00213 args.array1 = new int[] { 00214 7, 00215 7, 00216 5, // Tag 0 has pace data 00217 7, 00218 7 00219 }; 00220 00221 args.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_PACE; 00222 args.sampleNumberOffset = 18; 00223 args.array1 = new int[] { 00224 123456, 123456, 123456, 00225 123456, 123456, 123456, 00226 123456, 123456, 123456, 00227 123456, 123456, 123456, 00228 123456, 123456, 123456, 00229 0 << 14 | 0 << 13 | 0 << 12 | 1 << 2 | 1 << 1 | 0, 0, 1 << 2 | 1 << 1 | 1 00230 }; 00231 00232 form.Controls.Add(ecgView); 00233 ecgView.On_AppendChart(this, args); 00234 result = ecgView.paceData; 00235 00236 Assert.AreEqual(-1, result.PaceLength(5)); 00237 } 00238 00239 [Test] 00240 public void PaceDataFalling() 00241 { 00242 Form form = new Form(); 00243 EcgView ecgView = new EcgView(); 00244 PaceData result; 00245 PartialArrayIntAvailableEventArgs args = new PartialArrayIntAvailableEventArgs(); 00246 PartialArrayIntAvailableEventArgs ecgArgs = new PartialArrayIntAvailableEventArgs(); 00247 00248 ecgArgs = new PartialArrayIntAvailableEventArgs(); 00249 ecgArgs.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_ECG; 00250 args.sampleNumberOffset = 5; 00251 args.array1 = new int[] { 00252 7, 00253 7, 00254 0, // Tag 0 has pace data 00255 7, 00256 7 00257 }; 00258 00259 args.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_PACE; 00260 args.sampleNumberOffset = 18; 00261 args.array1 = new int[] { 00262 0 << 14 | 0 << 13 | 0 << 12 | 1 << 2 | 0 << 1 | 1, 123456, 123456, 00263 123456, 123456, 123456, 00264 123456, 123456, 123456, 00265 123456, 123456, 123456, 00266 123456, 123456, 123456, 00267 123456, 123456, 123456 00268 }; 00269 00270 00271 form.Controls.Add(ecgView); 00272 ecgView.On_AppendChart(this, args); 00273 result = ecgView.paceData; 00274 00275 Assert.AreEqual(-1, result.PaceLength(0)); 00276 } 00277 00278 [Test] 00279 public void PaceDataRising() 00280 { 00281 Form form = new Form(); 00282 EcgView ecgView = new EcgView(); 00283 PaceData result; 00284 PartialArrayIntAvailableEventArgs args = new PartialArrayIntAvailableEventArgs(); 00285 PartialArrayIntAvailableEventArgs ecgArgs = new PartialArrayIntAvailableEventArgs(); 00286 00287 ecgArgs = new PartialArrayIntAvailableEventArgs(); 00288 ecgArgs.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_ECG; 00289 args.sampleNumberOffset = 5; 00290 args.array1 = new int[] { 00291 7, 00292 7, 00293 0, // Tag 0 has pace data 00294 7, 00295 7 00296 }; 00297 00298 args.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_PACE; 00299 args.sampleNumberOffset = 18; 00300 args.array1 = new int[] { 00301 0 << 14 | 1 << 13 | 0 << 12 | 1 << 2 | 0 << 1 | 1, 123456, 123456, 00302 // Rising Falling 00303 123456, 123456, 123456, 00304 123456, 123456, 123456, 00305 123456, 123456, 123456, 00306 123456, 123456, 123456, 00307 123456, 123456, 123456 00308 }; 00309 00310 00311 form.Controls.Add(ecgView); 00312 ecgView.On_AppendChart(this, args); 00313 result = ecgView.paceData; 00314 00315 Assert.AreEqual(1, result.PaceLength(0)); 00316 } 00317 00318 [Test] 00319 public void PaceDataMaxCode() 00320 { 00321 Form form = new Form(); 00322 EcgView ecgView = new EcgView(); 00323 PaceData result; 00324 PartialArrayIntAvailableEventArgs args = new PartialArrayIntAvailableEventArgs(); 00325 PartialArrayIntAvailableEventArgs ecgArgs = new PartialArrayIntAvailableEventArgs(); 00326 00327 ecgArgs = new PartialArrayIntAvailableEventArgs(); 00328 ecgArgs.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_ECG; 00329 args.sampleNumberOffset = 5; 00330 args.array1 = new int[] { 00331 7, 00332 7, 00333 0, // Tag 0 has pace data 00334 7, 00335 7 00336 }; 00337 00338 args.reportID = PartialArrayIntAvailableEventArgs.PACKET_MAX30001_PACE; 00339 args.sampleNumberOffset = 18; 00340 args.array1 = new int[] { 00341 0 << 14 | 0 << 13 | 0 << 12 | 0x3FF << 2 | 1 << 1 | 1, 123456, 123456, 00342 123456, 123456, 123456, 00343 123456, 123456, 123456, 00344 123456, 123456, 123456, 00345 123456, 123456, 123456, 00346 123456, 123456, 123456 00347 }; 00348 00349 00350 form.Controls.Add(ecgView); 00351 ecgView.On_AppendChart(this, args); 00352 result = ecgView.paceData; 00353 00354 Assert.AreEqual(-0x3FF, result.PaceLength(0)); 00355 } 00356 */ 00357 00358 [Test] 00359 public void PaceDataParsing() 00360 { 00361 PaceData.PaceRegister register = new PaceData.PaceRegister(new int[] { 0x5865A6, 0x5E868C, 0x6E3FFF }); 00362 00363 Assert.AreEqual(353, register.Edge[0].Data); 00364 Assert.AreEqual(361, register.Edge[1].Data); 00365 Assert.AreEqual(378, register.Edge[2].Data); 00366 Assert.AreEqual(419, register.Edge[3].Data); 00367 Assert.AreEqual(440, register.Edge[4].Data); 00368 } 00369 } 00370 }
Generated on Tue Jul 12 2022 21:52:39 by
1.7.2