Defines.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. namespace Dynastream.Fit
  20. {
  21. public class Fit
  22. {
  23. public const byte ProtocolVersion = ((ProtocolMajorVersion << ProtocolVersionMajorShift) + ProtocolMinorVersion);
  24. public const byte ProtocolMajorVersion = 1;
  25. public const byte ProtocolMinorVersion = 0;
  26. public const byte ProtocolVersionMajorShift = 4;
  27. public const byte ProtocolVersionMajorMask = (0x0F << ProtocolVersionMajorShift);
  28. public const ushort ProfileVersion = ((ProfileMajorVersion * 100) + ProfileMinorVersion);
  29. public const ushort ProfileMajorVersion = 16;
  30. public const ushort ProfileMinorVersion = 60;
  31. public const byte HeaderTypeMask = 0xF0;
  32. public const byte CompressedHeaderMask = 0x80;
  33. public const byte CompressedTimeMask = 0x1F;
  34. public const byte CompressedLocalMesgNumMask = 0x60;
  35. public const byte MesgDefinitionMask = 0x40;
  36. public const byte MesgHeaderMask = 0x00;
  37. public const byte LocalMesgNumMask = 0x0F;
  38. public const byte MaxLocalMesgs = LocalMesgNumMask + 1;
  39. public const byte MesgDefinitionReserved = 0x00;
  40. public const byte LittleEndian = 0x00;
  41. public const byte BigEndian = 0x01;
  42. public const byte MaxMesgSize = 255;
  43. public const byte MaxFieldSize = 255;
  44. public const byte HeaderWithCRCSize = 14;
  45. public const byte HeaderWithoutCRCSize = (HeaderWithCRCSize - 2);
  46. public const byte FieldNumInvalid = 255;
  47. public const byte FieldNumTimeStamp = 253;
  48. public const ushort SubfieldIndexMainField = SubfieldIndexActiveSubfield + 1;
  49. public const ushort SubfieldIndexActiveSubfield = 0xFFFE;
  50. public const string SubfieldNameMainField = "";
  51. public static FitType[] BaseType = new FitType[]
  52. {
  53. new FitType(false, 0x00, "enum", (byte)0xFF, 1, false, false),
  54. new FitType(false, 0x01, "sint8", (sbyte)0x7F, 1, true, true),
  55. new FitType(false, 0x02, "uint8", (byte)0xFF, 1, false, true),
  56. new FitType(true, 0x83, "sint16", (short)0x7FFF, 2, true, true),
  57. new FitType(true, 0x84, "uint16", (ushort)0xFFFF, 2, false, true),
  58. new FitType(true, 0x85, "sint32", (int)0x7FFFFFFF, 4, true, true),
  59. new FitType(true, 0x86, "uint32", (uint)0xFFFFFFFF, 4, false, true),
  60. new FitType(false, 0x07, "string", (byte)0x00, 1, false, false),
  61. new FitType(true, 0x88, "float32", BitConverter.ToSingle(new byte[] {0xFF, 0xFF, 0xFF, 0xFF}, 0), 4, true, false),
  62. new FitType(true, 0x89, "float64", BitConverter.ToDouble(new byte[] {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 0), 8, true, false),
  63. new FitType(false, 0x0A, "uint8z", (byte)0x00, 1, false, true),
  64. new FitType(true, 0x8B, "uint16z", (ushort)0x0000, 2, false, true),
  65. new FitType(true, 0x8C, "uint32z", (uint)0x00000000, 4, false, true),
  66. new FitType(false, 0x0D, "byte", (byte)0xFF, 1, false, false)
  67. };
  68. public struct FitType
  69. {
  70. public bool endianAbility;
  71. public byte baseTypeField;
  72. public string typeName;
  73. public object invalidValue;
  74. public byte size;
  75. public bool isSigned;
  76. public bool isInteger;
  77. public FitType(bool endianAbility, byte baseTypeField, string typeName, object invalidValue, byte size, bool isSigned, bool isInt)
  78. {
  79. this.endianAbility = endianAbility;
  80. this.baseTypeField = baseTypeField;
  81. this.typeName = typeName;
  82. this.invalidValue = invalidValue;
  83. this.size = size;
  84. this.isSigned = isSigned;
  85. this.isInteger = isInt;
  86. }
  87. }
  88. // Index into the BaseTypes array
  89. public const byte Enum = 0x00;
  90. public const byte SInt8 = 0x01;
  91. public const byte UInt8 = 0x02;
  92. public const byte SInt16 = 0x03;
  93. public const byte UInt16 = 0x04;
  94. public const byte SInt32 = 0x05;
  95. public const byte UInt32 = 0x06;
  96. public const byte String = 0x07;
  97. public const byte Float32 = 0x08;
  98. public const byte Float64 = 0x09;
  99. public const byte UInt8z = 0x0A;
  100. public const byte UInt16z = 0x0B;
  101. public const byte UInt32z = 0x0C;
  102. public const byte Byte = 0x0D;
  103. // And this with the type defn to get the index
  104. public const byte BaseTypeNumMask = 0x1F;
  105. }
  106. }