DeviceInfoMesg.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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. /// <summary>
  26. /// Implements the DeviceInfo profile message.
  27. /// </summary>
  28. public class DeviceInfoMesg : Mesg
  29. {
  30. #region Fields
  31. static class DeviceTypeSubfield
  32. {
  33. public static ushort AntplusDeviceType = 0;
  34. public static ushort AntDeviceType = 1;
  35. public static ushort Subfields = 2;
  36. public static ushort Active = Fit.SubfieldIndexActiveSubfield;
  37. public static ushort MainField = Fit.SubfieldIndexMainField;
  38. }
  39. static class ProductSubfield
  40. {
  41. public static ushort GarminProduct = 0;
  42. public static ushort Subfields = 1;
  43. public static ushort Active = Fit.SubfieldIndexActiveSubfield;
  44. public static ushort MainField = Fit.SubfieldIndexMainField;
  45. }
  46. #endregion
  47. #region Constructors
  48. public DeviceInfoMesg() : base(Profile.GetMesg(MesgNum.DeviceInfo))
  49. {
  50. }
  51. public DeviceInfoMesg(Mesg mesg) : base(mesg)
  52. {
  53. }
  54. #endregion // Constructors
  55. #region Methods
  56. ///<summary>
  57. /// Retrieves the Timestamp field
  58. /// Units: s</summary>
  59. /// <returns>Returns DateTime representing the Timestamp field</returns>
  60. public DateTime GetTimestamp()
  61. {
  62. return TimestampToDateTime((uint?)GetFieldValue(253, 0, Fit.SubfieldIndexMainField));
  63. }
  64. /// <summary>
  65. /// Set Timestamp field
  66. /// Units: s</summary>
  67. /// <param name="timestamp_">Nullable field value to be set</param>
  68. public void SetTimestamp(DateTime timestamp_)
  69. {
  70. SetFieldValue(253, 0, timestamp_.GetTimeStamp(), Fit.SubfieldIndexMainField);
  71. }
  72. ///<summary>
  73. /// Retrieves the DeviceIndex field</summary>
  74. /// <returns>Returns nullable byte representing the DeviceIndex field</returns>
  75. public byte? GetDeviceIndex()
  76. {
  77. return (byte?)GetFieldValue(0, 0, Fit.SubfieldIndexMainField);
  78. }
  79. /// <summary>
  80. /// Set DeviceIndex field</summary>
  81. /// <param name="deviceIndex_">Nullable field value to be set</param>
  82. public void SetDeviceIndex(byte? deviceIndex_)
  83. {
  84. SetFieldValue(0, 0, deviceIndex_, Fit.SubfieldIndexMainField);
  85. }
  86. ///<summary>
  87. /// Retrieves the DeviceType field</summary>
  88. /// <returns>Returns nullable byte representing the DeviceType field</returns>
  89. public byte? GetDeviceType()
  90. {
  91. return (byte?)GetFieldValue(1, 0, Fit.SubfieldIndexMainField);
  92. }
  93. /// <summary>
  94. /// Set DeviceType field</summary>
  95. /// <param name="deviceType_">Nullable field value to be set</param>
  96. public void SetDeviceType(byte? deviceType_)
  97. {
  98. SetFieldValue(1, 0, deviceType_, Fit.SubfieldIndexMainField);
  99. }
  100. /// <summary>
  101. /// Retrieves the AntplusDeviceType subfield</summary>
  102. /// <returns>Nullable byte representing the AntplusDeviceType subfield</returns>
  103. public byte? GetAntplusDeviceType()
  104. {
  105. return (byte?)GetFieldValue(1, 0, DeviceTypeSubfield.AntplusDeviceType);
  106. }
  107. /// <summary>
  108. ///
  109. /// Set AntplusDeviceType subfield</summary>
  110. /// <param name="antplusDeviceType">Subfield value to be set</param>
  111. public void SetAntplusDeviceType(byte? antplusDeviceType)
  112. {
  113. SetFieldValue(1, 0, antplusDeviceType, DeviceTypeSubfield.AntplusDeviceType);
  114. }
  115. /// <summary>
  116. /// Retrieves the AntDeviceType subfield</summary>
  117. /// <returns>Nullable byte representing the AntDeviceType subfield</returns>
  118. public byte? GetAntDeviceType()
  119. {
  120. return (byte?)GetFieldValue(1, 0, DeviceTypeSubfield.AntDeviceType);
  121. }
  122. /// <summary>
  123. ///
  124. /// Set AntDeviceType subfield</summary>
  125. /// <param name="antDeviceType">Subfield value to be set</param>
  126. public void SetAntDeviceType(byte? antDeviceType)
  127. {
  128. SetFieldValue(1, 0, antDeviceType, DeviceTypeSubfield.AntDeviceType);
  129. }
  130. ///<summary>
  131. /// Retrieves the Manufacturer field</summary>
  132. /// <returns>Returns nullable ushort representing the Manufacturer field</returns>
  133. public ushort? GetManufacturer()
  134. {
  135. return (ushort?)GetFieldValue(2, 0, Fit.SubfieldIndexMainField);
  136. }
  137. /// <summary>
  138. /// Set Manufacturer field</summary>
  139. /// <param name="manufacturer_">Nullable field value to be set</param>
  140. public void SetManufacturer(ushort? manufacturer_)
  141. {
  142. SetFieldValue(2, 0, manufacturer_, Fit.SubfieldIndexMainField);
  143. }
  144. ///<summary>
  145. /// Retrieves the SerialNumber field</summary>
  146. /// <returns>Returns nullable uint representing the SerialNumber field</returns>
  147. public uint? GetSerialNumber()
  148. {
  149. return (uint?)GetFieldValue(3, 0, Fit.SubfieldIndexMainField);
  150. }
  151. /// <summary>
  152. /// Set SerialNumber field</summary>
  153. /// <param name="serialNumber_">Nullable field value to be set</param>
  154. public void SetSerialNumber(uint? serialNumber_)
  155. {
  156. SetFieldValue(3, 0, serialNumber_, Fit.SubfieldIndexMainField);
  157. }
  158. ///<summary>
  159. /// Retrieves the Product field</summary>
  160. /// <returns>Returns nullable ushort representing the Product field</returns>
  161. public ushort? GetProduct()
  162. {
  163. return (ushort?)GetFieldValue(4, 0, Fit.SubfieldIndexMainField);
  164. }
  165. /// <summary>
  166. /// Set Product field</summary>
  167. /// <param name="product_">Nullable field value to be set</param>
  168. public void SetProduct(ushort? product_)
  169. {
  170. SetFieldValue(4, 0, product_, Fit.SubfieldIndexMainField);
  171. }
  172. /// <summary>
  173. /// Retrieves the GarminProduct subfield</summary>
  174. /// <returns>Nullable ushort representing the GarminProduct subfield</returns>
  175. public ushort? GetGarminProduct()
  176. {
  177. return (ushort?)GetFieldValue(4, 0, ProductSubfield.GarminProduct);
  178. }
  179. /// <summary>
  180. ///
  181. /// Set GarminProduct subfield</summary>
  182. /// <param name="garminProduct">Subfield value to be set</param>
  183. public void SetGarminProduct(ushort? garminProduct)
  184. {
  185. SetFieldValue(4, 0, garminProduct, ProductSubfield.GarminProduct);
  186. }
  187. ///<summary>
  188. /// Retrieves the SoftwareVersion field</summary>
  189. /// <returns>Returns nullable float representing the SoftwareVersion field</returns>
  190. public float? GetSoftwareVersion()
  191. {
  192. return (float?)GetFieldValue(5, 0, Fit.SubfieldIndexMainField);
  193. }
  194. /// <summary>
  195. /// Set SoftwareVersion field</summary>
  196. /// <param name="softwareVersion_">Nullable field value to be set</param>
  197. public void SetSoftwareVersion(float? softwareVersion_)
  198. {
  199. SetFieldValue(5, 0, softwareVersion_, Fit.SubfieldIndexMainField);
  200. }
  201. ///<summary>
  202. /// Retrieves the HardwareVersion field</summary>
  203. /// <returns>Returns nullable byte representing the HardwareVersion field</returns>
  204. public byte? GetHardwareVersion()
  205. {
  206. return (byte?)GetFieldValue(6, 0, Fit.SubfieldIndexMainField);
  207. }
  208. /// <summary>
  209. /// Set HardwareVersion field</summary>
  210. /// <param name="hardwareVersion_">Nullable field value to be set</param>
  211. public void SetHardwareVersion(byte? hardwareVersion_)
  212. {
  213. SetFieldValue(6, 0, hardwareVersion_, Fit.SubfieldIndexMainField);
  214. }
  215. ///<summary>
  216. /// Retrieves the CumOperatingTime field
  217. /// Units: s
  218. /// Comment: Reset by new battery or charge.</summary>
  219. /// <returns>Returns nullable uint representing the CumOperatingTime field</returns>
  220. public uint? GetCumOperatingTime()
  221. {
  222. return (uint?)GetFieldValue(7, 0, Fit.SubfieldIndexMainField);
  223. }
  224. /// <summary>
  225. /// Set CumOperatingTime field
  226. /// Units: s
  227. /// Comment: Reset by new battery or charge.</summary>
  228. /// <param name="cumOperatingTime_">Nullable field value to be set</param>
  229. public void SetCumOperatingTime(uint? cumOperatingTime_)
  230. {
  231. SetFieldValue(7, 0, cumOperatingTime_, Fit.SubfieldIndexMainField);
  232. }
  233. ///<summary>
  234. /// Retrieves the BatteryVoltage field
  235. /// Units: V</summary>
  236. /// <returns>Returns nullable float representing the BatteryVoltage field</returns>
  237. public float? GetBatteryVoltage()
  238. {
  239. return (float?)GetFieldValue(10, 0, Fit.SubfieldIndexMainField);
  240. }
  241. /// <summary>
  242. /// Set BatteryVoltage field
  243. /// Units: V</summary>
  244. /// <param name="batteryVoltage_">Nullable field value to be set</param>
  245. public void SetBatteryVoltage(float? batteryVoltage_)
  246. {
  247. SetFieldValue(10, 0, batteryVoltage_, Fit.SubfieldIndexMainField);
  248. }
  249. ///<summary>
  250. /// Retrieves the BatteryStatus field</summary>
  251. /// <returns>Returns nullable byte representing the BatteryStatus field</returns>
  252. public byte? GetBatteryStatus()
  253. {
  254. return (byte?)GetFieldValue(11, 0, Fit.SubfieldIndexMainField);
  255. }
  256. /// <summary>
  257. /// Set BatteryStatus field</summary>
  258. /// <param name="batteryStatus_">Nullable field value to be set</param>
  259. public void SetBatteryStatus(byte? batteryStatus_)
  260. {
  261. SetFieldValue(11, 0, batteryStatus_, Fit.SubfieldIndexMainField);
  262. }
  263. ///<summary>
  264. /// Retrieves the SensorPosition field
  265. /// Comment: Indicates the location of the sensor</summary>
  266. /// <returns>Returns nullable BodyLocation enum representing the SensorPosition field</returns>
  267. public BodyLocation? GetSensorPosition()
  268. {
  269. object obj = GetFieldValue(18, 0, Fit.SubfieldIndexMainField);
  270. BodyLocation? value = obj == null ? (BodyLocation?)null : (BodyLocation)obj;
  271. return value;
  272. }
  273. /// <summary>
  274. /// Set SensorPosition field
  275. /// Comment: Indicates the location of the sensor</summary>
  276. /// <param name="sensorPosition_">Nullable field value to be set</param>
  277. public void SetSensorPosition(BodyLocation? sensorPosition_)
  278. {
  279. SetFieldValue(18, 0, sensorPosition_, Fit.SubfieldIndexMainField);
  280. }
  281. ///<summary>
  282. /// Retrieves the Descriptor field
  283. /// Comment: Used to describe the sensor or location</summary>
  284. /// <returns>Returns byte[] representing the Descriptor field</returns>
  285. public byte[] GetDescriptor()
  286. {
  287. return (byte[])GetFieldValue(19, 0, Fit.SubfieldIndexMainField);
  288. }
  289. ///<summary>
  290. /// Retrieves the Descriptor field
  291. /// Comment: Used to describe the sensor or location</summary>
  292. /// <returns>Returns String representing the Descriptor field</returns>
  293. public String GetDescriptorAsString()
  294. {
  295. return Encoding.UTF8.GetString((byte[])GetFieldValue(19, 0, Fit.SubfieldIndexMainField));
  296. }
  297. ///<summary>
  298. /// Set Descriptor field
  299. /// Comment: Used to describe the sensor or location</summary>
  300. /// <param name="descriptor_"> field value to be set</param>
  301. public void SetDescriptor(String descriptor_)
  302. {
  303. SetFieldValue(19, 0, System.Text.Encoding.UTF8.GetBytes(descriptor_), Fit.SubfieldIndexMainField);
  304. }
  305. /// <summary>
  306. /// Set Descriptor field
  307. /// Comment: Used to describe the sensor or location</summary>
  308. /// <param name="descriptor_">field value to be set</param>
  309. public void SetDescriptor(byte[] descriptor_)
  310. {
  311. SetFieldValue(19, 0, descriptor_, Fit.SubfieldIndexMainField);
  312. }
  313. ///<summary>
  314. /// Retrieves the AntTransmissionType field</summary>
  315. /// <returns>Returns nullable byte representing the AntTransmissionType field</returns>
  316. public byte? GetAntTransmissionType()
  317. {
  318. return (byte?)GetFieldValue(20, 0, Fit.SubfieldIndexMainField);
  319. }
  320. /// <summary>
  321. /// Set AntTransmissionType field</summary>
  322. /// <param name="antTransmissionType_">Nullable field value to be set</param>
  323. public void SetAntTransmissionType(byte? antTransmissionType_)
  324. {
  325. SetFieldValue(20, 0, antTransmissionType_, Fit.SubfieldIndexMainField);
  326. }
  327. ///<summary>
  328. /// Retrieves the AntDeviceNumber field</summary>
  329. /// <returns>Returns nullable ushort representing the AntDeviceNumber field</returns>
  330. public ushort? GetAntDeviceNumber()
  331. {
  332. return (ushort?)GetFieldValue(21, 0, Fit.SubfieldIndexMainField);
  333. }
  334. /// <summary>
  335. /// Set AntDeviceNumber field</summary>
  336. /// <param name="antDeviceNumber_">Nullable field value to be set</param>
  337. public void SetAntDeviceNumber(ushort? antDeviceNumber_)
  338. {
  339. SetFieldValue(21, 0, antDeviceNumber_, Fit.SubfieldIndexMainField);
  340. }
  341. ///<summary>
  342. /// Retrieves the AntNetwork field</summary>
  343. /// <returns>Returns nullable AntNetwork enum representing the AntNetwork field</returns>
  344. public AntNetwork? GetAntNetwork()
  345. {
  346. object obj = GetFieldValue(22, 0, Fit.SubfieldIndexMainField);
  347. AntNetwork? value = obj == null ? (AntNetwork?)null : (AntNetwork)obj;
  348. return value;
  349. }
  350. /// <summary>
  351. /// Set AntNetwork field</summary>
  352. /// <param name="antNetwork_">Nullable field value to be set</param>
  353. public void SetAntNetwork(AntNetwork? antNetwork_)
  354. {
  355. SetFieldValue(22, 0, antNetwork_, Fit.SubfieldIndexMainField);
  356. }
  357. ///<summary>
  358. /// Retrieves the SourceType field</summary>
  359. /// <returns>Returns nullable SourceType enum representing the SourceType field</returns>
  360. public SourceType? GetSourceType()
  361. {
  362. object obj = GetFieldValue(25, 0, Fit.SubfieldIndexMainField);
  363. SourceType? value = obj == null ? (SourceType?)null : (SourceType)obj;
  364. return value;
  365. }
  366. /// <summary>
  367. /// Set SourceType field</summary>
  368. /// <param name="sourceType_">Nullable field value to be set</param>
  369. public void SetSourceType(SourceType? sourceType_)
  370. {
  371. SetFieldValue(25, 0, sourceType_, Fit.SubfieldIndexMainField);
  372. }
  373. ///<summary>
  374. /// Retrieves the ProductName field
  375. /// Comment: Optional free form string to indicate the devices name or model</summary>
  376. /// <returns>Returns byte[] representing the ProductName field</returns>
  377. public byte[] GetProductName()
  378. {
  379. return (byte[])GetFieldValue(27, 0, Fit.SubfieldIndexMainField);
  380. }
  381. ///<summary>
  382. /// Retrieves the ProductName field
  383. /// Comment: Optional free form string to indicate the devices name or model</summary>
  384. /// <returns>Returns String representing the ProductName field</returns>
  385. public String GetProductNameAsString()
  386. {
  387. return Encoding.UTF8.GetString((byte[])GetFieldValue(27, 0, Fit.SubfieldIndexMainField));
  388. }
  389. ///<summary>
  390. /// Set ProductName field
  391. /// Comment: Optional free form string to indicate the devices name or model</summary>
  392. /// <param name="productName_"> field value to be set</param>
  393. public void SetProductName(String productName_)
  394. {
  395. SetFieldValue(27, 0, System.Text.Encoding.UTF8.GetBytes(productName_), Fit.SubfieldIndexMainField);
  396. }
  397. /// <summary>
  398. /// Set ProductName field
  399. /// Comment: Optional free form string to indicate the devices name or model</summary>
  400. /// <param name="productName_">field value to be set</param>
  401. public void SetProductName(byte[] productName_)
  402. {
  403. SetFieldValue(27, 0, productName_, Fit.SubfieldIndexMainField);
  404. }
  405. #endregion // Methods
  406. } // Class
  407. } // namespace