1
0

MesgBroadcaster.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  1. #region Copyright
  2. ////////////////////////////////////////////////////////////////////////////////
  3. // The following FIT Protocol software provided may be used with FIT protocol
  4. // devices only and remains the copyrighted property of Dynastream Innovations Inc.
  5. // The software is being provided on an "as-is" basis and as an accommodation,
  6. // and therefore all warranties, representations, or guarantees of any kind
  7. // (whether express, implied or statutory) including, without limitation,
  8. // warranties of merchantability, non-infringement, or fitness for a particular
  9. // purpose, are specifically disclaimed.
  10. //
  11. // Copyright 2016 Dynastream Innovations Inc.
  12. ////////////////////////////////////////////////////////////////////////////////
  13. // ****WARNING**** This file is auto-generated! Do NOT edit this file.
  14. // Profile Version = 16.60Release
  15. // Tag = production-akw-16.60.00-0-g5d3d436
  16. ////////////////////////////////////////////////////////////////////////////////
  17. #endregion
  18. using System;
  19. using System.Collections.Generic;
  20. using System.Diagnostics;
  21. using System.Text;
  22. using System.IO;
  23. namespace Dynastream.Fit
  24. {
  25. // Define our necessary event types (EventArgs and the delegate)
  26. public delegate void MesgEventHandler(object sender, MesgEventArgs e);
  27. public delegate void MesgDefinitionEventHandler(object sender, MesgDefinitionEventArgs e);
  28. public class MesgEventArgs : EventArgs
  29. {
  30. public Mesg mesg = null;
  31. public MesgEventArgs()
  32. {
  33. }
  34. public MesgEventArgs(Mesg newMesg)
  35. {
  36. mesg = new Mesg(newMesg);
  37. }
  38. }
  39. public class MesgDefinitionEventArgs : EventArgs
  40. {
  41. public MesgDefinition mesgDef = null;
  42. public MesgDefinitionEventArgs()
  43. {
  44. }
  45. public MesgDefinitionEventArgs(MesgDefinition newDefn)
  46. {
  47. mesgDef = new MesgDefinition(newDefn);
  48. }
  49. }
  50. /// <summary>
  51. /// The MesgBroadcaster manages Mesg and MesgDefinition events. Its
  52. /// handlers should be connected to the source of Mesg and MesgDef events
  53. /// (such as a file decoder).
  54. /// Clients may subscribe to the Broadcasters events (Mesg, Mesg Def
  55. /// or specofic Profile Mesg)
  56. /// </summary>
  57. public class MesgBroadcaster
  58. {
  59. #region Methods & Events
  60. public event MesgDefinitionEventHandler MesgDefinitionEvent;
  61. public event MesgEventHandler MesgEvent;
  62. // One event for every Profile Mesg
  63. public event MesgEventHandler FileIdMesgEvent;
  64. public event MesgEventHandler FileCreatorMesgEvent;
  65. public event MesgEventHandler TimestampCorrelationMesgEvent;
  66. public event MesgEventHandler SoftwareMesgEvent;
  67. public event MesgEventHandler SlaveDeviceMesgEvent;
  68. public event MesgEventHandler CapabilitiesMesgEvent;
  69. public event MesgEventHandler FileCapabilitiesMesgEvent;
  70. public event MesgEventHandler MesgCapabilitiesMesgEvent;
  71. public event MesgEventHandler FieldCapabilitiesMesgEvent;
  72. public event MesgEventHandler DeviceSettingsMesgEvent;
  73. public event MesgEventHandler UserProfileMesgEvent;
  74. public event MesgEventHandler HrmProfileMesgEvent;
  75. public event MesgEventHandler SdmProfileMesgEvent;
  76. public event MesgEventHandler BikeProfileMesgEvent;
  77. public event MesgEventHandler ZonesTargetMesgEvent;
  78. public event MesgEventHandler SportMesgEvent;
  79. public event MesgEventHandler HrZoneMesgEvent;
  80. public event MesgEventHandler SpeedZoneMesgEvent;
  81. public event MesgEventHandler CadenceZoneMesgEvent;
  82. public event MesgEventHandler PowerZoneMesgEvent;
  83. public event MesgEventHandler MetZoneMesgEvent;
  84. public event MesgEventHandler GoalMesgEvent;
  85. public event MesgEventHandler ActivityMesgEvent;
  86. public event MesgEventHandler SessionMesgEvent;
  87. public event MesgEventHandler LapMesgEvent;
  88. public event MesgEventHandler LengthMesgEvent;
  89. public event MesgEventHandler RecordMesgEvent;
  90. public event MesgEventHandler EventMesgEvent;
  91. public event MesgEventHandler DeviceInfoMesgEvent;
  92. public event MesgEventHandler TrainingFileMesgEvent;
  93. public event MesgEventHandler HrvMesgEvent;
  94. public event MesgEventHandler CameraEventMesgEvent;
  95. public event MesgEventHandler GyroscopeDataMesgEvent;
  96. public event MesgEventHandler AccelerometerDataMesgEvent;
  97. public event MesgEventHandler ThreeDSensorCalibrationMesgEvent;
  98. public event MesgEventHandler VideoFrameMesgEvent;
  99. public event MesgEventHandler ObdiiDataMesgEvent;
  100. public event MesgEventHandler NmeaSentenceMesgEvent;
  101. public event MesgEventHandler AviationAttitudeMesgEvent;
  102. public event MesgEventHandler VideoMesgEvent;
  103. public event MesgEventHandler VideoTitleMesgEvent;
  104. public event MesgEventHandler VideoDescriptionMesgEvent;
  105. public event MesgEventHandler VideoClipMesgEvent;
  106. public event MesgEventHandler CourseMesgEvent;
  107. public event MesgEventHandler CoursePointMesgEvent;
  108. public event MesgEventHandler SegmentIdMesgEvent;
  109. public event MesgEventHandler SegmentLeaderboardEntryMesgEvent;
  110. public event MesgEventHandler SegmentPointMesgEvent;
  111. public event MesgEventHandler SegmentLapMesgEvent;
  112. public event MesgEventHandler SegmentFileMesgEvent;
  113. public event MesgEventHandler WorkoutMesgEvent;
  114. public event MesgEventHandler WorkoutStepMesgEvent;
  115. public event MesgEventHandler ScheduleMesgEvent;
  116. public event MesgEventHandler TotalsMesgEvent;
  117. public event MesgEventHandler WeightScaleMesgEvent;
  118. public event MesgEventHandler BloodPressureMesgEvent;
  119. public event MesgEventHandler MonitoringInfoMesgEvent;
  120. public event MesgEventHandler MonitoringMesgEvent;
  121. public event MesgEventHandler HrMesgEvent;
  122. public event MesgEventHandler MemoGlobMesgEvent;
  123. public event MesgEventHandler AntChannelIdMesgEvent;
  124. public event MesgEventHandler AntRxMesgEvent;
  125. public event MesgEventHandler AntTxMesgEvent;
  126. public event MesgEventHandler PadMesgEvent;
  127. public void OnMesg(object sender, MesgEventArgs e)
  128. {
  129. // Notify any subscribers of either our general mesg event or specific profile mesg event
  130. if (MesgEvent != null)
  131. {
  132. MesgEvent(sender, e);
  133. }
  134. switch (e.mesg.Num)
  135. {
  136. case (ushort)MesgNum.FileId:
  137. if (FileIdMesgEvent != null)
  138. {
  139. FileIdMesg fileIdMesg = new FileIdMesg(e.mesg);
  140. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  141. mesgEventArgs.mesg = fileIdMesg;
  142. FileIdMesgEvent(sender, mesgEventArgs);
  143. }
  144. break;
  145. case (ushort)MesgNum.FileCreator:
  146. if (FileCreatorMesgEvent != null)
  147. {
  148. FileCreatorMesg fileCreatorMesg = new FileCreatorMesg(e.mesg);
  149. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  150. mesgEventArgs.mesg = fileCreatorMesg;
  151. FileCreatorMesgEvent(sender, mesgEventArgs);
  152. }
  153. break;
  154. case (ushort)MesgNum.TimestampCorrelation:
  155. if (TimestampCorrelationMesgEvent != null)
  156. {
  157. TimestampCorrelationMesg timestampCorrelationMesg = new TimestampCorrelationMesg(e.mesg);
  158. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  159. mesgEventArgs.mesg = timestampCorrelationMesg;
  160. TimestampCorrelationMesgEvent(sender, mesgEventArgs);
  161. }
  162. break;
  163. case (ushort)MesgNum.Software:
  164. if (SoftwareMesgEvent != null)
  165. {
  166. SoftwareMesg softwareMesg = new SoftwareMesg(e.mesg);
  167. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  168. mesgEventArgs.mesg = softwareMesg;
  169. SoftwareMesgEvent(sender, mesgEventArgs);
  170. }
  171. break;
  172. case (ushort)MesgNum.SlaveDevice:
  173. if (SlaveDeviceMesgEvent != null)
  174. {
  175. SlaveDeviceMesg slaveDeviceMesg = new SlaveDeviceMesg(e.mesg);
  176. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  177. mesgEventArgs.mesg = slaveDeviceMesg;
  178. SlaveDeviceMesgEvent(sender, mesgEventArgs);
  179. }
  180. break;
  181. case (ushort)MesgNum.Capabilities:
  182. if (CapabilitiesMesgEvent != null)
  183. {
  184. CapabilitiesMesg capabilitiesMesg = new CapabilitiesMesg(e.mesg);
  185. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  186. mesgEventArgs.mesg = capabilitiesMesg;
  187. CapabilitiesMesgEvent(sender, mesgEventArgs);
  188. }
  189. break;
  190. case (ushort)MesgNum.FileCapabilities:
  191. if (FileCapabilitiesMesgEvent != null)
  192. {
  193. FileCapabilitiesMesg fileCapabilitiesMesg = new FileCapabilitiesMesg(e.mesg);
  194. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  195. mesgEventArgs.mesg = fileCapabilitiesMesg;
  196. FileCapabilitiesMesgEvent(sender, mesgEventArgs);
  197. }
  198. break;
  199. case (ushort)MesgNum.MesgCapabilities:
  200. if (MesgCapabilitiesMesgEvent != null)
  201. {
  202. MesgCapabilitiesMesg mesgCapabilitiesMesg = new MesgCapabilitiesMesg(e.mesg);
  203. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  204. mesgEventArgs.mesg = mesgCapabilitiesMesg;
  205. MesgCapabilitiesMesgEvent(sender, mesgEventArgs);
  206. }
  207. break;
  208. case (ushort)MesgNum.FieldCapabilities:
  209. if (FieldCapabilitiesMesgEvent != null)
  210. {
  211. FieldCapabilitiesMesg fieldCapabilitiesMesg = new FieldCapabilitiesMesg(e.mesg);
  212. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  213. mesgEventArgs.mesg = fieldCapabilitiesMesg;
  214. FieldCapabilitiesMesgEvent(sender, mesgEventArgs);
  215. }
  216. break;
  217. case (ushort)MesgNum.DeviceSettings:
  218. if (DeviceSettingsMesgEvent != null)
  219. {
  220. DeviceSettingsMesg deviceSettingsMesg = new DeviceSettingsMesg(e.mesg);
  221. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  222. mesgEventArgs.mesg = deviceSettingsMesg;
  223. DeviceSettingsMesgEvent(sender, mesgEventArgs);
  224. }
  225. break;
  226. case (ushort)MesgNum.UserProfile:
  227. if (UserProfileMesgEvent != null)
  228. {
  229. UserProfileMesg userProfileMesg = new UserProfileMesg(e.mesg);
  230. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  231. mesgEventArgs.mesg = userProfileMesg;
  232. UserProfileMesgEvent(sender, mesgEventArgs);
  233. }
  234. break;
  235. case (ushort)MesgNum.HrmProfile:
  236. if (HrmProfileMesgEvent != null)
  237. {
  238. HrmProfileMesg hrmProfileMesg = new HrmProfileMesg(e.mesg);
  239. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  240. mesgEventArgs.mesg = hrmProfileMesg;
  241. HrmProfileMesgEvent(sender, mesgEventArgs);
  242. }
  243. break;
  244. case (ushort)MesgNum.SdmProfile:
  245. if (SdmProfileMesgEvent != null)
  246. {
  247. SdmProfileMesg sdmProfileMesg = new SdmProfileMesg(e.mesg);
  248. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  249. mesgEventArgs.mesg = sdmProfileMesg;
  250. SdmProfileMesgEvent(sender, mesgEventArgs);
  251. }
  252. break;
  253. case (ushort)MesgNum.BikeProfile:
  254. if (BikeProfileMesgEvent != null)
  255. {
  256. BikeProfileMesg bikeProfileMesg = new BikeProfileMesg(e.mesg);
  257. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  258. mesgEventArgs.mesg = bikeProfileMesg;
  259. BikeProfileMesgEvent(sender, mesgEventArgs);
  260. }
  261. break;
  262. case (ushort)MesgNum.ZonesTarget:
  263. if (ZonesTargetMesgEvent != null)
  264. {
  265. ZonesTargetMesg zonesTargetMesg = new ZonesTargetMesg(e.mesg);
  266. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  267. mesgEventArgs.mesg = zonesTargetMesg;
  268. ZonesTargetMesgEvent(sender, mesgEventArgs);
  269. }
  270. break;
  271. case (ushort)MesgNum.Sport:
  272. if (SportMesgEvent != null)
  273. {
  274. SportMesg sportMesg = new SportMesg(e.mesg);
  275. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  276. mesgEventArgs.mesg = sportMesg;
  277. SportMesgEvent(sender, mesgEventArgs);
  278. }
  279. break;
  280. case (ushort)MesgNum.HrZone:
  281. if (HrZoneMesgEvent != null)
  282. {
  283. HrZoneMesg hrZoneMesg = new HrZoneMesg(e.mesg);
  284. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  285. mesgEventArgs.mesg = hrZoneMesg;
  286. HrZoneMesgEvent(sender, mesgEventArgs);
  287. }
  288. break;
  289. case (ushort)MesgNum.SpeedZone:
  290. if (SpeedZoneMesgEvent != null)
  291. {
  292. SpeedZoneMesg speedZoneMesg = new SpeedZoneMesg(e.mesg);
  293. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  294. mesgEventArgs.mesg = speedZoneMesg;
  295. SpeedZoneMesgEvent(sender, mesgEventArgs);
  296. }
  297. break;
  298. case (ushort)MesgNum.CadenceZone:
  299. if (CadenceZoneMesgEvent != null)
  300. {
  301. CadenceZoneMesg cadenceZoneMesg = new CadenceZoneMesg(e.mesg);
  302. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  303. mesgEventArgs.mesg = cadenceZoneMesg;
  304. CadenceZoneMesgEvent(sender, mesgEventArgs);
  305. }
  306. break;
  307. case (ushort)MesgNum.PowerZone:
  308. if (PowerZoneMesgEvent != null)
  309. {
  310. PowerZoneMesg powerZoneMesg = new PowerZoneMesg(e.mesg);
  311. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  312. mesgEventArgs.mesg = powerZoneMesg;
  313. PowerZoneMesgEvent(sender, mesgEventArgs);
  314. }
  315. break;
  316. case (ushort)MesgNum.MetZone:
  317. if (MetZoneMesgEvent != null)
  318. {
  319. MetZoneMesg metZoneMesg = new MetZoneMesg(e.mesg);
  320. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  321. mesgEventArgs.mesg = metZoneMesg;
  322. MetZoneMesgEvent(sender, mesgEventArgs);
  323. }
  324. break;
  325. case (ushort)MesgNum.Goal:
  326. if (GoalMesgEvent != null)
  327. {
  328. GoalMesg goalMesg = new GoalMesg(e.mesg);
  329. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  330. mesgEventArgs.mesg = goalMesg;
  331. GoalMesgEvent(sender, mesgEventArgs);
  332. }
  333. break;
  334. case (ushort)MesgNum.Activity:
  335. if (ActivityMesgEvent != null)
  336. {
  337. ActivityMesg activityMesg = new ActivityMesg(e.mesg);
  338. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  339. mesgEventArgs.mesg = activityMesg;
  340. ActivityMesgEvent(sender, mesgEventArgs);
  341. }
  342. break;
  343. case (ushort)MesgNum.Session:
  344. if (SessionMesgEvent != null)
  345. {
  346. SessionMesg sessionMesg = new SessionMesg(e.mesg);
  347. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  348. mesgEventArgs.mesg = sessionMesg;
  349. SessionMesgEvent(sender, mesgEventArgs);
  350. }
  351. break;
  352. case (ushort)MesgNum.Lap:
  353. if (LapMesgEvent != null)
  354. {
  355. LapMesg lapMesg = new LapMesg(e.mesg);
  356. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  357. mesgEventArgs.mesg = lapMesg;
  358. LapMesgEvent(sender, mesgEventArgs);
  359. }
  360. break;
  361. case (ushort)MesgNum.Length:
  362. if (LengthMesgEvent != null)
  363. {
  364. LengthMesg lengthMesg = new LengthMesg(e.mesg);
  365. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  366. mesgEventArgs.mesg = lengthMesg;
  367. LengthMesgEvent(sender, mesgEventArgs);
  368. }
  369. break;
  370. case (ushort)MesgNum.Record:
  371. if (RecordMesgEvent != null)
  372. {
  373. RecordMesg recordMesg = new RecordMesg(e.mesg);
  374. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  375. mesgEventArgs.mesg = recordMesg;
  376. RecordMesgEvent(sender, mesgEventArgs);
  377. }
  378. break;
  379. case (ushort)MesgNum.Event:
  380. if (EventMesgEvent != null)
  381. {
  382. EventMesg eventMesg = new EventMesg(e.mesg);
  383. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  384. mesgEventArgs.mesg = eventMesg;
  385. EventMesgEvent(sender, mesgEventArgs);
  386. }
  387. break;
  388. case (ushort)MesgNum.DeviceInfo:
  389. if (DeviceInfoMesgEvent != null)
  390. {
  391. DeviceInfoMesg deviceInfoMesg = new DeviceInfoMesg(e.mesg);
  392. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  393. mesgEventArgs.mesg = deviceInfoMesg;
  394. DeviceInfoMesgEvent(sender, mesgEventArgs);
  395. }
  396. break;
  397. case (ushort)MesgNum.TrainingFile:
  398. if (TrainingFileMesgEvent != null)
  399. {
  400. TrainingFileMesg trainingFileMesg = new TrainingFileMesg(e.mesg);
  401. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  402. mesgEventArgs.mesg = trainingFileMesg;
  403. TrainingFileMesgEvent(sender, mesgEventArgs);
  404. }
  405. break;
  406. case (ushort)MesgNum.Hrv:
  407. if (HrvMesgEvent != null)
  408. {
  409. HrvMesg hrvMesg = new HrvMesg(e.mesg);
  410. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  411. mesgEventArgs.mesg = hrvMesg;
  412. HrvMesgEvent(sender, mesgEventArgs);
  413. }
  414. break;
  415. case (ushort)MesgNum.CameraEvent:
  416. if (CameraEventMesgEvent != null)
  417. {
  418. CameraEventMesg cameraEventMesg = new CameraEventMesg(e.mesg);
  419. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  420. mesgEventArgs.mesg = cameraEventMesg;
  421. CameraEventMesgEvent(sender, mesgEventArgs);
  422. }
  423. break;
  424. case (ushort)MesgNum.GyroscopeData:
  425. if (GyroscopeDataMesgEvent != null)
  426. {
  427. GyroscopeDataMesg gyroscopeDataMesg = new GyroscopeDataMesg(e.mesg);
  428. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  429. mesgEventArgs.mesg = gyroscopeDataMesg;
  430. GyroscopeDataMesgEvent(sender, mesgEventArgs);
  431. }
  432. break;
  433. case (ushort)MesgNum.AccelerometerData:
  434. if (AccelerometerDataMesgEvent != null)
  435. {
  436. AccelerometerDataMesg accelerometerDataMesg = new AccelerometerDataMesg(e.mesg);
  437. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  438. mesgEventArgs.mesg = accelerometerDataMesg;
  439. AccelerometerDataMesgEvent(sender, mesgEventArgs);
  440. }
  441. break;
  442. case (ushort)MesgNum.ThreeDSensorCalibration:
  443. if (ThreeDSensorCalibrationMesgEvent != null)
  444. {
  445. ThreeDSensorCalibrationMesg threeDSensorCalibrationMesg = new ThreeDSensorCalibrationMesg(e.mesg);
  446. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  447. mesgEventArgs.mesg = threeDSensorCalibrationMesg;
  448. ThreeDSensorCalibrationMesgEvent(sender, mesgEventArgs);
  449. }
  450. break;
  451. case (ushort)MesgNum.VideoFrame:
  452. if (VideoFrameMesgEvent != null)
  453. {
  454. VideoFrameMesg videoFrameMesg = new VideoFrameMesg(e.mesg);
  455. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  456. mesgEventArgs.mesg = videoFrameMesg;
  457. VideoFrameMesgEvent(sender, mesgEventArgs);
  458. }
  459. break;
  460. case (ushort)MesgNum.ObdiiData:
  461. if (ObdiiDataMesgEvent != null)
  462. {
  463. ObdiiDataMesg obdiiDataMesg = new ObdiiDataMesg(e.mesg);
  464. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  465. mesgEventArgs.mesg = obdiiDataMesg;
  466. ObdiiDataMesgEvent(sender, mesgEventArgs);
  467. }
  468. break;
  469. case (ushort)MesgNum.NmeaSentence:
  470. if (NmeaSentenceMesgEvent != null)
  471. {
  472. NmeaSentenceMesg nmeaSentenceMesg = new NmeaSentenceMesg(e.mesg);
  473. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  474. mesgEventArgs.mesg = nmeaSentenceMesg;
  475. NmeaSentenceMesgEvent(sender, mesgEventArgs);
  476. }
  477. break;
  478. case (ushort)MesgNum.AviationAttitude:
  479. if (AviationAttitudeMesgEvent != null)
  480. {
  481. AviationAttitudeMesg aviationAttitudeMesg = new AviationAttitudeMesg(e.mesg);
  482. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  483. mesgEventArgs.mesg = aviationAttitudeMesg;
  484. AviationAttitudeMesgEvent(sender, mesgEventArgs);
  485. }
  486. break;
  487. case (ushort)MesgNum.Video:
  488. if (VideoMesgEvent != null)
  489. {
  490. VideoMesg videoMesg = new VideoMesg(e.mesg);
  491. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  492. mesgEventArgs.mesg = videoMesg;
  493. VideoMesgEvent(sender, mesgEventArgs);
  494. }
  495. break;
  496. case (ushort)MesgNum.VideoTitle:
  497. if (VideoTitleMesgEvent != null)
  498. {
  499. VideoTitleMesg videoTitleMesg = new VideoTitleMesg(e.mesg);
  500. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  501. mesgEventArgs.mesg = videoTitleMesg;
  502. VideoTitleMesgEvent(sender, mesgEventArgs);
  503. }
  504. break;
  505. case (ushort)MesgNum.VideoDescription:
  506. if (VideoDescriptionMesgEvent != null)
  507. {
  508. VideoDescriptionMesg videoDescriptionMesg = new VideoDescriptionMesg(e.mesg);
  509. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  510. mesgEventArgs.mesg = videoDescriptionMesg;
  511. VideoDescriptionMesgEvent(sender, mesgEventArgs);
  512. }
  513. break;
  514. case (ushort)MesgNum.VideoClip:
  515. if (VideoClipMesgEvent != null)
  516. {
  517. VideoClipMesg videoClipMesg = new VideoClipMesg(e.mesg);
  518. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  519. mesgEventArgs.mesg = videoClipMesg;
  520. VideoClipMesgEvent(sender, mesgEventArgs);
  521. }
  522. break;
  523. case (ushort)MesgNum.Course:
  524. if (CourseMesgEvent != null)
  525. {
  526. CourseMesg courseMesg = new CourseMesg(e.mesg);
  527. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  528. mesgEventArgs.mesg = courseMesg;
  529. CourseMesgEvent(sender, mesgEventArgs);
  530. }
  531. break;
  532. case (ushort)MesgNum.CoursePoint:
  533. if (CoursePointMesgEvent != null)
  534. {
  535. CoursePointMesg coursePointMesg = new CoursePointMesg(e.mesg);
  536. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  537. mesgEventArgs.mesg = coursePointMesg;
  538. CoursePointMesgEvent(sender, mesgEventArgs);
  539. }
  540. break;
  541. case (ushort)MesgNum.SegmentId:
  542. if (SegmentIdMesgEvent != null)
  543. {
  544. SegmentIdMesg segmentIdMesg = new SegmentIdMesg(e.mesg);
  545. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  546. mesgEventArgs.mesg = segmentIdMesg;
  547. SegmentIdMesgEvent(sender, mesgEventArgs);
  548. }
  549. break;
  550. case (ushort)MesgNum.SegmentLeaderboardEntry:
  551. if (SegmentLeaderboardEntryMesgEvent != null)
  552. {
  553. SegmentLeaderboardEntryMesg segmentLeaderboardEntryMesg = new SegmentLeaderboardEntryMesg(e.mesg);
  554. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  555. mesgEventArgs.mesg = segmentLeaderboardEntryMesg;
  556. SegmentLeaderboardEntryMesgEvent(sender, mesgEventArgs);
  557. }
  558. break;
  559. case (ushort)MesgNum.SegmentPoint:
  560. if (SegmentPointMesgEvent != null)
  561. {
  562. SegmentPointMesg segmentPointMesg = new SegmentPointMesg(e.mesg);
  563. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  564. mesgEventArgs.mesg = segmentPointMesg;
  565. SegmentPointMesgEvent(sender, mesgEventArgs);
  566. }
  567. break;
  568. case (ushort)MesgNum.SegmentLap:
  569. if (SegmentLapMesgEvent != null)
  570. {
  571. SegmentLapMesg segmentLapMesg = new SegmentLapMesg(e.mesg);
  572. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  573. mesgEventArgs.mesg = segmentLapMesg;
  574. SegmentLapMesgEvent(sender, mesgEventArgs);
  575. }
  576. break;
  577. case (ushort)MesgNum.SegmentFile:
  578. if (SegmentFileMesgEvent != null)
  579. {
  580. SegmentFileMesg segmentFileMesg = new SegmentFileMesg(e.mesg);
  581. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  582. mesgEventArgs.mesg = segmentFileMesg;
  583. SegmentFileMesgEvent(sender, mesgEventArgs);
  584. }
  585. break;
  586. case (ushort)MesgNum.Workout:
  587. if (WorkoutMesgEvent != null)
  588. {
  589. WorkoutMesg workoutMesg = new WorkoutMesg(e.mesg);
  590. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  591. mesgEventArgs.mesg = workoutMesg;
  592. WorkoutMesgEvent(sender, mesgEventArgs);
  593. }
  594. break;
  595. case (ushort)MesgNum.WorkoutStep:
  596. if (WorkoutStepMesgEvent != null)
  597. {
  598. WorkoutStepMesg workoutStepMesg = new WorkoutStepMesg(e.mesg);
  599. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  600. mesgEventArgs.mesg = workoutStepMesg;
  601. WorkoutStepMesgEvent(sender, mesgEventArgs);
  602. }
  603. break;
  604. case (ushort)MesgNum.Schedule:
  605. if (ScheduleMesgEvent != null)
  606. {
  607. ScheduleMesg scheduleMesg = new ScheduleMesg(e.mesg);
  608. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  609. mesgEventArgs.mesg = scheduleMesg;
  610. ScheduleMesgEvent(sender, mesgEventArgs);
  611. }
  612. break;
  613. case (ushort)MesgNum.Totals:
  614. if (TotalsMesgEvent != null)
  615. {
  616. TotalsMesg totalsMesg = new TotalsMesg(e.mesg);
  617. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  618. mesgEventArgs.mesg = totalsMesg;
  619. TotalsMesgEvent(sender, mesgEventArgs);
  620. }
  621. break;
  622. case (ushort)MesgNum.WeightScale:
  623. if (WeightScaleMesgEvent != null)
  624. {
  625. WeightScaleMesg weightScaleMesg = new WeightScaleMesg(e.mesg);
  626. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  627. mesgEventArgs.mesg = weightScaleMesg;
  628. WeightScaleMesgEvent(sender, mesgEventArgs);
  629. }
  630. break;
  631. case (ushort)MesgNum.BloodPressure:
  632. if (BloodPressureMesgEvent != null)
  633. {
  634. BloodPressureMesg bloodPressureMesg = new BloodPressureMesg(e.mesg);
  635. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  636. mesgEventArgs.mesg = bloodPressureMesg;
  637. BloodPressureMesgEvent(sender, mesgEventArgs);
  638. }
  639. break;
  640. case (ushort)MesgNum.MonitoringInfo:
  641. if (MonitoringInfoMesgEvent != null)
  642. {
  643. MonitoringInfoMesg monitoringInfoMesg = new MonitoringInfoMesg(e.mesg);
  644. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  645. mesgEventArgs.mesg = monitoringInfoMesg;
  646. MonitoringInfoMesgEvent(sender, mesgEventArgs);
  647. }
  648. break;
  649. case (ushort)MesgNum.Monitoring:
  650. if (MonitoringMesgEvent != null)
  651. {
  652. MonitoringMesg monitoringMesg = new MonitoringMesg(e.mesg);
  653. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  654. mesgEventArgs.mesg = monitoringMesg;
  655. MonitoringMesgEvent(sender, mesgEventArgs);
  656. }
  657. break;
  658. case (ushort)MesgNum.Hr:
  659. if (HrMesgEvent != null)
  660. {
  661. HrMesg hrMesg = new HrMesg(e.mesg);
  662. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  663. mesgEventArgs.mesg = hrMesg;
  664. HrMesgEvent(sender, mesgEventArgs);
  665. }
  666. break;
  667. case (ushort)MesgNum.MemoGlob:
  668. if (MemoGlobMesgEvent != null)
  669. {
  670. MemoGlobMesg memoGlobMesg = new MemoGlobMesg(e.mesg);
  671. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  672. mesgEventArgs.mesg = memoGlobMesg;
  673. MemoGlobMesgEvent(sender, mesgEventArgs);
  674. }
  675. break;
  676. case (ushort)MesgNum.AntChannelId:
  677. if (AntChannelIdMesgEvent != null)
  678. {
  679. AntChannelIdMesg antChannelIdMesg = new AntChannelIdMesg(e.mesg);
  680. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  681. mesgEventArgs.mesg = antChannelIdMesg;
  682. AntChannelIdMesgEvent(sender, mesgEventArgs);
  683. }
  684. break;
  685. case (ushort)MesgNum.AntRx:
  686. if (AntRxMesgEvent != null)
  687. {
  688. AntRxMesg antRxMesg = new AntRxMesg(e.mesg);
  689. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  690. mesgEventArgs.mesg = antRxMesg;
  691. AntRxMesgEvent(sender, mesgEventArgs);
  692. }
  693. break;
  694. case (ushort)MesgNum.AntTx:
  695. if (AntTxMesgEvent != null)
  696. {
  697. AntTxMesg antTxMesg = new AntTxMesg(e.mesg);
  698. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  699. mesgEventArgs.mesg = antTxMesg;
  700. AntTxMesgEvent(sender, mesgEventArgs);
  701. }
  702. break;
  703. case (ushort)MesgNum.Pad:
  704. if (PadMesgEvent != null)
  705. {
  706. PadMesg padMesg = new PadMesg(e.mesg);
  707. MesgEventArgs mesgEventArgs = new MesgEventArgs();
  708. mesgEventArgs.mesg = padMesg;
  709. PadMesgEvent(sender, mesgEventArgs);
  710. }
  711. break;
  712. }
  713. }
  714. public void OnMesgDefinition(object sender, MesgDefinitionEventArgs e)
  715. {
  716. // Notify any subscribers
  717. if (MesgDefinitionEvent != null)
  718. {
  719. MesgDefinitionEvent(sender, e);
  720. }
  721. }
  722. #endregion // Methods
  723. } // Class
  724. } // namespace