NmeaSentenceMesg.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 NmeaSentence profile message.
  27. /// </summary>
  28. public class NmeaSentenceMesg : Mesg
  29. {
  30. #region Fields
  31. #endregion
  32. #region Constructors
  33. public NmeaSentenceMesg() : base(Profile.GetMesg(MesgNum.NmeaSentence))
  34. {
  35. }
  36. public NmeaSentenceMesg(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. /// Retrieves the Sentence field
  79. /// Comment: NMEA sentence</summary>
  80. /// <returns>Returns byte[] representing the Sentence field</returns>
  81. public byte[] GetSentence()
  82. {
  83. return (byte[])GetFieldValue(1, 0, Fit.SubfieldIndexMainField);
  84. }
  85. ///<summary>
  86. /// Retrieves the Sentence field
  87. /// Comment: NMEA sentence</summary>
  88. /// <returns>Returns String representing the Sentence field</returns>
  89. public String GetSentenceAsString()
  90. {
  91. return Encoding.UTF8.GetString((byte[])GetFieldValue(1, 0, Fit.SubfieldIndexMainField));
  92. }
  93. ///<summary>
  94. /// Set Sentence field
  95. /// Comment: NMEA sentence</summary>
  96. /// <param name="sentence_"> field value to be set</param>
  97. public void SetSentence(String sentence_)
  98. {
  99. SetFieldValue(1, 0, System.Text.Encoding.UTF8.GetBytes(sentence_), Fit.SubfieldIndexMainField);
  100. }
  101. /// <summary>
  102. /// Set Sentence field
  103. /// Comment: NMEA sentence</summary>
  104. /// <param name="sentence_">field value to be set</param>
  105. public void SetSentence(byte[] sentence_)
  106. {
  107. SetFieldValue(1, 0, sentence_, Fit.SubfieldIndexMainField);
  108. }
  109. #endregion // Methods
  110. } // Class
  111. } // namespace