ObdiiDataMesg.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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 ObdiiData profile message.
  27. /// </summary>
  28. public class ObdiiDataMesg : Mesg
  29. {
  30. #region Fields
  31. #endregion
  32. #region Constructors
  33. public ObdiiDataMesg() : base(Profile.GetMesg(MesgNum.ObdiiData))
  34. {
  35. }
  36. public ObdiiDataMesg(Mesg mesg) : base(mesg)
  37. {
  38. }
  39. #endregion // Constructors
  40. #region Methods
  41. ///<summary>
  42. /// Retrieves the Timestamp field
  43. /// Units: s
  44. /// Comment: Timestamp message was output</summary>
  45. /// <returns>Returns DateTime representing the Timestamp field</returns>
  46. public DateTime GetTimestamp()
  47. {
  48. return TimestampToDateTime((uint?)GetFieldValue(253, 0, Fit.SubfieldIndexMainField));
  49. }
  50. /// <summary>
  51. /// Set Timestamp field
  52. /// Units: s
  53. /// Comment: Timestamp message was output</summary>
  54. /// <param name="timestamp_">Nullable field value to be set</param>
  55. public void SetTimestamp(DateTime timestamp_)
  56. {
  57. SetFieldValue(253, 0, timestamp_.GetTimeStamp(), Fit.SubfieldIndexMainField);
  58. }
  59. ///<summary>
  60. /// Retrieves the TimestampMs field
  61. /// Units: ms
  62. /// Comment: Fractional part of timestamp, added to timestamp</summary>
  63. /// <returns>Returns nullable ushort representing the TimestampMs field</returns>
  64. public ushort? GetTimestampMs()
  65. {
  66. return (ushort?)GetFieldValue(0, 0, Fit.SubfieldIndexMainField);
  67. }
  68. /// <summary>
  69. /// Set TimestampMs field
  70. /// Units: ms
  71. /// Comment: Fractional part of timestamp, added to timestamp</summary>
  72. /// <param name="timestampMs_">Nullable field value to be set</param>
  73. public void SetTimestampMs(ushort? timestampMs_)
  74. {
  75. SetFieldValue(0, 0, timestampMs_, Fit.SubfieldIndexMainField);
  76. }
  77. /// <summary>
  78. ///
  79. /// </summary>
  80. /// <returns>returns number of elements in field TimeOffset</returns>
  81. public int GetNumTimeOffset()
  82. {
  83. return GetNumFieldValues(1, Fit.SubfieldIndexMainField);
  84. }
  85. ///<summary>
  86. /// Retrieves the TimeOffset field
  87. /// Units: ms
  88. /// Comment: Offset of PID reading [i] from start_timestamp+start_timestamp_ms. Readings may span accross seconds.</summary>
  89. /// <param name="index">0 based index of TimeOffset element to retrieve</param>
  90. /// <returns>Returns nullable ushort representing the TimeOffset field</returns>
  91. public ushort? GetTimeOffset(int index)
  92. {
  93. return (ushort?)GetFieldValue(1, index, Fit.SubfieldIndexMainField);
  94. }
  95. /// <summary>
  96. /// Set TimeOffset field
  97. /// Units: ms
  98. /// Comment: Offset of PID reading [i] from start_timestamp+start_timestamp_ms. Readings may span accross seconds.</summary>
  99. /// <param name="index">0 based index of time_offset</param>
  100. /// <param name="timeOffset_">Nullable field value to be set</param>
  101. public void SetTimeOffset(int index, ushort? timeOffset_)
  102. {
  103. SetFieldValue(1, index, timeOffset_, Fit.SubfieldIndexMainField);
  104. }
  105. ///<summary>
  106. /// Retrieves the Pid field
  107. /// Comment: Parameter ID</summary>
  108. /// <returns>Returns nullable byte representing the Pid field</returns>
  109. public byte? GetPid()
  110. {
  111. return (byte?)GetFieldValue(2, 0, Fit.SubfieldIndexMainField);
  112. }
  113. /// <summary>
  114. /// Set Pid field
  115. /// Comment: Parameter ID</summary>
  116. /// <param name="pid_">Nullable field value to be set</param>
  117. public void SetPid(byte? pid_)
  118. {
  119. SetFieldValue(2, 0, pid_, Fit.SubfieldIndexMainField);
  120. }
  121. /// <summary>
  122. ///
  123. /// </summary>
  124. /// <returns>returns number of elements in field RawData</returns>
  125. public int GetNumRawData()
  126. {
  127. return GetNumFieldValues(3, Fit.SubfieldIndexMainField);
  128. }
  129. ///<summary>
  130. /// Retrieves the RawData field
  131. /// Comment: Raw parameter data</summary>
  132. /// <param name="index">0 based index of RawData element to retrieve</param>
  133. /// <returns>Returns nullable byte representing the RawData field</returns>
  134. public byte? GetRawData(int index)
  135. {
  136. return (byte?)GetFieldValue(3, index, Fit.SubfieldIndexMainField);
  137. }
  138. /// <summary>
  139. /// Set RawData field
  140. /// Comment: Raw parameter data</summary>
  141. /// <param name="index">0 based index of raw_data</param>
  142. /// <param name="rawData_">Nullable field value to be set</param>
  143. public void SetRawData(int index, byte? rawData_)
  144. {
  145. SetFieldValue(3, index, rawData_, Fit.SubfieldIndexMainField);
  146. }
  147. /// <summary>
  148. ///
  149. /// </summary>
  150. /// <returns>returns number of elements in field PidDataSize</returns>
  151. public int GetNumPidDataSize()
  152. {
  153. return GetNumFieldValues(4, Fit.SubfieldIndexMainField);
  154. }
  155. ///<summary>
  156. /// Retrieves the PidDataSize field
  157. /// Comment: Optional, data size of PID[i]. If not specified refer to SAE J1979.</summary>
  158. /// <param name="index">0 based index of PidDataSize element to retrieve</param>
  159. /// <returns>Returns nullable byte representing the PidDataSize field</returns>
  160. public byte? GetPidDataSize(int index)
  161. {
  162. return (byte?)GetFieldValue(4, index, Fit.SubfieldIndexMainField);
  163. }
  164. /// <summary>
  165. /// Set PidDataSize field
  166. /// Comment: Optional, data size of PID[i]. If not specified refer to SAE J1979.</summary>
  167. /// <param name="index">0 based index of pid_data_size</param>
  168. /// <param name="pidDataSize_">Nullable field value to be set</param>
  169. public void SetPidDataSize(int index, byte? pidDataSize_)
  170. {
  171. SetFieldValue(4, index, pidDataSize_, Fit.SubfieldIndexMainField);
  172. }
  173. /// <summary>
  174. ///
  175. /// </summary>
  176. /// <returns>returns number of elements in field SystemTime</returns>
  177. public int GetNumSystemTime()
  178. {
  179. return GetNumFieldValues(5, Fit.SubfieldIndexMainField);
  180. }
  181. ///<summary>
  182. /// Retrieves the SystemTime field
  183. /// Comment: System time associated with sample expressed in ms, can be used instead of time_offset. There will be a system_time value for each raw_data element. For multibyte pids the system_time is repeated.</summary>
  184. /// <param name="index">0 based index of SystemTime element to retrieve</param>
  185. /// <returns>Returns nullable uint representing the SystemTime field</returns>
  186. public uint? GetSystemTime(int index)
  187. {
  188. return (uint?)GetFieldValue(5, index, Fit.SubfieldIndexMainField);
  189. }
  190. /// <summary>
  191. /// Set SystemTime field
  192. /// Comment: System time associated with sample expressed in ms, can be used instead of time_offset. There will be a system_time value for each raw_data element. For multibyte pids the system_time is repeated.</summary>
  193. /// <param name="index">0 based index of system_time</param>
  194. /// <param name="systemTime_">Nullable field value to be set</param>
  195. public void SetSystemTime(int index, uint? systemTime_)
  196. {
  197. SetFieldValue(5, index, systemTime_, Fit.SubfieldIndexMainField);
  198. }
  199. ///<summary>
  200. /// Retrieves the StartTimestamp field
  201. /// Comment: Timestamp of first sample recorded in the message. Used with time_offset to generate time of each sample</summary>
  202. /// <returns>Returns DateTime representing the StartTimestamp field</returns>
  203. public DateTime GetStartTimestamp()
  204. {
  205. return TimestampToDateTime((uint?)GetFieldValue(6, 0, Fit.SubfieldIndexMainField));
  206. }
  207. /// <summary>
  208. /// Set StartTimestamp field
  209. /// Comment: Timestamp of first sample recorded in the message. Used with time_offset to generate time of each sample</summary>
  210. /// <param name="startTimestamp_">Nullable field value to be set</param>
  211. public void SetStartTimestamp(DateTime startTimestamp_)
  212. {
  213. SetFieldValue(6, 0, startTimestamp_.GetTimeStamp(), Fit.SubfieldIndexMainField);
  214. }
  215. ///<summary>
  216. /// Retrieves the StartTimestampMs field
  217. /// Units: ms
  218. /// Comment: Fractional part of start_timestamp</summary>
  219. /// <returns>Returns nullable ushort representing the StartTimestampMs field</returns>
  220. public ushort? GetStartTimestampMs()
  221. {
  222. return (ushort?)GetFieldValue(7, 0, Fit.SubfieldIndexMainField);
  223. }
  224. /// <summary>
  225. /// Set StartTimestampMs field
  226. /// Units: ms
  227. /// Comment: Fractional part of start_timestamp</summary>
  228. /// <param name="startTimestampMs_">Nullable field value to be set</param>
  229. public void SetStartTimestampMs(ushort? startTimestampMs_)
  230. {
  231. SetFieldValue(7, 0, startTimestampMs_, Fit.SubfieldIndexMainField);
  232. }
  233. #endregion // Methods
  234. } // Class
  235. } // namespace