ThreeDSensorCalibrationMesg.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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 ThreeDSensorCalibration profile message.
  27. /// </summary>
  28. public class ThreeDSensorCalibrationMesg : Mesg
  29. {
  30. #region Fields
  31. static class CalibrationFactorSubfield
  32. {
  33. public static ushort AccelCalFactor = 0;
  34. public static ushort GyroCalFactor = 1;
  35. public static ushort Subfields = 2;
  36. public static ushort Active = Fit.SubfieldIndexActiveSubfield;
  37. public static ushort MainField = Fit.SubfieldIndexMainField;
  38. }
  39. #endregion
  40. #region Constructors
  41. public ThreeDSensorCalibrationMesg() : base(Profile.GetMesg(MesgNum.ThreeDSensorCalibration))
  42. {
  43. }
  44. public ThreeDSensorCalibrationMesg(Mesg mesg) : base(mesg)
  45. {
  46. }
  47. #endregion // Constructors
  48. #region Methods
  49. ///<summary>
  50. /// Retrieves the Timestamp field
  51. /// Units: s
  52. /// Comment: Whole second part of the timestamp</summary>
  53. /// <returns>Returns DateTime representing the Timestamp field</returns>
  54. public DateTime GetTimestamp()
  55. {
  56. return TimestampToDateTime((uint?)GetFieldValue(253, 0, Fit.SubfieldIndexMainField));
  57. }
  58. /// <summary>
  59. /// Set Timestamp field
  60. /// Units: s
  61. /// Comment: Whole second part of the timestamp</summary>
  62. /// <param name="timestamp_">Nullable field value to be set</param>
  63. public void SetTimestamp(DateTime timestamp_)
  64. {
  65. SetFieldValue(253, 0, timestamp_.GetTimeStamp(), Fit.SubfieldIndexMainField);
  66. }
  67. ///<summary>
  68. /// Retrieves the SensorType field
  69. /// Comment: Indicates which sensor the calibration is for</summary>
  70. /// <returns>Returns nullable SensorType enum representing the SensorType field</returns>
  71. public SensorType? GetSensorType()
  72. {
  73. object obj = GetFieldValue(0, 0, Fit.SubfieldIndexMainField);
  74. SensorType? value = obj == null ? (SensorType?)null : (SensorType)obj;
  75. return value;
  76. }
  77. /// <summary>
  78. /// Set SensorType field
  79. /// Comment: Indicates which sensor the calibration is for</summary>
  80. /// <param name="sensorType_">Nullable field value to be set</param>
  81. public void SetSensorType(SensorType? sensorType_)
  82. {
  83. SetFieldValue(0, 0, sensorType_, Fit.SubfieldIndexMainField);
  84. }
  85. ///<summary>
  86. /// Retrieves the CalibrationFactor field
  87. /// Comment: Calibration factor used to convert from raw ADC value to degrees, g, etc.</summary>
  88. /// <returns>Returns nullable uint representing the CalibrationFactor field</returns>
  89. public uint? GetCalibrationFactor()
  90. {
  91. return (uint?)GetFieldValue(1, 0, Fit.SubfieldIndexMainField);
  92. }
  93. /// <summary>
  94. /// Set CalibrationFactor field
  95. /// Comment: Calibration factor used to convert from raw ADC value to degrees, g, etc.</summary>
  96. /// <param name="calibrationFactor_">Nullable field value to be set</param>
  97. public void SetCalibrationFactor(uint? calibrationFactor_)
  98. {
  99. SetFieldValue(1, 0, calibrationFactor_, Fit.SubfieldIndexMainField);
  100. }
  101. /// <summary>
  102. /// Retrieves the AccelCalFactor subfield
  103. /// Units: g
  104. /// Comment: Accelerometer calibration factor</summary>
  105. /// <returns>Nullable uint representing the AccelCalFactor subfield</returns>
  106. public uint? GetAccelCalFactor()
  107. {
  108. return (uint?)GetFieldValue(1, 0, CalibrationFactorSubfield.AccelCalFactor);
  109. }
  110. /// <summary>
  111. ///
  112. /// Set AccelCalFactor subfield
  113. /// Units: g
  114. /// Comment: Accelerometer calibration factor</summary>
  115. /// <param name="accelCalFactor">Subfield value to be set</param>
  116. public void SetAccelCalFactor(uint? accelCalFactor)
  117. {
  118. SetFieldValue(1, 0, accelCalFactor, CalibrationFactorSubfield.AccelCalFactor);
  119. }
  120. /// <summary>
  121. /// Retrieves the GyroCalFactor subfield
  122. /// Units: deg/s
  123. /// Comment: Gyro calibration factor</summary>
  124. /// <returns>Nullable uint representing the GyroCalFactor subfield</returns>
  125. public uint? GetGyroCalFactor()
  126. {
  127. return (uint?)GetFieldValue(1, 0, CalibrationFactorSubfield.GyroCalFactor);
  128. }
  129. /// <summary>
  130. ///
  131. /// Set GyroCalFactor subfield
  132. /// Units: deg/s
  133. /// Comment: Gyro calibration factor</summary>
  134. /// <param name="gyroCalFactor">Subfield value to be set</param>
  135. public void SetGyroCalFactor(uint? gyroCalFactor)
  136. {
  137. SetFieldValue(1, 0, gyroCalFactor, CalibrationFactorSubfield.GyroCalFactor);
  138. }
  139. ///<summary>
  140. /// Retrieves the CalibrationDivisor field
  141. /// Units: counts
  142. /// Comment: Calibration factor divisor</summary>
  143. /// <returns>Returns nullable uint representing the CalibrationDivisor field</returns>
  144. public uint? GetCalibrationDivisor()
  145. {
  146. return (uint?)GetFieldValue(2, 0, Fit.SubfieldIndexMainField);
  147. }
  148. /// <summary>
  149. /// Set CalibrationDivisor field
  150. /// Units: counts
  151. /// Comment: Calibration factor divisor</summary>
  152. /// <param name="calibrationDivisor_">Nullable field value to be set</param>
  153. public void SetCalibrationDivisor(uint? calibrationDivisor_)
  154. {
  155. SetFieldValue(2, 0, calibrationDivisor_, Fit.SubfieldIndexMainField);
  156. }
  157. ///<summary>
  158. /// Retrieves the LevelShift field
  159. /// Comment: Level shift value used to shift the ADC value back into range</summary>
  160. /// <returns>Returns nullable uint representing the LevelShift field</returns>
  161. public uint? GetLevelShift()
  162. {
  163. return (uint?)GetFieldValue(3, 0, Fit.SubfieldIndexMainField);
  164. }
  165. /// <summary>
  166. /// Set LevelShift field
  167. /// Comment: Level shift value used to shift the ADC value back into range</summary>
  168. /// <param name="levelShift_">Nullable field value to be set</param>
  169. public void SetLevelShift(uint? levelShift_)
  170. {
  171. SetFieldValue(3, 0, levelShift_, Fit.SubfieldIndexMainField);
  172. }
  173. /// <summary>
  174. ///
  175. /// </summary>
  176. /// <returns>returns number of elements in field OffsetCal</returns>
  177. public int GetNumOffsetCal()
  178. {
  179. return GetNumFieldValues(4, Fit.SubfieldIndexMainField);
  180. }
  181. ///<summary>
  182. /// Retrieves the OffsetCal field
  183. /// Comment: Internal calibration factors, one for each: xy, yx, zx</summary>
  184. /// <param name="index">0 based index of OffsetCal element to retrieve</param>
  185. /// <returns>Returns nullable int representing the OffsetCal field</returns>
  186. public int? GetOffsetCal(int index)
  187. {
  188. return (int?)GetFieldValue(4, index, Fit.SubfieldIndexMainField);
  189. }
  190. /// <summary>
  191. /// Set OffsetCal field
  192. /// Comment: Internal calibration factors, one for each: xy, yx, zx</summary>
  193. /// <param name="index">0 based index of offset_cal</param>
  194. /// <param name="offsetCal_">Nullable field value to be set</param>
  195. public void SetOffsetCal(int index, int? offsetCal_)
  196. {
  197. SetFieldValue(4, index, offsetCal_, Fit.SubfieldIndexMainField);
  198. }
  199. /// <summary>
  200. ///
  201. /// </summary>
  202. /// <returns>returns number of elements in field OrientationMatrix</returns>
  203. public int GetNumOrientationMatrix()
  204. {
  205. return GetNumFieldValues(5, Fit.SubfieldIndexMainField);
  206. }
  207. ///<summary>
  208. /// Retrieves the OrientationMatrix field
  209. /// Comment: 3 x 3 rotation matrix (row major)</summary>
  210. /// <param name="index">0 based index of OrientationMatrix element to retrieve</param>
  211. /// <returns>Returns nullable float representing the OrientationMatrix field</returns>
  212. public float? GetOrientationMatrix(int index)
  213. {
  214. return (float?)GetFieldValue(5, index, Fit.SubfieldIndexMainField);
  215. }
  216. /// <summary>
  217. /// Set OrientationMatrix field
  218. /// Comment: 3 x 3 rotation matrix (row major)</summary>
  219. /// <param name="index">0 based index of orientation_matrix</param>
  220. /// <param name="orientationMatrix_">Nullable field value to be set</param>
  221. public void SetOrientationMatrix(int index, float? orientationMatrix_)
  222. {
  223. SetFieldValue(5, index, orientationMatrix_, Fit.SubfieldIndexMainField);
  224. }
  225. #endregion // Methods
  226. } // Class
  227. } // namespace